Compare commits

..
491 Commits
Author SHA1 Message Date
Kim Gardner 524d432ec1 Update CircleCI node version 2017-07-17 15:42:22 -05:00
Kim Gardner 99ca2cd631 Downgrade to 7.10.1 due to dependency issues 2017-07-17 15:42:16 -05:00
Kim Gardner c91727e22f Update node version in CircleCI config 2017-07-17 15:42:11 -05:00
Kim Gardner 7933948a89 Update default node version for Talk 2017-07-17 15:42:04 -05:00
Kim Gardner 997675cac5 Update node version in Dockerfile 2017-07-17 15:41:54 -05:00
Kim Gardner 562f2350c1 Merge pull request #764 from coralproject/update-readme-recipes
Update README with info about Recipes
2017-07-13 13:10:42 -04:00
Kim Gardner ea6330bf94 Update README with info about Recipes 2017-07-13 13:01:47 -04:00
Kim Gardner 0be3dc2ceb Merge pull request #751 from coralproject/talk-plugin-avatar
Talk Plugin Avatar
2017-07-13 12:54:04 -04:00
Kim Gardner eb98b32d21 Merge branch 'master' into talk-plugin-avatar 2017-07-13 12:13:58 -04:00
Kim Gardner 127ee25d7f Merge pull request #763 from coralproject/docs-trouble
Add install troubleshooting doc
2017-07-13 12:13:40 -04:00
David Erwin ed4a3c3250 Merge branch 'master' into docs-trouble 2017-07-13 12:05:09 -04:00
David Erwin 7b53048a91 Add install troubleshooting doc 2017-07-13 12:04:18 -04:00
Chi Vinh Le 28e94d30b0 Only show seperator on top-level comments 2017-07-13 23:00:52 +07:00
Chi Vinh Le 1c2fec29a4 Merge branch 'master' into talk-plugin-avatar
Conflicts:
	client/coral-embed-stream/src/components/Comment.css
2017-07-13 22:58:35 +07:00
Kim Gardner 56cc4989fd Merge pull request #761 from coralproject/docs-metadata
Docs metadata
2017-07-13 11:53:58 -04:00
Kim Gardner b32aebd6f1 Merge branch 'master' into docs-metadata 2017-07-13 11:47:40 -04:00
Kim Gardner 244a276e1a Merge pull request #760 from coralproject/styles-fixes-2
Remove some global css, fix some styling issues
2017-07-13 11:46:28 -04:00
Kim Gardner 245561bd52 Merge branch 'master' into talk-plugin-avatar 2017-07-13 11:42:59 -04:00
Kim Gardner d05a63bc2e Merge branch 'master' into docs-metadata 2017-07-13 11:42:53 -04:00
Kim Gardner 5d118c26d1 Merge branch 'master' into styles-fixes-2 2017-07-13 11:42:04 -04:00
Belén Curcio 5ab5b7ca70 Merge pull request #762 from coralproject/reply-error-fix
BUG: Console error when you reply to a comment
2017-07-13 12:41:30 -03:00
Chi Vinh Le b79c990ee5 Only setState once 2017-07-13 22:34:53 +07:00
Belen Curcio 1541a618b5 Reordering divs 2017-07-13 12:29:06 -03:00
David Erwin 30b200d734 Fix typos 2017-07-13 10:58:31 -04:00
David Erwin dc76d89c47 Fewer, better words 2017-07-13 10:49:38 -04:00
Belen Curcio 3d80df1db6 Support for empty slot 2017-07-13 11:37:54 -03:00
Chi Vinh Le 83832abd72 More fixes 2017-07-13 21:37:08 +07:00
David Erwin 47fd522f68 Add first draft 2017-07-13 10:25:36 -04:00
Chi Vinh Le 1280b16bcd Remove some global css, fix some styling issues 2017-07-13 20:47:30 +07:00
David Erwin 3d666111b0 Add metadata docs 2017-07-13 09:26:37 -04:00
David Erwin 919bdff40a Use less words, say same thing 2017-07-13 09:26:09 -04:00
Belen Curcio 518b7b5358 merge 2017-07-12 15:04:24 -03:00
Belen Curcio 8b9463f501 Merge branch 'master' into talk-plugin-avatar 2017-07-12 15:01:14 -03:00
Belen Curcio f5313c0aed Merge branch 'master' of github.com:coralproject/talk into talk-plugin-avatar 2017-07-12 15:00:03 -03:00
Kim Gardner c59c09e1f4 Merge pull request #759 from coralproject/styles-quick-fix
Style glitches quick fix
2017-07-12 13:57:43 -04:00
Belen Curcio e98dcb6647 Merge branch 'master' of github.com:coralproject/talk into talk-plugin-avatar 2017-07-12 14:53:14 -03:00
Belen Curcio 39db11569f Merge branch 'talk-plugin-avatar' of github.com:coralproject/talk into talk-plugin-avatar 2017-07-12 14:52:18 -03:00
Belen Curcio c3ad47f6f6 Linting 2017-07-12 14:49:46 -03:00
Kiwi b9cb1a783f Merge branch 'master' into styles-quick-fix 2017-07-12 19:42:04 +02:00
Chi Vinh Le ea51fdf6cc Styles glitches quick fix 2017-07-13 00:39:55 +07:00
Kim Gardner 324aa6db32 Merge pull request #757 from coralproject/query-by-tags
Allow query comments and comment counts by tags
2017-07-12 13:35:00 -04:00
Belen Curcio 9065a64d13 Merge branch 'master' of github.com:coralproject/talk into talk-plugin-avatar 2017-07-12 14:33:00 -03:00
Kim Gardner 9b36fcebe9 Merge branch 'master' into query-by-tags 2017-07-12 12:21:20 -04:00
Kim Gardner 5d9d01d87f Merge pull request #749 from coralproject/extendable-tab-menu
Extendable Stream Tab Panel
2017-07-12 12:20:22 -04:00
Chi Vinh Le 7f85129044 Merge branch 'master' into extendable-tab-menu
Conflicts:
	client/coral-embed-stream/src/components/Embed.js
	client/coral-embed-stream/style/default.css
	client/coral-framework/helpers/plugins.js
	client/coral-plugin-replies/ReplyButton.css
	client/coral-plugin-replies/ReplyButton.js
	plugins/coral-plugin-like/client/LikeButton.js
	plugins/coral-plugin-like/client/styles.css
	plugins/coral-plugin-love/client/LoveButton.js
	plugins/coral-plugin-love/client/styles.css
2017-07-12 22:38:05 +07:00
Chi Vinh Le fc31a2882d Add a comment 2017-07-12 21:05:29 +07:00
Chi Vinh Le 23cc3548d4 Query by tags 2017-07-12 20:55:54 +07:00
Belén Curcio 574f5b7cea Merge branch 'master' into talk-plugin-avatar 2017-07-12 09:12:41 -03:00
Belen Curcio b19e050399 Merge branch 'master' of github.com:coralproject/talk 2017-07-12 09:10:48 -03:00
David Erwin ef3c82fee1 Merge pull request #758 from coralproject/docs-architecture-cli
Create cli docs
2017-07-11 16:57:54 -04:00
Kim Gardner 202e7a2b10 Merge branch 'master' into talk-plugin-avatar 2017-07-11 16:33:21 -04:00
Kim Gardner 2588f3946d Merge branch 'master' into docs-architecture-cli 2017-07-11 16:32:52 -04:00
Kim Gardner 1c2e850a07 Merge pull request #756 from coralproject/bump-version-2-4-0
Update version to 2.4.0
2017-07-11 16:23:16 -04:00
Kim Gardner 0e8ecb37f3 Merge branch 'master' into bump-version-2-4-0 2017-07-11 16:11:33 -04:00
David Erwin d1b96f5830 Merge branch 'docs-architecture-cli' of https://github.com/coralproject/talk into docs-architecture-cli 2017-07-11 15:06:07 -04:00
David Erwin a9c6014634 Add more info 2017-07-11 15:05:52 -04:00
Kim Gardner 125168c7c8 Merge branch 'master' into docs-architecture-cli 2017-07-11 14:58:41 -04:00
David Erwin eafcadd6a1 Warn users more 2017-07-11 14:43:59 -04:00
David Erwin 211f24476a Create cli docs 2017-07-11 14:39:26 -04:00
David Erwin f55e4ef895 Merge pull request #753 from coralproject/adapt-embed-classnames
Adapt Class Names
2017-07-11 14:20:53 -04:00
Kim Gardner bbf1da88e6 Merge branch 'master' into adapt-embed-classnames 2017-07-11 13:51:18 -04:00
Kim Gardner d688f70c19 Merge pull request #755 from coralproject/docs-qf-register-link
Fix 404
2017-07-11 13:47:11 -04:00
Kim Gardner da7aa8f6d0 Merge branch 'master' into talk-plugin-avatar 2017-07-11 13:46:41 -04:00
Kim Gardner b04a477f6a Merge branch 'master' into adapt-embed-classnames 2017-07-11 13:44:51 -04:00
Kim Gardner 0546f741a5 Bump version to 2.4.0 2017-07-11 13:43:12 -04:00
David Erwin a535baeb31 Merge branch 'master' into docs-qf-register-link 2017-07-11 13:41:56 -04:00
David Erwin 8b125eab48 Fix 404 2017-07-11 13:36:45 -04:00
Kim Gardner 053b687959 Merge pull request #746 from coralproject/create-plugin
Create Plugins - Create plugins through the CLI
2017-07-11 13:33:57 -04:00
Kim Gardner b620ac703b Merge branch 'master' into adapt-embed-classnames 2017-07-11 12:11:33 -04:00
Kim Gardner 3cb0bb052c Merge branch 'master' into create-plugin 2017-07-11 12:06:19 -04:00
Kim Gardner c4985e0007 Merge branch 'master' into talk-plugin-avatar 2017-07-11 12:02:17 -04:00
David Erwin 066d9ce0ec Merge pull request #745 from coralproject/docs-features
Docs Architecture
2017-07-11 11:55:41 -04:00
David Erwin dc6fa74d22 Add more clarity 2017-07-11 11:51:02 -04:00
David Erwin e9e79b4605 Merge branch 'docs-features' of https://github.com/coralproject/talk into docs-features 2017-07-11 11:06:25 -04:00
David Erwin 1d9b627d73 Fix typos and clarify 2017-07-11 11:05:58 -04:00
Chi Vinh Le 40f4419c9d Add flagged unflagged CSS classnames 2017-07-11 21:54:35 +07:00
Chi Vinh Le 8b70dc688d Adapt CSS classnames for Embed 2017-07-11 21:03:27 +07:00
Chi Vinh Le b05a6c00ce Correct aria-controls 2017-07-11 20:37:19 +07:00
Kim Gardner 9063b8adf1 Merge branch 'master' into docs-features 2017-07-11 08:18:25 -04:00
Kim Gardner 01fd667eb4 Merge branch 'master' into talk-plugin-avatar 2017-07-11 08:17:49 -04:00
Kim Gardner 73ac8d16ef Merge branch 'master' into create-plugin 2017-07-11 08:13:59 -04:00
Kim Gardner ced449a148 Merge pull request #747 from coralproject/fix-permalink-live-update
Fix perma view live updates
2017-07-11 08:12:59 -04:00
Kim Gardner ffad851066 Merge branch 'master' into fix-permalink-live-update 2017-07-11 07:49:16 -04:00
Kim Gardner 4281fd590c Merge pull request #750 from coralproject/no-label-on-mobile
Remove labels for comment actions on mobile.
2017-07-11 07:46:11 -04:00
Belen Curcio 0c167fdfc4 Removing talk-plugin-avatar 2017-07-10 17:43:51 -03:00
Belen Curcio 5dfb372c42 Merge branch 'master' of github.com:coralproject/talk 2017-07-10 17:11:06 -03:00
Belen Curcio 932103c204 updated yarn lock 2017-07-10 17:08:49 -03:00
Belen Curcio 666225614b Merge branch 'talk-plugin-avatar' of github.com:coralproject/talk into talk-plugin-avatar 2017-07-10 17:06:57 -03:00
Belen Curcio 636f357186 Reverting changes from old branch 2017-07-10 17:06:40 -03:00
Belén Curcio be6337f17c Merge branch 'master' into talk-plugin-avatar 2017-07-10 17:05:56 -03:00
Belen Curcio 2c7f5ca089 linting 2017-07-10 17:00:01 -03:00
Belen Curcio f09550a4ac Avatar plugin support extending fragments 2017-07-10 16:56:46 -03:00
Belen Curcio 3c3a0523de Avatar support 2017-07-10 16:27:15 -03:00
Chi Vinh Le a2dabcac0e Hide action labels on mobile 2017-07-11 01:26:25 +07:00
Wyatt Johnson a686bc75a7 Some changes to server side stuff + tempalte location 2017-07-10 10:30:20 -06:00
Chi Vinh Le 8960f67a4d Add todo comments 2017-07-10 22:49:06 +07:00
Chi Vinh Le e10c1f1a1f Docs 2017-07-10 22:45:28 +07:00
Chi Vinh Le 55e70dfbec Fix perma view live updates 2017-07-10 22:13:04 +07:00
Chi Vinh Le af46e3a7b1 Merge branch 'master' into extendable-tab-menu
Conflicts:
	client/coral-embed-stream/src/components/Comment.js
2017-07-10 22:03:32 +07:00
Chi Vinh Le 883dfedfab Fix new count styles 2017-07-10 21:57:25 +07:00
Chi Vinh Le ae52b27009 Don't use div inside p 2017-07-10 21:53:55 +07:00
Chi Vinh Le 34a4a005d1 Add margin to highlighted comment 2017-07-10 21:12:52 +07:00
Chi Vinh Le ab72995a2c Implement streamTabs and streamTabPanes slot 2017-07-10 20:46:28 +07:00
Chi Vinh Le aac47c4686 Add margin 2017-07-10 17:57:45 +07:00
Chi Vinh Le 362c072181 If only one tab left make it not clickable 2017-07-10 17:03:07 +07:00
Chi Vinh Le ef172ae5f8 Change streamBox to streamFilter 2017-07-10 17:03:07 +07:00
Chi Vinh Le 1e4e1cb413 Implement Stream TabBar 2017-07-10 17:03:06 +07:00
Belén Curcio e819b96473 Merge branch 'master' into create-plugin 2017-07-09 12:21:49 -03:00
Belen Curcio 1e3c1feadf cta 2017-07-09 12:09:54 -03:00
Belen Curcio 83d7e599c7 pushing client template 2017-07-09 12:09:07 -03:00
David Erwin 52d7ba8965 Add Tags docs 2017-07-07 16:59:18 -04:00
Belen Curcio c3ec772ea2 new cta for questions 2017-07-07 14:43:46 -03:00
David Erwin d2b4c2bcac Add architecture docs 2017-07-07 13:43:05 -04:00
Kim Gardner f738da4dd5 Merge pull request #744 from coralproject/redis-flush
Flush Redis before each test
2017-07-07 16:19:52 +01:00
Kim Gardner b796bf2607 Merge branch 'master' into redis-flush 2017-07-07 16:06:22 +01:00
Kim Gardner 3924ced659 Merge pull request #743 from coralproject/change-org-name
Added new cli-settings
2017-07-07 16:01:55 +01:00
Wyatt Johnson 23573501bd Configured redis to flush before each test and changed default test
redis database
2017-07-07 08:57:56 -06:00
Wyatt Johnson 787c00325d Added new cli-settings 2017-07-07 08:40:18 -06:00
Kim Gardner db371d1c82 Merge pull request #742 from coralproject/bump-version-2-3-0
Update version number
2017-07-07 15:25:36 +01:00
David Erwin b744a98a3d Merge branch 'master' into bump-version-2-3-0 2017-07-07 10:20:44 -04:00
Kim Gardner 37439a0896 Merge pull request #741 from coralproject/rm-commonjs-framework
Remove CommonJS style exports from framework
2017-07-07 15:19:57 +01:00
Kim Gardner af3cd8aa68 Update version number 2017-07-07 15:09:25 +01:00
Kiwi 7baa551a5c Merge branch 'master' into rm-commonjs-framework 2017-07-07 12:39:00 +02:00
Chi Vinh Le b7c4dbd224 Remove CommonJS style exports in framework 2017-07-07 17:27:05 +07:00
Belen Curcio aad2455654 Linting 2017-07-06 15:19:26 -03:00
Belen Curcio a8e5ad451d Plugins CLI :D 2017-07-06 15:08:39 -03:00
Belen Curcio 99425e89ca More questions 2017-07-06 13:09:43 -03:00
Belen Curcio 60608af8b2 Filter out the ones that have slots 2017-07-06 11:40:35 -03:00
Belen Curcio 7c753ee518 create-plugin 2017-07-05 16:41:52 -03:00
Belén Curcio b28902312d Merge pull request #740 from coralproject/threading-cleanup
Cleanup
2017-07-05 12:41:28 -03:00
Kiwi f32c03f002 Merge branch 'master' into threading-cleanup 2017-07-05 17:13:43 +02:00
Chi Vinh Le 693879647e Cleanup 2017-07-05 22:11:55 +07:00
Kim Gardner c01d1f95bc Merge pull request #735 from coralproject/french-translation
French translations
2017-07-05 15:59:36 +01:00
Kim Gardner 65d6d3221b Merge branch 'master' into french-translation 2017-07-05 15:36:14 +01:00
Kim Gardner 15af61de67 Merge pull request #738 from coralproject/threading
Deep Threading Support
2017-07-05 15:35:43 +01:00
Kim Gardner 1adca208dd Merge branch 'master' into french-translation 2017-07-05 15:26:39 +01:00
Kim Gardner 935982cb08 Merge branch 'master' into threading 2017-07-05 15:23:45 +01:00
Kim Gardner 4b9f3390d3 Merge pull request #739 from coralproject/bump-version-2-2-1
Update version 2.2.1
2017-07-05 11:57:27 +01:00
Kim Gardner f94c36e9c9 Update version 2.2.1 2017-07-05 11:43:18 +01:00
Kim Gardner c976ba0ea4 Merge branch 'master' into french-translation 2017-07-05 09:17:36 +01:00
Chi Vinh Le 6d71bcbee9 Fix styling issues 2017-07-04 22:56:58 +07:00
Chi Vinh Le 9be2a520db Merge branch 'master' into threading 2017-07-04 22:42:49 +07:00
Chi Vinh Le d155615102 Add pending comment 2017-07-04 22:41:38 +07:00
Kim Gardner 4d71a5a448 Merge pull request #737 from coralproject/fix-plugin-slot-logic
Fix isSlotEmpty logic and handle empty plugin_config
2017-07-04 16:35:05 +01:00
Chi Vinh Le cfa7a74742 Fix isSlotEmpty logic and handle empty plugin_config 2017-07-04 22:22:52 +07:00
Chi Vinh Le 524be1b869 Allow customizing thread levels via TALK_THREADING_LEVEL env 2017-07-04 22:10:40 +07:00
Chi Vinh Le 31ab54d13c First round styling 2017-07-04 21:32:33 +07:00
David Erwin c5203e3460 Merge pull request #734 from coralproject/dont-show-popup-when-empty
Don't show popup when empty
2017-07-03 14:40:31 -04:00
David Erwin 79c1bd9bdd Merge branch 'master' into dont-show-popup-when-empty 2017-07-03 14:35:44 -04:00
David Erwin e2575cb346 Merge pull request #733 from coralproject/disable-plugin-components-via-config
Disable plugin components via plugin_config
2017-07-03 14:28:54 -04:00
Chi Vinh Le 3a2a4379b8 Change to 4 levels 2017-07-04 01:09:27 +07:00
Chi Vinh Le f1899f2f4a Threading support 2017-07-04 01:09:12 +07:00
Belén Curcio 4d821afa6a Merge branch 'master' into disable-plugin-components-via-config 2017-07-03 15:08:36 -03:00
David Erwin c16278221c Merge pull request #719 from coralproject/docs-contribution-guide
Rewrite contributor's guide
2017-07-03 10:24:28 -04:00
David Erwin a50b39091f ABC Always Be Clarifying 2017-07-03 10:13:09 -04:00
David Erwin 4c7506e4f5 Merge branch 'docs-contribution-guide' of https://github.com/coralproject/talk into docs-contribution-guide 2017-07-03 10:06:56 -04:00
David Erwin 2f06281439 Move contributor's guide 2017-07-03 10:03:51 -04:00
Chi Vinh Le fd1f8b24c1 Don't show popup when empty 2017-07-03 19:40:26 +07:00
Chi Vinh Le 270c3b7634 Disable plugin components via plugin_config 2017-07-03 19:01:17 +07:00
Kim Gardner e4647cab98 Merge branch 'master' into docs-contribution-guide 2017-07-03 12:12:56 +01:00
Kim Gardner 60b4909395 Merge pull request #732 from coralproject/update-lockfile
Update yarn.lock
2017-06-30 17:53:57 +01:00
Kim Gardner 0973600e68 Update yarn.lock 2017-06-30 17:45:45 +01:00
Kim Gardner e3ead31964 Merge pull request #731 from coralproject/button-states
Support post, reply, edit, load and view more loading states via global css classnames
2017-06-30 17:32:47 +01:00
Chi Vinh Le 7858ccc45d Switch to prop-types 2017-06-30 23:25:11 +07:00
Chi Vinh Le c1807daeaf Correct spanish translation key 2017-06-30 21:10:19 +07:00
Chi Vinh Le e244d4a286 Merge branch 'master' into button-states
Conflicts:
	client/coral-embed-stream/src/components/Stream.js
2017-06-30 17:46:17 +07:00
Chi Vinh Le 9de99a9ef4 Support post, reply, edit, load and view more loading states via global css classnames 2017-06-30 17:00:42 +07:00
Belén Curcio 01883851ea Merge pull request #729 from coralproject/permalink-id
Permalink by Query Param instead of Hash
2017-06-29 14:05:07 -03:00
Belen Curcio c8d9447033 Adding the polifill to the package.json 2017-06-29 13:44:40 -03:00
Kim Gardner 4319bb9da3 Merge branch 'master' into docs-contribution-guide 2017-06-29 17:31:33 +01:00
Belen Curcio 9f8c8e9c83 Merge branch 'permalink-id' of github.com:coralproject/talk into permalink-id 2017-06-29 13:30:49 -03:00
Kim Gardner 997dffd326 Merge branch 'master' into permalink-id 2017-06-29 17:30:38 +01:00
Kim Gardner f6d652df0d Merge pull request #730 from coralproject/fix-build
Update dependencies to fix build
2017-06-29 17:30:20 +01:00
Belen Curcio c3ee442775 Replacing moderation comment and history hashes 2017-06-29 13:30:12 -03:00
Belen Curcio bad869bdfe Merge branch 'permalink-id' of github.com:coralproject/talk into permalink-id 2017-06-29 13:27:08 -03:00
Belen Curcio 2289c405d1 Translatios 2017-06-29 13:25:50 -03:00
Belen Curcio 354295c0ae Adding polyfill 2017-06-29 13:20:27 -03:00
Kim Gardner 737cea6e76 Reinstall modules 2017-06-29 16:59:00 +01:00
Kim Gardner 867f6966ba Update dependencies to fix build 2017-06-29 16:52:01 +01:00
Belén Curcio fbefd7fd20 Merge branch 'master' into permalink-id 2017-06-29 12:35:06 -03:00
Kim Gardner a0a7971866 Merge pull request #725 from StephanieDClark/add-tab-classes
Updates to tab classes
2017-06-29 16:22:52 +01:00
Kim Gardner 16355169ce Merge branch 'master' into add-tab-classes 2017-06-29 16:16:24 +01:00
Kim Gardner a7f4dea74a Merge branch 'master' into permalink-id 2017-06-29 15:58:23 +01:00
Kim Gardner 8aa0c16769 Merge pull request #728 from coralproject/bump-version-2-2-0
Bump version to 2.2.0
2017-06-29 15:57:20 +01:00
Belen Curcio d31044f39e linting 2017-06-29 11:25:52 -03:00
Belén Curcio a804973990 Merge branch 'master' into permalink-id 2017-06-29 11:22:28 -03:00
Belen Curcio db9c3b45c1 Stream Error 2017-06-29 11:06:52 -03:00
Belen Curcio ddac5c2c85 Avoid Error due to invalid queries 2017-06-29 10:48:29 -03:00
Belen Curcio 0312530b86 Modifying permalink plugin 2017-06-29 10:20:33 -03:00
Belen Curcio 87f8ed401f Using CommentId by queryParam 2017-06-29 10:18:40 -03:00
Kim Gardner 06ebd9ccc5 Bump version to 2.2.0 2017-06-29 12:15:00 +01:00
Kim Gardner e615624b62 Merge branch 'master' into add-tab-classes 2017-06-29 11:06:33 +01:00
Kim Gardner 9803ccfaf5 Merge pull request #724 from coralproject/permalink-patch
Permalink plugin now enabled by default
2017-06-29 10:35:11 +01:00
Wyatt Johnson ab84436a78 Update plugins.default.json 2017-06-28 15:32:53 -06:00
StephanieDClark ccaa744a78 Updates to tab classes 2017-06-28 14:26:41 -07:00
Belén Curcio d55fc6b601 Merge branch 'master' into docs-contribution-guide 2017-06-28 12:08:40 -03:00
Kim Gardner 32318567c9 Merge pull request #723 from coralproject/dont-alias-username-2
Don't alias username 2
2017-06-28 15:22:55 +01:00
Kiwi 6cf8c01d61 Merge branch 'master' into dont-alias-username-2 2017-06-28 21:17:41 +07:00
Chi Vinh Le b92afff4e7 Don't alias username 2 2017-06-28 21:14:34 +07:00
Kim Gardner 089ed0f09b Merge pull request #722 from coralproject/edit-name-fix
Allow editing to the same username in the "create username" flow
2017-06-28 14:43:17 +01:00
Belén Curcio 2258125789 Merge branch 'master' into edit-name-fix 2017-06-28 10:22:31 -03:00
Belén Curcio 8de4b475a1 Merge pull request #721 from coralproject/smooth-scroll
Smooth Scroll on Moderation
2017-06-28 10:21:56 -03:00
Belen Curcio 4691ee07de Merge branch 'smooth-scroll' of github.com:coralproject/talk into smooth-scroll 2017-06-28 09:07:19 -03:00
Belen Curcio f767b6a998 Removing old 2017-06-28 09:06:46 -03:00
Kiwi 9b26b0a434 Merge branch 'master' into edit-name-fix 2017-06-28 18:56:34 +07:00
Kim Gardner 7817804bae Merge branch 'master' into smooth-scroll 2017-06-28 12:51:43 +01:00
Kim Gardner b2738afdbe Merge pull request #718 from coralproject/no-username-alias
Don't alias username
2017-06-28 12:51:27 +01:00
Kim Gardner e0a32e5a70 Merge branch 'master' into smooth-scroll 2017-06-28 12:27:40 +01:00
Kiwi b7a981e84b Merge branch 'master' into no-username-alias 2017-06-28 16:37:01 +07:00
Kiwi 52431a4c4c Merge branch 'master' into edit-name-fix 2017-06-28 16:36:20 +07:00
Kim Gardner ca0431054b Merge pull request #720 from coralproject/flag-reason
BUG: Flag Username - Offensive, doesn't show up in the Community Admin
2017-06-28 10:33:52 +01:00
Kim Gardner 3f03994a51 Merge branch 'master' into flag-reason 2017-06-28 10:27:48 +01:00
Kim Gardner 198efd02b4 Merge branch 'master' into smooth-scroll 2017-06-28 10:27:00 +01:00
Kiwi aff486e909 Merge branch 'master' into no-username-alias 2017-06-28 16:22:12 +07:00
Kiwi 55e62b2b22 Merge branch 'master' into edit-name-fix 2017-06-28 16:20:01 +07:00
Kim Gardner 37e6c2c45c Merge pull request #717 from coralproject/live-suspension
Live update on stream when banned user, suspended user or rejected username
2017-06-28 10:16:18 +01:00
Chi Vinh Le 270491dc0f Allow editing to the same username in the "create username" flow 2017-06-28 16:08:46 +07:00
Belén Curcio 04b562543e Merge branch 'master' into flag-reason 2017-06-27 16:53:56 -03:00
Belen Curcio dd76ac1ed4 Now the smooth flag works 2017-06-27 16:51:00 -03:00
Belen Curcio e03e15fb3b renaming 2017-06-27 16:20:08 -03:00
Belen Curcio f13682c125 flagMap added to the admin side 2017-06-27 16:12:13 -03:00
David Erwin 3695ce5cb7 Update links 2017-06-27 15:08:21 -04:00
David Erwin d68169757d Rewrite contributor's guide 2017-06-27 15:04:00 -04:00
Belén Curcio 6d4765b45d Merge branch 'master' into no-username-alias 2017-06-27 16:03:03 -03:00
David Erwin b94824b8ee Merge branch 'master' into live-suspension 2017-06-27 14:14:21 -04:00
Belén Curcio cb1b9a1463 Merge pull request #714 from coralproject/unify-taglists
Refactor TagsInput and improve UX
2017-06-27 14:54:57 -03:00
Belen Curcio 35ccc5070d Flag refactor 2017-06-27 14:52:12 -03:00
Kiwi efb18cdb32 Merge branch 'master' into unify-taglists 2017-06-28 00:28:32 +07:00
Kiwi 2338ff1694 Merge branch 'master' into no-username-alias 2017-06-28 00:15:14 +07:00
Chi Vinh Le b134d4099c More concise and functional subscribing 2017-06-28 00:13:47 +07:00
Kim Gardner 1b40521f88 Merge branch 'master' into live-suspension 2017-06-27 17:53:58 +01:00
Kim Gardner 88473a1c71 Merge pull request #716 from coralproject/coral-plugin-permalink
Talk Plugin Permalink
2017-06-27 17:53:38 +01:00
Chi Vinh Le 97ab338486 Don't alias username 2017-06-27 23:51:49 +07:00
Kiwi 8d4e45c0ed Merge branch 'master' into coral-plugin-permalink 2017-06-27 23:46:55 +07:00
Kim Gardner 53b481dc68 Merge branch 'master' into unify-taglists 2017-06-27 16:25:00 +01:00
Chi Vinh Le b67ac375ba Pass current user to CommentBox 2017-06-27 22:14:06 +07:00
Chi Vinh Le 500d5d582e Fix edit 2017-06-27 21:51:19 +07:00
Kiwi 5b9fe5688f Merge branch 'master' into live-suspension 2017-06-27 21:44:26 +07:00
Chi Vinh Le 175dd30d27 Keep comment box when user is degraded (live) 2017-06-27 21:40:48 +07:00
David Erwin 33990053fb Merge pull request #709 from coralproject/docs-plugins-quickstart
Docs plugins quickstart
2017-06-27 10:19:53 -04:00
Kim Gardner 3f4747c2ec Fix typo 2017-06-27 14:11:04 +01:00
Chi Vinh Le db3187cb56 Merge branch 'master' into live-suspension 2017-06-27 20:08:53 +07:00
Chi Vinh Le c90c177b7c Live update on stream when banned user, suspended user or rejected username 2017-06-27 20:06:27 +07:00
Kim Gardner 933891b2e3 Merge branch 'master' into docs-plugins-quickstart 2017-06-27 13:41:16 +01:00
Kim Gardner 43dd72c715 Merge branch 'master' into unify-taglists 2017-06-27 13:40:24 +01:00
Kim Gardner a7f0de6e62 Merge branch 'master' into coral-plugin-permalink 2017-06-27 13:40:15 +01:00
Kim Gardner 53742934f9 Merge pull request #715 from coralproject/commentCount
Comment Count by Asset URL
2017-06-27 13:01:47 +01:00
Belen Curcio b8aed80f1c Merge branch 'coral-plugin-permalink' of github.com:coralproject/talk into coral-plugin-permalink 2017-06-26 17:35:07 -03:00
Belen Curcio 4e94727749 Merge branch 'master' of github.com:coralproject/talk into coral-plugin-permalink 2017-06-26 17:34:53 -03:00
Belén Curcio 8412fa5613 Merge branch 'master' into coral-plugin-permalink 2017-06-26 16:26:46 -03:00
Belen Curcio bee1cc124c renamed to talk 2017-06-26 16:26:05 -03:00
Belen Curcio 2ac6ad8eb8 Using the plugin api 2017-06-26 16:16:40 -03:00
Belen Curcio fa9a4ecc50 Clearing the timeout 2017-06-26 16:08:32 -03:00
Belen Curcio b00d2f569e Removing styles from default.css 2017-06-26 16:01:07 -03:00
Belen Curcio 5e1450ffb0 Renaming to talk 2017-06-26 15:46:53 -03:00
Belen Curcio a14e4859a9 refactor 2017-06-26 14:49:24 -03:00
Belen Curcio 2745245564 updated 2017-06-26 14:39:10 -03:00
Kim Gardner 3bb1279acf Merge branch 'master' into docs-plugins-quickstart 2017-06-26 16:15:59 +01:00
Belen Curcio fedca113d2 Adding plugin 2017-06-26 11:50:51 -03:00
Belen Curcio 59407e99d7 commentCount by asset_url 2017-06-26 09:59:28 -03:00
Kiwi c7c33dcf13 Merge branch 'master' into unify-taglists 2017-06-26 19:08:38 +07:00
Kim Gardner 0e152797ad Merge pull request #710 from ALawliet/fix-highlight-suspect-banned-words-regex
Make highlight suspect/banned words regex case insensitive
2017-06-26 12:48:11 +01:00
Kim Gardner 58d9f294b7 Merge branch 'master' into fix-highlight-suspect-banned-words-regex 2017-06-26 12:25:30 +01:00
Kim Gardner fddbf2c00f Merge pull request #713 from coralproject/validate-confirm-password
Validate `confirmPassword` in the web installer
2017-06-26 12:25:16 +01:00
Chi Vinh Le 10ae39ba09 Merge branch 'master' into unify-taglists 2017-06-26 17:39:06 +07:00
Chi Vinh Le a025f4ca24 Validate confirmPassword in the web installer 2017-06-26 17:35:45 +07:00
Chi Vinh Le eb4d85fb86 Refactor TagsInput and Improve UX 2017-06-26 17:34:15 +07:00
A Lawliet 5e6a295f11 Make highlight suspect/banned words regex case insensitive 2017-06-24 15:50:44 -04:00
David Erwin b864761ef8 Merge branch 'master' into docs-plugins-quickstart 2017-06-23 16:22:19 -04:00
David Erwin 01f6bfa979 Clean up the quickstart 2017-06-23 16:18:29 -04:00
Kim Gardner e2a9a42ec6 Merge pull request #708 from coralproject/bugs-fix
BUG: Wrong label in Admin Configure
2017-06-23 18:37:46 +01:00
Belén Curcio b65c07a8a2 Merge branch 'master' into bugs-fix 2017-06-23 14:32:54 -03:00
David Erwin a49a53903d Finish quickstart first draft 2017-06-23 13:29:35 -04:00
Belen Curcio 5984f57682 Close after, wrong label 2017-06-23 14:29:22 -03:00
Kiwi 1c844061f4 Merge pull request #705 from Goyapa/issue-676-set-domain-whitelist
Issue-676 add addOnBlur preventing loss of domain-whitelist settings
2017-06-24 00:29:19 +07:00
Kiwi bc878051f8 Merge branch 'master' into issue-676-set-domain-whitelist 2017-06-24 00:22:34 +07:00
Kiwi b805451d37 Merge pull request #700 from coralproject/refactor-ban-suspend-actions
Refactor and reuse "Actions" in "Moderate" and "Community"
2017-06-23 22:43:38 +07:00
Chi Vinh Le 4a5424b81d Translation Querido/a 2017-06-23 22:38:30 +07:00
Kiwi 18a767b8a4 Merge branch 'master' into refactor-ban-suspend-actions 2017-06-23 22:24:01 +07:00
Kim Gardner 32b6627144 Merge pull request #696 from coralproject/bugs-fix
Bug Fixes
2017-06-23 16:22:06 +01:00
Kim Gardner e1b3eb9ff7 Merge branch 'master' into issue-676-set-domain-whitelist 2017-06-23 16:19:46 +01:00
Kim Gardner b76578b866 Merge branch 'master' into refactor-ban-suspend-actions 2017-06-23 16:17:26 +01:00
Kim Gardner c09d1524a9 Merge branch 'master' into bugs-fix 2017-06-23 16:17:09 +01:00
Kim Gardner 548b56be33 Merge pull request #707 from coralproject/redirect-to-all
If not specified redirect to 'all' tab
2017-06-23 16:16:57 +01:00
Belen Curcio ea030af440 missing keys 2017-06-23 09:59:05 -03:00
Belen Curcio af59a2e836 Merge branch 'bugs-fix' of github.com:coralproject/talk into bugs-fix 2017-06-23 09:56:43 -03:00
Belen Curcio 2ab2b41b55 unbind 2017-06-23 09:54:21 -03:00
Belén Curcio 4bb64231e9 Merge branch 'master' into issue-676-set-domain-whitelist 2017-06-23 09:50:29 -03:00
Belén Curcio 2800458519 Merge branch 'master' into bugs-fix 2017-06-23 09:49:54 -03:00
Kiwi 90bc9be1b2 Merge branch 'master' into redirect-to-all 2017-06-23 18:29:52 +07:00
Kiwi 64a4bf6760 Merge pull request #703 from ALawliet/fix-moderate-link
Fix Moderate → link by setting to "All" for that story
2017-06-23 18:29:38 +07:00
Kiwi 6d5b8e73d4 Merge branch 'master' into redirect-to-all 2017-06-23 18:18:18 +07:00
Kiwi 87c14dd824 Merge branch 'master' into fix-moderate-link 2017-06-23 18:15:36 +07:00
Chi Vinh Le e89a15f2d2 If not specified redirect to 'all' tab 2017-06-23 18:11:54 +07:00
Kim Gardner 7d84cff0f7 Merge pull request #698 from ALawliet/master
Search dropdown: clear search when closed
2017-06-23 12:10:10 +01:00
Kim Gardner 6fa74f84f1 Merge branch 'master' into fix-moderate-link 2017-06-23 09:53:35 +01:00
Kim Gardner 10ed5c9a4a Merge branch 'master' into master 2017-06-23 09:53:23 +01:00
Michael Macherey 40b4c0cab4 Issue-676 add addOnBlur preventing loss of domain-whitelist settings
Whithout addOnBlur set true, typed domain-whitelist settings like localhost:3000 get lost and will not be set in configure->Tech Settings->Permitted Domains.
This address issue-676.
2017-06-23 00:35:49 +02:00
David Erwin a3059a9fa3 Update docs menu 2017-06-22 17:42:42 -04:00
David Erwin d57d05fda9 Move plugin docs into new docs 2017-06-22 17:33:16 -04:00
David Erwin 57e0a160a2 Add plugins overview and quickstart 2017-06-22 17:25:01 -04:00
Belén Curcio bb544a92b3 Merge pull request #704 from coralproject/keep-alive
Added support for keep alive websocket frames
2017-06-22 17:45:02 -03:00
Wyatt Johnson 010f0cb0d7 Added support for keep alive websocket frames 2017-06-22 14:32:49 -06:00
A Lawliet 60dd6a37d7 Fix Moderate → link by setting to "All" for that story 2017-06-22 13:44:48 -04:00
Chi Vinh Le 455a034802 Don't show dropdown on current logged in user 2017-06-22 22:13:09 +07:00
Chi Vinh Le 46e707ba51 Use snake case for new translations 2017-06-22 22:04:11 +07:00
Kiwi e7e66f1e6f Merge branch 'master' into refactor-ban-suspend-actions 2017-06-22 21:57:30 +07:00
Chi Vinh Le 8bb38c5ee5 Refactor and reuse "Actions" in "Moderate" and "Community" 2017-06-22 21:50:19 +07:00
A Lawliet c41b3c27ba Prevent unnecessary render - no need to clear search if already empty, just close dropdown 2017-06-22 10:29:41 -04:00
Kim Gardner cfd55907bd Merge branch 'master' into bugs-fix 2017-06-22 14:34:04 +01:00
Kim Gardner 91907e7647 Merge branch 'master' into master 2017-06-22 14:28:01 +01:00
Kim Gardner a5048eadb4 Merge pull request #699 from coralproject/update-circle-config
Limit circle deploys off only our master branch
2017-06-22 14:27:42 +01:00
Kim Gardner bde08ea256 Merge branch 'master' into update-circle-config 2017-06-22 14:07:53 +01:00
Kim Gardner 3de6ba1b24 Limit circle deploys off only our master branch 2017-06-22 14:05:50 +01:00
Kim Gardner dac9401c44 Merge branch 'master' into bugs-fix 2017-06-22 12:30:49 +01:00
A Lawliet bba4474858 Search dropdown: clear search when closed 2017-06-22 01:51:06 -04:00
Kiwi 259f98a4ec Merge pull request #697 from coralproject/bug-sweep
Bug sweep
2017-06-22 01:05:11 +07:00
Chi Vinh Le f7a8f9bbd1 Oops this comment needs a rewrite 2017-06-22 00:59:04 +07:00
Kiwi 83096dbcce Merge branch 'master' into bug-sweep 2017-06-22 00:52:30 +07:00
Kiwi 555a71fd9b Merge pull request #695 from coralproject/bug-killing-spree
Bug killing spree
2017-06-22 00:52:00 +07:00
Kiwi 2c57ec3c7c Merge branch 'master' into bug-killing-spree 2017-06-22 00:47:27 +07:00
Chi Vinh Le c0e9e4272b Merge branch 'master' into bug-killing-spree
Conflicts:
	client/coral-admin/src/routes/Moderation/components/UserDetail.js
2017-06-22 00:46:17 +07:00
Belén Curcio a31810ddf4 Merge branch 'master' into bug-sweep 2017-06-21 14:43:32 -03:00
Belén Curcio f6b2a25e72 Merge pull request #687 from coralproject/pat
Tokens
2017-06-21 14:43:05 -03:00
Wyatt Johnson bd7443672a Merge branch 'master' into pat 2017-06-21 11:36:47 -06:00
Belén Curcio 358ea0d37c Merge branch 'master' into bug-sweep 2017-06-21 14:35:50 -03:00
Kiwi c0dcfe5f4e Merge pull request #694 from coralproject/copy
withCopyToClipboard & ButtonCopyToClipboard
2017-06-22 00:35:25 +07:00
Wyatt Johnson 91b7cd10f8 fixing all the 👻 2017-06-21 11:35:00 -06:00
Wyatt Johnson f537b4a772 Merge branch 'master' into pat 2017-06-21 11:34:18 -06:00
Belen Curcio a9cefd8cbd deleting old ref 2017-06-21 14:23:51 -03:00
Belen Curcio f08c2f4152 Merge branch 'copy' of github.com:coralproject/talk into copy 2017-06-21 13:31:53 -03:00
Belen Curcio cdcd543fe0 good looking export 2017-06-21 13:30:09 -03:00
Belen Curcio 66aec74b38 good looking export 2017-06-21 13:29:44 -03:00
Belen Curcio 85dcc8d0ec Merge branch 'master' of github.com:coralproject/talk into copy 2017-06-21 13:28:33 -03:00
Chi Vinh Le 9d572f6c3b Add proptype 2017-06-21 22:27:13 +07:00
Chi Vinh Le 012ff926eb Use router for 'moderate all' link and only show when necessary 2017-06-21 22:21:42 +07:00
Kiwi 91fd8ceabd Merge branch 'master' into copy 2017-06-21 21:52:51 +07:00
Kiwi 4a354f0b9a Merge branch 'master' into bug-sweep 2017-06-21 21:48:35 +07:00
Chi Vinh Le 3beb62f837 Merge branch 'master' into bug-killing-spree
Conflicts:
	client/coral-admin/src/routes/Moderation/components/UserDetail.js
2017-06-21 21:47:01 +07:00
Chi Vinh Le 57ecba6f33 Remove unessecary binds 2017-06-21 21:36:27 +07:00
Kim Gardner 712a53db24 Merge pull request #693 from coralproject/show-version-in-nav
Show Talk version number in nav
2017-06-21 15:35:52 +01:00
Chi Vinh Le f709057933 Require username to be different when editing it 2017-06-21 21:18:28 +07:00
Belen Curcio ac89ddc43f Show user details from flag history 2017-06-21 11:04:45 -03:00
Belen Curcio b0156fa11f missing header css 2017-06-21 10:53:12 -03:00
Belen Curcio 16eb93792b Merge branch 'master' of github.com:coralproject/talk into bugs-fix 2017-06-21 10:43:28 -03:00
Belen Curcio 1b1f2a3608 Changing moderation keys: d approve and f reject 2017-06-21 10:42:01 -03:00
Chi Vinh Le 6628e6d08d Correctly handle login with mixed case email 2017-06-21 20:34:33 +07:00
Kim Gardner e2f94aa141 Merge branch 'master' into show-version-in-nav 2017-06-21 14:29:49 +01:00
Kim Gardner f20b9819aa Merge branch 'master' into copy 2017-06-21 14:29:36 +01:00
Chi Vinh Le 91fa7b2d8d Show correct login error messages in admin 2017-06-21 20:24:54 +07:00
Kim Gardner 74fff2f1ac Add all stories link to story search dropdown 2017-06-21 14:14:33 +01:00
Chi Vinh Le 4b063607ab Return the returns 2017-06-21 20:04:38 +07:00
Chi Vinh Le 9b26bc9d96 Fix Typo 2017-06-21 19:53:00 +07:00
Chi Vinh Le 38eaff5397 Don't render title when it's null 2017-06-21 19:41:22 +07:00
Chi Vinh Le 420513804c Show correct notification message when edit fails 2017-06-21 19:37:19 +07:00
Chi Vinh Le b0079c191b Remove non existant 'truthy' tests 2017-06-21 19:31:55 +07:00
Chi Vinh Le 9815248b8d Prevent errors being swallowed 2017-06-21 19:17:48 +07:00
Kim Gardner 79346738d7 Have Moderate this Stream link also default to All 2017-06-21 13:01:23 +01:00
Kim Gardner e16553419d Merge pull request #686 from coralproject/subscribe-mod-actions
Mod Queue Live Updates
2017-06-21 12:24:32 +01:00
Kim Gardner dccf182591 Merge branch 'master' into copy 2017-06-21 12:23:50 +01:00
Kim Gardner 33057e197f Merge branch 'master' into show-version-in-nav 2017-06-21 12:23:20 +01:00
Kim Gardner 605e759bc6 Merge branch 'master' into pat 2017-06-21 12:22:28 +01:00
Chi Vinh Le 706a12d2e2 No MoreMore 2017-06-21 02:48:59 +07:00
Kiwi adeca927a6 Merge branch 'master' into bug-killing-spree 2017-06-21 01:37:46 +07:00
Chi Vinh Le fc14e9d2fd Prevent double execution of fetchMore 2017-06-21 01:29:10 +07:00
Chi Vinh Le 49420e152e Click outside closes TopRightMenu, detect click outside iframe 2017-06-21 01:29:10 +07:00
Chi Vinh Le 644c291d7f Don't cut off long comment 2017-06-21 01:29:07 +07:00
Kiwi 40d7500a75 Merge branch 'master' into subscribe-mod-actions 2017-06-20 21:12:09 +07:00
Kim Gardner 3d27c4538a Merge pull request #691 from coralproject/bump-version-2-1-0
Bump version 2.1.0
2017-06-20 14:51:36 +01:00
Belen Curcio 942ea7b916 ButtonCopyToClipboard 2017-06-20 10:37:10 -03:00
Chi Vinh Le 4d53a72767 Always default to all queue 2017-06-20 20:00:00 +07:00
Chi Vinh Le 23fcba4ccc Don't show caret when logged out 2017-06-20 19:55:53 +07:00
Belén Curcio bee4b4454c Merge branch 'master' into show-version-in-nav 2017-06-20 09:52:50 -03:00
Belén Curcio 679c6ce335 Merge branch 'master' into bump-version-2-1-0 2017-06-20 09:52:26 -03:00
Belén Curcio 71d2d0ab10 Merge pull request #692 from coralproject/update-readme
Update README
2017-06-20 09:52:14 -03:00
Belen Curcio d97fb0a83f Refs by ReactDOMNode 2017-06-20 09:47:37 -03:00
Chi Vinh Le 14311dc298 Merge branch 'master' into subscribe-mod-actions
Conflicts:
	client/coral-admin/src/routes/Moderation/components/Comment.js
2017-06-20 19:34:56 +07:00
Belen Curcio 7faa00c463 withCopyToClipboard 2017-06-20 09:05:01 -03:00
Belen Curcio d23d426567 Adding the translations 2017-06-20 08:37:53 -03:00
Belen Curcio fe8f3ae4bb Moving Copy component 2017-06-20 08:32:08 -03:00
Kim Gardner 646b5be8c8 Show version in nav 2017-06-20 10:48:01 +01:00
Kim Gardner ea12c07cd4 Update README 2017-06-20 10:29:39 +01:00
Kim Gardner bb4cd91b0c Merge branch 'master' into pat 2017-06-20 10:12:47 +01:00
Kim Gardner dca759a5e0 Bump version 2.1.0 2017-06-20 10:02:10 +01:00
Kim Gardner 018b35e42a Merge pull request #688 from coralproject/fixes
Bug-Fixes
2017-06-20 09:59:00 +01:00
Kim Gardner 672e36c66c Merge branch 'master' into fixes 2017-06-20 09:54:38 +01:00
Kim Gardner b3db231f09 Merge pull request #689 from coralproject/keyboard-shortcuts
Keyboard shortcuts
2017-06-20 09:53:49 +01:00
Kim Gardner 38a53d61f3 Merge branch 'master' into fixes 2017-06-20 09:53:24 +01:00
Kim Gardner fc15bcae4e Merge branch 'master' into keyboard-shortcuts 2017-06-20 09:46:04 +01:00
Kim Gardner 6959699ecc Merge pull request #690 from coralproject/admin-links
Settings Cog Links
2017-06-20 09:45:44 +01:00
Belen Curcio 99bb4b7198 New Links 2017-06-19 18:09:38 -03:00
Belen Curcio 12a5654fb8 Keyboard shorcuts working 2017-06-19 17:48:20 -03:00
Belen Curcio dad6534011 Fix close modal 2017-06-19 17:26:57 -03:00
Belen Curcio c36a0bc9e9 d approve and f reject 2017-06-19 17:23:57 -03:00
Belen Curcio 30a385e03b Linting 2017-06-19 17:09:49 -03:00
Wyatt Johnson 174088fc62 Merge branch 'master' into pat 2017-06-19 13:51:35 -06:00
Belen Curcio 16ef833fd8 Ádding Copy component, and UserDetail fic 2017-06-19 16:17:50 -03:00
Chi Vinh Le 523f23269b Translate, pep up notifications 2017-06-20 01:38:38 +07:00
Kiwi 8dbc17c8d9 Merge branch 'master' into subscribe-mod-actions 2017-06-20 01:12:54 +07:00
Chi Vinh Le b8967dcdb4 More accurate loading detection 2017-06-20 01:09:37 +07:00
Chi Vinh Le 70276c3358 Fix subscription issues 2017-06-20 01:01:39 +07:00
Belen Curcio 1f2eca300a Report vbox 2017-06-19 14:55:58 -03:00
Belen Curcio 3c99b8e7fb Sign In Button Position 2017-06-19 14:35:26 -03:00
Belen Curcio 073fccebd3 Show likes 2017-06-19 14:30:56 -03:00
Belén Curcio 13e311de7f Merge pull request #684 from coralproject/action-focus-states
Action focus states
2017-06-19 14:09:22 -03:00
Kim Gardner ba81399707 Merge branch 'master' into pat 2017-06-19 18:03:23 +01:00
Belen Curcio cf93727f73 Merge branch 'master' of github.com:coralproject/talk into action-focus-states 2017-06-19 14:03:07 -03:00
Chi Vinh Le fbbd0fa027 Merge branch 'master' into subscribe-mod-actions
Conflicts:
	client/coral-admin/src/routes/Moderation/components/Moderation.js
	client/coral-admin/src/routes/Moderation/components/styles.css
	client/coral-admin/src/routes/Moderation/containers/Moderation.js
2017-06-19 23:52:10 +07:00
Kim Gardner 332679a7bc Merge pull request #680 from coralproject/search-stories
Search stories
2017-06-19 17:44:16 +01:00
Wyatt Johnson 2a2ca86263 Merge branch 'master' into pat 2017-06-19 09:40:25 -06:00
Wyatt Johnson 393ad8530a added tests, fixed some services 2017-06-19 08:55:08 -06:00
Chi Vinh Le 0cd3921f44 Simplification 2017-06-19 21:29:33 +07:00
Chi Vinh Le f954d2be90 Better loading detection 2017-06-19 21:23:30 +07:00
Chi Vinh Le 2a28306ab2 Merge branch 'master' into subscribe-mod-actions 2017-06-19 21:17:33 +07:00
Chi Vinh Le e1bc1476ea Remove the need for querying all assets 2017-06-19 21:08:12 +07:00
Chi Vinh Le 853c1e407e Simplify args 2017-06-19 21:08:12 +07:00
Belen Curcio 77fddba841 removing overflow hidden 2017-06-19 11:05:16 -03:00
David Erwin 17d36c69d0 Merge branch 'master' into action-focus-states 2017-06-19 09:23:40 -04:00
Belén Curcio 1cf6161b06 Merge branch 'master' into search-stories 2017-06-18 20:14:35 -03:00
Andrew Losowsky 9ef7544788 Merge pull request #685 from coralproject/bump-version-2-0-1
Update version number
2017-06-16 17:41:51 -04:00
Kim Gardner dfccf962d4 Update version number 2017-06-16 17:30:09 -04:00
IAmSamHankins 6c5d94ec3b adjustments to letter spacing, and container positioning. 2017-06-16 16:40:17 -04:00
IAmSamHankins e7eb300e12 search input box styling 2017-06-16 15:47:45 -04:00
IAmSamHankins 614f31d0da styling of search results bar 2017-06-16 15:39:24 -04:00
Belen Curcio 61591a9716 Removing extra log 2017-06-16 16:24:00 -03:00
Belen Curcio 367c570747 ModQueue query 2017-06-16 16:21:39 -03:00
Belen Curcio 991bdc6089 Updated BE 2017-06-16 16:18:02 -03:00
Samantha Hankins 4ce38d429e Merge branch 'master' into action-focus-states 2017-06-16 15:06:11 -04:00
IAmSamHankins dcee2a4438 adjust comment stream sizing to allow for chrome focus state 2017-06-16 15:00:42 -04:00
Belen Curcio 4403decbe9 Handling dropdown on Esc <3 2017-06-16 15:50:58 -03:00
Belen Curcio e30d5a9c62 Sizing 2017-06-16 15:41:32 -03:00
Belen Curcio fe94a5a6d1 Limit 10 2017-06-16 15:08:10 -03:00
Belen Curcio c7b58957cb Merge branch 'search-stories' of github.com:coralproject/talk into search-stories 2017-06-16 15:07:47 -03:00
Belen Curcio 89cf13b4cf Updates 2017-06-16 15:05:22 -03:00
Belén Curcio f0b6679141 Merge branch 'master' into search-stories 2017-06-16 14:50:05 -03:00
Kiwi 26253255ce Merge pull request #658 from alleyinteractive/TCP-7
Pass onAuthChange callback into embed
2017-06-17 00:33:44 +07:00
Max Eddy 64174b97af Cleanup 2017-06-16 13:04:27 -04:00
Max Eddy fe0c581ea9 Note logout action as well for onAuthChanged event. 2017-06-16 13:04:27 -04:00
Max Eddy 4982d8a9ad Use REST API result for check login message. 2017-06-16 13:04:27 -04:00
Max Eddy fd9b14a560 cb option for auth change event 2017-06-16 13:04:27 -04:00
Max Eddy 6139828844 Send post message with auth state to parent window. 2017-06-16 13:04:27 -04:00
Chi Vinh Le c14c3fbe23 Streamline perm names 2017-06-17 00:03:33 +07:00
Kim Gardner f34d546a37 Merge branch 'master' into search-stories 2017-06-16 12:58:12 -04:00
Chi Vinh Le 6da0028258 Reset websocket after login change 2017-06-16 23:00:40 +07:00
Chi Vinh Le 74fbadcc0f Refactor subscriptions 2017-06-16 22:55:22 +07:00
Kim Gardner 30ca7b3d64 Merge pull request #683 from coralproject/cli-fix
User CLI Fix
2017-06-16 09:49:53 -04:00
Chi Vinh Le 9573c9a7af Refactor & docs 2017-06-16 20:49:17 +07:00
Wyatt Johnson 1dec8bfaab small fix 2017-06-16 09:45:26 -04:00
Chi Vinh Le 2625b372e1 Handle comment flags 2017-06-16 20:06:13 +07:00
Chi Vinh Le 5f450adbaf Simplify subscription 2017-06-16 19:19:59 +07:00
Belen Curcio d386316f8a Styles, copy, funtionality, state changes and clicks. Ready to be tested. 2017-06-16 08:19:22 -03:00
Belen Curcio 5604aa8525 Overlay and Container 2017-06-16 07:33:22 -03:00
Belen Curcio b518358ea8 Lintin 2017-06-15 22:51:15 -03:00
Belen Curcio fe74f4a8d2 Search on enter, removed unused links 2017-06-15 20:24:22 -03:00
Wyatt Johnson b78d4f29ea Added PAT support 2017-06-15 18:12:53 -04:00
Belen Curcio ca08efea8a Adding proptypes as a package, and linting 2017-06-15 18:49:05 -03:00
Belen Curcio 5718ba6748 Merge branch 'search-stories' of github.com:coralproject/talk into search-stories 2017-06-15 17:42:43 -03:00
Belen Curcio 0123736275 Deleting unnecesary connects 2017-06-15 17:42:22 -03:00
Belen Curcio 18061e3e1c new func and style 2017-06-15 17:32:14 -03:00
Kim Gardner b40df9f10c Merge branch 'master' into search-stories 2017-06-15 15:18:57 -04:00
Andrew Losowsky 0c7f9cdb1e Merge pull request #682 from coralproject/fix-config-stream-typos
Fix typos
2017-06-15 14:50:57 -04:00
Chi Vinh Le ecf63ffb55 More accurate edit notification 2017-06-16 01:49:35 +07:00
Kim Gardner ba659b47be Fix typos 2017-06-15 14:44:06 -04:00
Chi Vinh Le f73f8d916e Only show notification once 2017-06-16 00:50:44 +07:00
Chi Vinh Le 93c8b115f5 Fix some queries 2017-06-16 00:43:48 +07:00
Belen Curcio 685695bf43 Clear search value 2017-06-15 14:32:50 -03:00
Belen Curcio d7c6d7dfac Merge branch 'search-stories' of github.com:coralproject/talk into search-stories 2017-06-15 14:32:27 -03:00
Belén Curcio c7cfd80c7f Merge branch 'master' into search-stories 2017-06-15 14:15:34 -03:00
Belen Curcio 928e19ed67 Merge branch 'master' of github.com:coralproject/talk into search-stories 2017-06-15 14:14:13 -03:00
Chi Vinh Le 5a2ce0f6a7 No div in p 2017-06-15 23:31:30 +07:00
Chi Vinh Le 312103098c More mod queue fixes 2017-06-15 23:27:31 +07:00
Chi Vinh Le 21f95c33c2 Use correct comment id in UserDetail 2017-06-15 22:54:36 +07:00
Chi Vinh Le cbcb84f7ac No need for editableUntil 2017-06-15 22:54:29 +07:00
Chi Vinh Le 303b3ea0f5 Support live comment edit update 2017-06-15 22:46:38 +07:00
Kim Gardner 0bfd4f8797 Merge pull request #681 from coralproject/fix-viewing-options
Use new import path for coral-ui
2017-06-15 07:46:16 -04:00
Chi Vinh Le a088827568 Use new import path for coral-ui 2017-06-15 18:31:53 +07:00
Chi Vinh Le 5ecdfe94cc Refactor state updater 2017-06-15 18:28:08 +07:00
Belén Curcio 648b46e5af Merge branch 'master' into search-stories 2017-06-14 18:44:36 -03:00
Belen Curcio e160dfaa3e Style and functionality 2017-06-14 18:40:44 -03:00
Chi Vinh Le 3658a804b0 Implement live updates for mod actions 2017-06-15 01:08:25 +07:00
Belen Curcio c902a4b05b Merge branch 'search-stories' of github.com:coralproject/talk into search-stories 2017-06-12 16:31:14 -03:00
Belen Curcio 8a3833ec11 Merge issues 2017-06-12 16:30:59 -03:00
Belén Curcio d45c396013 Merge branch 'master' into search-stories 2017-06-12 16:27:39 -03:00
gaba d22f5215ed Adding french translation to the auth plugin. 2017-06-09 16:09:13 -07:00
riley c7d5ab935f merge master 2017-06-09 15:27:44 -06:00
Riley Davis aa289ecbfe less terrible looking 2017-06-09 14:32:12 -06:00
Riley Davis de665b3a0d show stories in dropdown 2017-06-09 14:10:21 -06:00
gaba 19b6dfaa0a Adding a new language is not so straight forward. It needs to change at some point. 2017-06-08 11:39:51 -07:00
gaba b009d7a67a Adding french translations. 2017-06-08 10:47:17 -07:00
Riley Davis 06da4d7d26 toggle story search 2017-06-07 16:36:27 -06:00
Riley Davis 9818b851db clean up the ModerationHeader component 2017-06-07 15:40:36 -06:00
277 changed files with 7558 additions and 3200 deletions
+2
View File
@@ -12,4 +12,6 @@ plugins/*
!plugins/coral-plugin-love
!plugins/coral-plugin-viewing-options
!plugins/coral-plugin-comment-content
!plugins/talk-plugin-permalink
!plugins/talk-plugin-featured
node_modules
+2 -1
View File
@@ -53,7 +53,8 @@
"no-lonely-if": [2],
"curly": [2],
"no-unused-vars": ["error", {
"argsIgnorePattern": "next"
"argsIgnorePattern": "^_|next",
"varsIgnorePattern": "^_"
}],
"no-multiple-empty-lines": ["error", {
"max": 1
+2
View File
@@ -25,5 +25,7 @@ plugins/*
!plugins/coral-plugin-love
!plugins/coral-plugin-viewing-options
!plugins/coral-plugin-comment-content
!plugins/talk-plugin-permalink
!plugins/talk-plugin-featured
**/node_modules/*
+51 -42
View File
@@ -6,16 +6,46 @@ This document is a companion to help you approach contributing. If it does not d
By contributing to this project you agree to the [Code of Conduct](https://coralproject.net/code-of-conduct.html).
## Product Roadmap
## What should I Contribute?
You can view what the Coral Team is working on next here https://www.pivotaltracker.com/n/projects/1863625.
There are at least three ways to contribute to Talk:
If you'd like to see our longer term roadmap, [get in touch.](https://coralproject.net/contact.html)
* Writing Code
* Writing Docs
* Providing Translations
## Writing Code
## Contribute to the documentation
Conversation surrounding contributions begins in [issues](https://github.com/coralproject/talk/issues).
Clear docs are a prerequisite for a successful open source project. We value non-code and code contributions equally.
### When should I Create an Issue?
File an issue as soon as you have an idea of something you'd like to contribute. We would love to hear what you're thinking and help refine the idea to make it into the Talk ecosystem.
Please file issues if:
* you would like to contribute to Talk Core.
* you are building a Plugin that the current Plugin API doesn't support.
* you are building a Plugin and want advice.
### What should I include?
Coral has adopted an iterative, agile development philosophy. All contributions that make it into the Talk repo should start with a story or this form:
`As a [type of person] I'd like to be able to [do something] so that I can [get some result].`
This exercise does two things:
* allows us to ground our technical choices in a clear, simple product need.
* expresses that product need in a way that doesn't imply a specific technical solution allowing for debate as to the best way to solve the problem.
Please feel free to provide as much detail as possible when filing the issue but please do keep the initial issue specific to one need and try to avoid including technical or design solutions.
If you have a specific technical or design solution in mind, please submit it as the first comment on the thread.
## Contributing Documentation
Clear docs are a prerequisite for a successful open source project. Contributing to the documentation is often more important than contributing to the code!
We are looking for _documentarians_ to:
@@ -23,55 +53,34 @@ We are looking for _documentarians_ to:
* create new / missing sections, and
* take the lead in making sections, or the over all structure better.
### But how?
Information about how to update docs can be found in our [FAQ](faq.html#how-do-i-contribute-to-these-docs).
* Our public docs site can be updated [here](https://github.com/coralproject/docs).
* [Let us know](https://github.com/coralproject/talk/wiki/Contact-Us) if you'd like permission to update our wiki.
* Update any of our .md docs files by following [this guide](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging).
* Our API docs need to be kept honest. [Update them here](https://github.com/coralproject/talk/blob/master/docs/swagger.yaml).
If you'd like to discuss a contribution, please [file an issue](https://github.com/coralproject/talk/issues) describing the changes you would like to see.
## Integrate into your environment
## Contributing Translations
First, [set up a dev environment](https://github.com/coralproject/talk/blob/master/INSTALL.md). Please let us know how this goes!
Talk's tranlations are stored in `.yml` files [here](https://github.com/coralproject/talk/tree/master/locales).
Talk is designed to integrate into existing environments in a variety of ways:
Translations can be submitted via pull request. If you do not use github, you can use 'en.yml' as a template and [email](https://coralproject.net/contact.html) the translations to us. We can import it into the repo.
* [Auth integrations](https://github.com/coralproject/talk/wiki/Security#authentication-strategies)
* [Push assets into Talk](https://github.com/coralproject/talk/blob/master/routes/api/assets/index.js)
* Monitoring Hooks (coming in 2017)
## I want to contribute but I'm not sure what to do!
If you're considering deploying Talk, [please let us know](https://github.com/coralproject/talk/wiki/Contact-Us)! We are quite literally doing this for you and want to help you succeed any way we can.
If you want to contribute but don't have a clear idea of exactly what that may be, here are some resources that may help:
If you are writing custom integration code in your fork of Talk, please consider keeping it generic and filing a Pull Request to contribute it back to the project! See our [forking and merging guidelines](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging) for more info.
### Product Roadmap
## Write some code
Please visit our product roadmap here: https://www.pivotaltracker.com/n/projects/1863625. If you'd like to take on any of our scheduled tasks we'd be forever grateful!
First, [set up a dev environment](https://github.com/coralproject/talk/blob/master/INSTALL.md). Please let us know how this goes!
### Discussion Forum
### Build a New Feature / Plugin
If you'd like to discuss what we're up to, please visit or [community](https://community.coralproject.net/) or [contact us](https://coralproject.net/contact.html).
Talk is beginning life as a Commenting Platform, but is architected to support many varieties of community engagement.
### Integrations
Please [contact us](https://github.com/coralproject/talk/wiki/Contact-Us) early and often if you'd like to help. We would love to hear your ideas for features and plugins and help you find a way to productively engage the project.
Have a favorite analytics engine? Data science service? CMS? Auth platform? Deployment platform or pipeline? Pet project? Consider building a plugin to integrate them!
To get an idea of where the Coral Team is going, see:
### Favorite Features?
* our [Slack channel](https://coralprojectslackin.herokuapp.com/), where you can talk directly with the Team and other community members,
* our [current stories](https://www.pivotaltracker.com/n/projects/1863625), and
* our [issues](https://github.com/coralproject/talk/issues).
Do you have a favorite feature of an existing platform that's not yet been done in Talk? Sounds like Talk needs that feature.
Examples:
* [Add An Emoji Button to Comments](https://github.com/coralproject/talk/wiki/Add-An-Emoji-Button-to-Comments)
### Work on the Core
There is always more work to be done to make an application more stable, scaleable and secure.
If you see issues in the code or have ideas on how we may improve Talk, please consider:
* [contributing a fix](https://github.com/coralproject/talk/wiki/Forking,-Branching-and-Merging),
* [filing an issue](https://github.com/coralproject/talk/issues), or
* or otherwise [letting us know](https://github.com/coralproject/talk/wiki/Contact-Us).
## Thanks!
+1 -1
View File
@@ -1,4 +1,4 @@
FROM node:7.8
FROM node:7.10.1
# Create app directory
RUN mkdir -p /usr/src/app
+1 -525
View File
@@ -1,527 +1,3 @@
# Talk Plugins
Plugins for Talk can take various forms, currently we are only supporting server
side plugins.
## Plugin Registration
The parsing order for the plugin registration is as follows:
- `TALK_PLUGINS_JSON` environment variable
- `plugins.json` file
- `plugins.default.json` file
If you need to "disable all plugins", you can simply provide `{}` as the
contents of `process.env.TALK_PLUGINS_JSON` or the `plugins.json`.
The format for this is thus:
```json
{
"server": [
"people"
]
}
```
Where we have a `server` key with an array of plugins that match the folder
name in the `plugins/` folder. For example, the above config would
require a plugin from `plugins/people`, which must provide a `index.js` file
that returns an object that matches the Plugin Specification.
If the package is external (available on NPM) you can specify the string for
the version by using an object instead, for example:
```json
{
"server": [
{"people": "^1.2.0"}
]
}
```
External plugins can be resolved by running:
```bash
./bin/cli plugins reconcile
```
This achieves two things:
1. It will traverse into local plugin folders and install their dependencies.
_Note that if the plugin is already installed and available in the node_modules folder, it will not be
fetched again unless there is a version mismatch._ This will result in the
project `package.json` and `yarn.lock` files to be modified, this is normal as
this ensures that repeated deployments (with the same config) will have the
same config, these changes should not be committed to source control.
2. It will seek out dependencies that are listed in the object notation and try
to install them from npm.
## Plugin Dependencies
You may also include additional external dependencies in your local packages by
specifying a `package.json` at your plugin root which will result in a
`node_modules` folder being generated at the plugin root with your specific
dependencies.
## Deployment Solutions
Plugins can be deployed with a production instance of Talk.
### Source
Source deployments can just modify the `plugins.json` file and include any
local plugins into the `plugins/` directory. After including the config, you
need to reconcile the plugins and build the static assets:
```bash
# get plugin dependancies and remote plugins
./bin/cli plugins reconcile
# build staic assets (including enabled client side plugins)
yarn build
```
Then the application can be started as is.
### Docker
If you deploy using Docker, you can extend from the `*-onbuild` image, an
example `Dockerfile` for your project could be:
```Dockerfile
FROM coralproject/talk:latest-onbuild
```
Where the directory for your instance would contain a `plugins.json` file
describing the plugin requirements and a `plugins` directory containing any
other local plugins that should be included.
Onbuild triggers will execute when the image is building with your custom
configuration and will ensure that the image is ready to use by building all
assets inside the image as well.
## Server Plugins
### API
You can access any API available inside the talk directory in a plugin by simply
importing the file relative to the talk project root. An example would be if you
wanted to import the `MetadataService`, you would simply write:
```javascript
const MetadataService = require('services/metadata');
```
### Specification
Each plugin should export a single object with all hooks available on it.
_**Note: You will have access to the whole core and other plugin's typeDefs,
context, loaders, mutators, resolvers, hooks. This is intentional, as it
encourages composing plugins to merge functionality, like a Slack plugin which
provides a Slack notify context function as well as having the loader for
comments.**_
The following are the hooks available:
#### Field: `typeDefs`
```graphql
enum COLOUR {
RED
BLUE
}
type Person {
name: String!
colour: COLOUR!
}
type RootMutation {
createPerson(name: String!): Person
}
type RootQuery {
people: [Person!]
}
type Subscription {
leader: Person
}
```
Thanks to [gql-merge](https://www.npmjs.com/package/gql-merge) the contents of
`typeDefs` should be a string that will be _merged_ with the existing type
definitions. `enum`'s will be appended to, types will be appended, and new types
will be added.
#### Field: `context`
```js
{
Slack: (context) => ({
notify: (message) => {
// return a promise after we're done sending notifications.
}
})
}
```
Any property provided here will be added to the context parameter available
inside all resolvers, loaders, mutators, and of course, other context based
plugins.
The top level item must accept a context for the request which it should use to
configure the context plugin before it would be mounted at `context.plugins`.
This plugin above would mount at: `context.plugins.Slack`, or, if you're using
[object destructuring](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment), `{plugins: {Slack}}`.
#### Field: `loaders`
```js
(context) => ({
People: {
load: () => db.people.find({user: context.user})
}
})
```
Loaders should be provided as a function which returns a map which is used in
the resolvers function. These must return a promise or a value.
#### Field: `mutators`
```js
(context) => ({
People: {
create: (name) => {
return db.people.insert({user: context.user, name});
}
}
})
```
Mutators should be provided as a function which returns a map which is used in
the resolvers function. These must return a promise or a value.
#### Field: `resolvers`
```js
{
Person: {
name(obj, args, context) {
return obj.name;
},
colour(obj, args, context) {
// Bill likes the colour red, everyone else likes blue.
return obj.name === 'bill' ? 'RED' : 'BLUE';
}
},
RootQuery: {
people(obj, args, {loaders: {People}}) {
return People.load();
}
},
RootMutation: {
createPerson(obj, {name}, {mutators: {People}}) {
return People.create(name);
}
}
}
```
Should return a resolver map as described in the
[Apollo Docs](http://dev.apollodata.com/tools/graphql-tools/resolvers.html#Resolver-map).
This will merge with the existing resolvers in core and from previous plugins.
#### Field: `hooks`
```js
{
RootMutation: {
createPerson: {
post: async (obj, args, {plugins: {Slack}}, info, person) {
if (!person) {
return person;
}
await Slack.notify(`A new person just was created with name ${person.name}`);
return person;
}
}
}
}
```
Hooks here are pretty special, for each resolver field, you can specify a
pre/post hook that will execute pre and post field resolution.
If your post function accepts four parameters, then it can modify the field
result. It is *required* that the function resolves a promise (or returns) with
the modified value or simply the original if you didn't modify it.
#### Field: `setupFunctions`
```js
setupFunctions: {
leader: (options, args) => ({
leader: {
filter: (person) => person.place === 1
},
}),
}
```
Setup functions allow you to create filters that control which pubsub.publish() events
send data to the client. If the type in question contains args, clients may subscribe using those arguments to further filter their subscription.
For more information, see the [Apollo Docs](https://github.com/apollographql/graphql-subscriptions).
#### Field: `tokenUserNotFound`
```js
tokenUserNotFound: async ({jwt, token}) => {
let profile = await someExternalService(token);
if (!profile) {
return null;
}
let user = await UserModel.findOneAndUpdate({
id: profile.id
}, {
id: profile.id,
username: profile.username,
lowercaseUsername: profile.username.toLowerCase(),
roles: [],
profiles: []
}, {
setDefaultsOnInsert: true,
new: true,
upsert: true
});
return user;
}
```
The `tokenUserNotFound` hook allows auth integrations to hook into the event
when a valid token is provided but a user can't be found in the database that
matches the provided id.
The function is async, and should return the user object that was created in the
database, or null if the user wasn't found. The `jwt` paramenter of the object
is the unpacked token, while `token` is the original jwt token string.
#### Field: `router`
```js
(router) => {
router.get('/api/v1/people', (req, res) => {
res.json({people: [{name: 'Bob'}]});
});
}
```
The Router hook allows you to create a function that accepts the base express
router where you can mount any amount of middleware/routes to do any form of
action needed by external applications. We also provide the authorization
middleware via:
```js
const authorization = require('middleware/authorization');
module.exports = {
router(router) {
router.get('/api/v1/people', authorization.needed('ADMIN'), (req, res) => {
res.json({people: [{name: 'SECRET PEOPLE'}]});
});
}
}
```
#### Field: `tags`
The tags hook allows a plugin to define tags that are code controlled (added
or enabled by code). Below is an example pulled from the core off topic plugin
on how to create a hook for the `OFF_TOPIC` name:
```js
[
{
name: 'OFF_TOPIC',
permissions: {
public: true,
self: true,
roles: []
},
models: ['COMMENTS'],
created_at: new Date()
}
]
```
You can refer to `models/schema/tag.js` for the available schema to match when
creating models to enable/disable specific features.
#### Field: `passport`
```js
const FacebookStrategy = require('passport-facebook').Strategy;
const UsersService = require('services/users');
const {ValidateUserLogin, HandleAuthPopupCallback} = require('services/passport');
module.exports = {
passport(passport) {
passport.use(new FacebookStrategy({
clientID: process.env.TALK_FACEBOOK_APP_ID,
clientSecret: process.env.TALK_FACEBOOK_APP_SECRET,
callbackURL: `${process.env.TALK_ROOT_URL}/api/v1/auth/facebook/callback`,
passReqToCallback: true,
profileFields: ['id', 'displayName', 'picture.type(large)']
}, async (req, accessToken, refreshToken, profile, done) => {
let user;
try {
user = await UsersService.findOrCreateExternalUser(profile);
} catch (err) {
return done(err);
}
return ValidateUserLogin(profile, user, done);
}));
},
router(router) {
// Note that we have to import the passport instance here, it is
// instantiated after all the strategies have been mounted.
const {passport} = require('services/passport');
/**
* Facebook auth endpoint, this will redirect the user immediatly to facebook
* for authorization.
*/
router.get('/facebook', passport.authenticate('facebook', {display: 'popup', authType: 'rerequest', scope: ['public_profile']}));
/**
* Facebook callback endpoint, this will send the user a html page designed to
* send back the user credentials upon sucesfull login.
*/
router.get('/facebook/callback', (req, res, next) => {
// Perform the facebook login flow and pass the data back through the opener.
passport.authenticate('facebook', HandleAuthPopupCallback(req, res, next))(req, res, next);
});
}
};
```
This is a full example including the routes hook to add the required components
to the application router to support a different auth strategy.
### Full Example
Contents of `plugins.json`:
```json
{
"server": [
"people"
]
}
```
Located in `plugins/people/index.js`:
```js
module.exports = {
typeDefs: `
enum COLOUR {
RED
BLUE
}
type Person {
name: String!
colour: COLOUR!
}
type RootMutation {
createPerson(name: String!): Person
}
type RootQuery {
people: [Person!]
}
type Subscription {
leader: Person
}
`,
context: {
Slack: () => ({
notify: (message) => {
// return a promise after we're done sending notifications.
}
})
},
loaders: ({user}) => ({
People: {
load: () => db.people.find({user})
}
}),
mutators: ({user}) => ({
People: {
create: (name) => {
return db.people.insert({user, name});
}
}
}),
resolvers: {
Person: {
name(obj, args, context) {
return obj.name;
},
colour(obj, args, context) {
// Bill likes the colour red, everyone else likes blue.
return obj.name === 'bill' ? 'RED' : 'BLUE';
}
},
RootQuery: {
people(obj, args, {loaders: {People}}) {
return People.load();
}
},
RootMutation: {
createPerson(obj, {name}, {mutators: {People}}) {
return People.create(name);
}
}
},
hooks: {
RootMutation: {
createPerson: {
post: async (obj, args, {plugins: {Slack}}, info, person) => {
if (!person) {
return person;
}
await Slack.notify(`A new person just was created with name ${person.name}`);
return person;
}
}
}
},
setupFunctions: {
leader: (options, args) => ({
leader: {
filter: (person) => person.place === 1
}
}
}
};
```
Our documentation for Talk has moved! Utilize [this hyperlink](https://coralproject.github.io/talk/plugins.html) via click or tap to navigate your browser to the new location!
+16 -1
View File
@@ -7,7 +7,21 @@ endpoint when the server is running with built assets.
## Contributing to Talk
See our [Contribution Guide](https://github.com/coralproject/talk/blob/master/CONTRIBUTING.md)!
See our [Contribution Guide](https://github.com/coralproject/talk/blob/master/CONTRIBUTING.md).
## Documentation
### General
See our [Talk Documentation & Guides](https://coralproject.github.io/talk/index.html).
### Plugins
See our guide to using and building [Talk Plugins](https://github.com/coralproject/talk/blob/master/PLUGINS.md).
### Recipes
Recipes are plugin templates provided by the Coral Core team. Developers can use these recipes to build their own plugins. You can find all the Talk recipes here: https://github.com/coralproject/talk-recipes/
## Usage
@@ -40,6 +54,7 @@ sign and verify tokens via a `HS256` algorithm.
- `TALK_RECAPTCHA_SECRET` (*required for reCAPTCHA support*) - server secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
- `TALK_RECAPTCHA_PUBLIC` (*required for reCAPTCHA support*) - client secret used for enabling reCAPTCHA powered logins. If not provided it will instead default to providing only a time based lockout.
- `TALK_PLUGINS_JSON` (_optional_) - used to specify the plugin config via the environment
- `TALK_KEEP_ALIVE` (_optional_) - The keepalive timeout that should be used to send keep alive messages through the websocket to keep the socket alive. (Default `30s`)
Refer to the wiki page on [Configuration Loading](https://github.com/coralproject/talk/wiki/Configuration-Loading) for
alternative methods of loading configuration during development.
+10 -2
View File
@@ -9,12 +9,17 @@ const program = require('./commander');
program
.command('serve', 'serve the application')
.command('settings', 'interact with the application settings')
.command('assets', 'interact with assets')
.command('setup', 'setup the application')
.command('jobs', 'work with the job queues')
.command('token', 'work with the access tokens')
.command('users', 'work with the application auth')
.command('migration', 'provides utilities for migrating the database')
.command('plugins', 'provides utilities for interacting with the plugin system')
.command(
'plugins',
'provides utilities for interacting with the plugin system'
)
.parse(process.argv);
/**
@@ -24,7 +29,10 @@ program
* labled with the PID written out by the parent process.
*/
process.once('exit', () => {
if ((program.runningCommand.killed === false) && (program.runningCommand.exitCode === null)) {
if (
program.runningCommand.killed === false &&
program.runningCommand.exitCode === null
) {
program.runningCommand.kill('SIGINT');
}
});
+120 -1
View File
@@ -8,13 +8,14 @@
// https://yarnpkg.com/
const program = require('./commander');
const inquirer = require('inquirer');
// Make things colorful!
require('colors');
const emoji = require('node-emoji');
const dir = process.cwd();
const fs = require('fs');
const fs = require('fs-extra');
const path = require('path');
const spawn = require('cross-spawn');
const semver = require('semver');
@@ -272,10 +273,128 @@ async function reconcilePluginDeps({skipLocal, skipRemote, dryRun, upgradeRemote
console.log(`✨ Done in ${totalTime}s.`);
}
async function createSeedPlugin() {
const pluginsDir = path.join(__dirname, 'plugins');
function pluginNameExists(pluginName) {
const pluginNames = fs.readdirSync(pluginsDir);
return !!pluginNames
.filter((pn) => pn === pluginName).length;
}
let answers = await inquirer.prompt([
{
type: 'input',
name: 'pluginName',
message: 'Plugin Name:',
validate: (input) => {
if (pluginNameExists(input)) {
return 'Please, choose another name. That name already exists';
}
if (input && input.length > 0) {
return true;
}
return 'Plugin Name is required.';
}
},
{
type: 'confirm',
name: 'server',
message: 'Is this plugin extending the server capabilities?'
},
{
type: 'confirm',
name: 'client',
message: 'Is this plugin extending the client capabilities?'
},
{
type: 'confirm',
name: 'addPluginsJson',
message: 'Should we add it to the plugins.json?'
}
]);
//==============================================================================
// Creating plugin seed
//==============================================================================
const seedPlugin = path.join(__dirname, 'bin/templates/plugin');
const newPluginPath = path.join(pluginsDir, answers.pluginName);
if (fs.existsSync(seedPlugin)) {
if (answers.server && answers.client) {
// This is a server-side and client-side plugin!, let's copy the template
fs.copySync(seedPlugin, newPluginPath);
} else {
fs.copySync(seedPlugin, newPluginPath, {filter: (p) => {
// Allowing plugin folder and files with no subfolders
const rootRx = /plugin$|plugin\/[^/]*(\.).{2,3}/igm;
if (rootRx.test(p) && (fs.lstatSync(p).isDirectory() || fs.lstatSync(p).isFile())) {
return true;
}
// If it's a client-side plugin, copying client folder
if (answers.client) {
return /client/.test(p);
}
// If it's a server-side plugin, copying server folder
if (answers.server) {
return /server/.test(p);
}
}});
}
// Let's add this to the plugins.json
if (answers.addPluginsJson) {
const pluginsJson = path.join(dir, 'plugins.json');
fs.readJson(pluginsJson)
.then((j) => {
// This is a client-side plugin, let's push this.
if (answers.client) {
j.client.push(answers.pluginName);
const output = JSON.stringify(j, null, 2);
fs.writeFileSync(pluginsJson, output);
}
// This is a server-side plugin, let's push this.
if (answers.server) {
j.server.push(answers.pluginName);
const output = JSON.stringify(j, null, 2);
fs.writeFileSync(pluginsJson, output);
}
})
.catch((err) => {
console.error(err);
});
}
console.log(`✨ Yay! Plugin created! Find your plugin: ${answers.pluginName} in the ./plugins folder`);
}
}
//==============================================================================
// Setting up the program command line arguments.
//==============================================================================
program
.command('create')
.description('creates a seed plugin')
.action(createSeedPlugin);
program
.command('list')
.description('')
+59
View File
@@ -0,0 +1,59 @@
#!/usr/bin/env node
const program = require('./commander');
const inquirer = require('inquirer');
const mongoose = require('../services/mongoose');
const SettingsService = require('../services/settings');
const util = require('./util');
// Register the shutdown criteria.
util.onshutdown([() => mongoose.disconnect()]);
/**
* Change the organization name
*/
async function changeOrgName() {
try {
let settings = await SettingsService.retrieve();
let {organizationName} = await inquirer.prompt([
{
name: 'organizationName',
message: 'Organization Name',
default: settings.organizationName
}
]);
if (settings.organizationName !== organizationName) {
settings.organizationName = organizationName;
await SettingsService.update(settings);
console.log('Settings were updated.');
} else {
console.log('No update needed, no change was made.');
}
} catch (err) {
console.error(err);
util.shutdown(1);
}
util.shutdown();
}
//==============================================================================
// Setting up the program command line arguments.
//==============================================================================
program
.command('change-org-name')
.description('change the organization name')
.action(changeOrgName);
program.parse(process.argv);
// If there is no command listed, output help.
if (!process.argv.slice(2).length) {
program.outputHelp();
util.shutdown();
}
Executable
+100
View File
@@ -0,0 +1,100 @@
#!/usr/bin/env node
/**
* Module dependencies.
*/
const program = require('./commander');
const mongoose = require('../services/mongoose');
const TokensService = require('../services/tokens');
const util = require('./util');
const Table = require('cli-table');
// Register the shutdown criteria.
util.onshutdown([
() => mongoose.disconnect()
]);
async function listTokens(userID) {
try {
let tokens = await TokensService.list(userID);
let table = new Table({
head: [
'ID',
'Name',
'Status'
]
});
tokens.forEach((token) => {
table.push([
token.id,
token.name,
token.active ? 'Active' : 'Revoked'
]);
});
console.log(table.toString());
util.shutdown();
} catch (e) {
console.error(e);
util.shutdown(1);
}
}
async function revokeToken(tokenID) {
try {
await TokensService.revoke(null, tokenID);
console.log(`Revoked Token[${tokenID}]`);
util.shutdown();
} catch (e) {
console.error(e);
util.shutdown(1);
}
}
async function createToken(userID, tokenName) {
try {
let {pat: {id}, jwt} = await TokensService.create(userID, tokenName);
console.log(`Created Token[${id}] for User[${userID}] = ${jwt}`);
util.shutdown();
} catch (e) {
console.error(e);
util.shutdown(1);
}
}
//==============================================================================
// Setting up the program command line arguments.
//==============================================================================
program
.command('list <userID>')
.description('list tokens for a user')
.action(listTokens);
program
.command('revoke <tokenID>')
.description('revokes a token with a given id')
.action(revokeToken);
program
.command('create <userID> <tokenName>')
.description('create a token for a user with a given name')
.action(createToken);
program.parse(process.argv);
// If there is no command listed, output help.
if (!process.argv.slice(2).length) {
program.outputHelp();
util.shutdown();
}
+7 -6
View File
@@ -8,6 +8,7 @@ const program = require('./commander');
const inquirer = require('inquirer');
const UsersService = require('../services/users');
const UserModel = require('../models/user');
const USER_ROLES = require('../models/enum/user_roles');
const mongoose = require('../services/mongoose');
const util = require('./util');
const Table = require('cli-table');
@@ -36,7 +37,7 @@ function getUserCreateAnswers(options) {
roles: []
};
if (options.role && UserModel.USER_ROLES.indexOf(options.role) > -1) {
if (options.role && USER_ROLES.indexOf(options.role) > -1) {
user.roles = [options.role];
}
@@ -89,7 +90,7 @@ function getUserCreateAnswers(options) {
name: 'roles',
message: 'User Role',
type: 'checkbox',
choices: UserModel.USER_ROLES
choices: USER_ROLES
}
]);
}
@@ -291,8 +292,8 @@ function mergeUsers(dstUserID, srcUserID) {
*/
function addRole(userID, role) {
if (UserModel.USER_ROLES.indexOf(role) === -1) {
console.error(`Role '${role}' is not supported. Supported roles are ${UserModel.USER_ROLES.join(', ')}.`);
if (USER_ROLES.indexOf(role) === -1) {
console.error(`Role '${role}' is not supported. Supported roles are ${USER_ROLES.join(', ')}.`);
util.shutdown(1);
return;
}
@@ -316,8 +317,8 @@ function addRole(userID, role) {
*/
function removeRole(userID, role) {
if (UserModel.USER_ROLES.indexOf(role) === -1) {
console.error(`Role '${role}' is not supported. Supported roles are ${UserModel.USER_ROLES.join(', ')}.`);
if (USER_ROLES.indexOf(role) === -1) {
console.error(`Role '${role}' is not supported. Supported roles are ${USER_ROLES.join(', ')}.`);
util.shutdown(1);
return;
}
+14
View File
@@ -0,0 +1,14 @@
{
"presets": [
"es2015"
],
"plugins": [
"add-module-exports",
"transform-class-properties",
"transform-decorators-legacy",
"transform-object-assign",
"transform-object-rest-spread",
"transform-async-to-generator",
"transform-react-jsx"
]
}
@@ -0,0 +1,23 @@
{
"env": {
"browser": true,
"es6": true,
"mocha": true
},
"parserOptions": {
"sourceType": "module",
"ecmaFeatures": {
"experimentalObjectRestSpread": true,
"jsx": true
}
},
"parser": "babel-eslint",
"plugins": [
"react"
],
"rules": {
"react/jsx-uses-react": "error",
"react/jsx-uses-vars": "error",
"no-console": ["warn", { "allow": ["warn", "error"] }]
}
}
@@ -0,0 +1,27 @@
.myPluginContainer {
padding: 10px;
background: #f0f0f0;
border: 1px solid #d6d6d6;
margin: 10px 0;
text-align: center;
border-radius: 3px;
}
.logo {
position: block;
animation: spin 2s infinite ease;
animation-delay: 1s;
}
@keyframes spin {
0% {
transform: rotate(0deg);
}
100% {
transform: rotate(360deg);
}
}
.description {
color: #444444;
}
@@ -0,0 +1,25 @@
import React from 'react';
import {CoralLogo} from 'plugin-api/beta/client/components/ui';
import styles from './MyPluginComponent.css';
class MyPluginComponent extends React.Component {
render() {
return (
<div className={styles.myPluginContainer}>
<CoralLogo className={styles.logo}/>
<div className={styles.description}>
<h3>Plugin created by Talk CLI</h3>
<small>
To read more about plugins check{' '}
<a href="https://coralproject.github.io/talk/plugins-client.html">
our docs and guides!
</a>
</small>
</div>
</div>
);
}
}
export default MyPluginComponent;
+26
View File
@@ -0,0 +1,26 @@
/**
This is a client index example file and it could look like this:
```
import LoveButton from './components/LoveButton';
export default {
slots: {
commentReactions: [LoveButton]
},
reducer,
translations
};
```
To read more info on how to build client plugins. Please, go to: https://coralproject.github.io/talk/plugins-client.html
*/
import MyPluginComponent from './components/MyPluginComponent';
export default {
slots: {
stream: [MyPluginComponent]
}
};
@@ -0,0 +1,15 @@
#
# This file is for translations and they should look like this:
#
#
# ```
# en:
# coral-plugin-respect:
# respect: Respect
# respected: Respected
# es:
# coral-plugin-respect:
# respect: Respetar
# respected: Respetado
# ```
#
+1
View File
@@ -0,0 +1 @@
module.exports = {};
+2 -1
View File
@@ -1,6 +1,6 @@
machine:
node:
version: 7.9
version: 7.10.1
services:
- docker
- redis
@@ -52,5 +52,6 @@ deployment:
latest:
branch: master
owner: coralproject
commands:
- bash ./scripts/docker.sh deploy
+3 -3
View File
@@ -1,5 +1,5 @@
import React from 'react';
import {Router, Route, IndexRedirect, browserHistory} from 'react-router';
import {Router, Route, IndexRedirect, browserHistory, Redirect} from 'react-router';
import Configure from 'routes/Configure';
import Dashboard from 'routes/Dashboard';
@@ -49,8 +49,8 @@ const routes = (
<Route path='flagged' components={Moderation}>
<Route path=':id' components={Moderation} />
</Route>
<Route path=':id' components={Moderation} />
<IndexRedirect to='premod' />
<Redirect from=':id' to='all/:id' />
<IndexRedirect to='all' />
</Route>
</Route>
</div>
+17 -9
View File
@@ -9,6 +9,7 @@ import {
} from '../constants/assets';
import coralApi from '../../../coral-framework/helpers/request';
import t from 'coral-framework/services/i18n';
/**
* Action disptacher related to assets
@@ -19,12 +20,16 @@ import coralApi from '../../../coral-framework/helpers/request';
export const fetchAssets = (skip = '', limit = '', search = '', sort = '', filter = '') => (dispatch) => {
dispatch({type: FETCH_ASSETS_REQUEST});
return coralApi(`/assets?skip=${skip}&limit=${limit}&sort=${sort}&search=${search}&filter=${filter}`)
.then(({result, count}) =>
dispatch({type: FETCH_ASSETS_SUCCESS,
assets: result,
count
}))
.catch((error) => dispatch({type: FETCH_ASSETS_FAILURE, error}));
.then(({result, count}) =>
dispatch({type: FETCH_ASSETS_SUCCESS,
assets: result,
count
}))
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: FETCH_ASSETS_FAILURE, error: errorMessage});
});
};
// Update an asset state
@@ -32,9 +37,12 @@ export const fetchAssets = (skip = '', limit = '', search = '', sort = '', filte
export const updateAssetState = (id, closedAt) => (dispatch) => {
dispatch({type: UPDATE_ASSET_STATE_REQUEST});
return coralApi(`/assets/${id}/status`, {method: 'PUT', body: {closedAt}})
.then(() =>
dispatch({type: UPDATE_ASSET_STATE_SUCCESS}))
.catch((error) => dispatch({type: UPDATE_ASSET_STATE_FAILURE, error}));
.then(() => dispatch({type: UPDATE_ASSET_STATE_SUCCESS}))
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: UPDATE_ASSET_STATE_FAILURE, error: errorMessage});
});
};
export const updateAssets = (assets) => (dispatch) => {
+35 -11
View File
@@ -3,6 +3,8 @@ import * as actions from '../constants/auth';
import coralApi from 'coral-framework/helpers/request';
import * as Storage from 'coral-framework/helpers/storage';
import {handleAuthToken} from 'coral-framework/actions/auth';
import {resetWebsocket} from 'coral-framework/services/client';
import t from 'coral-framework/services/i18n';
//==============================================================================
// SIGN IN
@@ -36,16 +38,31 @@ export const handleLogin = (email, password, recaptchaResponse) => (dispatch) =>
}
dispatch(handleAuthToken(token));
resetWebsocket();
dispatch(checkLoginSuccess(user));
})
.catch((error) => {
if (error.translation_key === 'LOGIN_MAXIMUM_EXCEEDED') {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
if (error.translation_key === 'NOT_AUTHORIZED') {
// invalid credentials
dispatch({
type: actions.LOGIN_FAILURE,
message: t('error.email_password')
});
}
else if (error.translation_key === 'LOGIN_MAXIMUM_EXCEEDED') {
dispatch({
type: actions.LOGIN_MAXIMUM_EXCEEDED,
message: error.translation_key
message: t(`error.${error.translation_key}`),
});
} else {
dispatch({type: actions.LOGIN_FAILURE, message: error.translation_key});
dispatch({
type: actions.LOGIN_FAILURE,
message: errorMessage,
});
}
});
};
@@ -54,25 +71,30 @@ export const handleLogin = (email, password, recaptchaResponse) => (dispatch) =>
// FORGOT PASSWORD
//==============================================================================
const forgotPassowordRequest = () => ({
const forgotPasswordRequest = () => ({
type: actions.FETCH_FORGOT_PASSWORD_REQUEST
});
const forgotPassowordSuccess = () => ({
const forgotPasswordSuccess = () => ({
type: actions.FETCH_FORGOT_PASSWORD_SUCCESS
});
const forgotPassowordFailure = () => ({
type: actions.FETCH_FORGOT_PASSWORD_FAILURE
const forgotPasswordFailure = (error) => ({
type: actions.FETCH_FORGOT_PASSWORD_FAILURE,
error,
});
export const requestPasswordReset = (email) => (dispatch) => {
dispatch(forgotPassowordRequest(email));
dispatch(forgotPasswordRequest(email));
const redirectUri = location.href;
return coralApi('/account/password/reset', {method: 'POST', body: {email, loc: redirectUri}})
.then(() => dispatch(forgotPassowordSuccess()))
.catch((error) => dispatch(forgotPassowordFailure(error)));
.then(() => dispatch(forgotPasswordSuccess()))
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch(forgotPasswordFailure(errorMessage));
});
};
//==============================================================================
@@ -105,10 +127,12 @@ export const checkLogin = () => (dispatch) => {
return dispatch(checkLoginFailure('not logged in'));
}
resetWebsocket();
dispatch(checkLoginSuccess(user));
})
.catch((error) => {
console.error(error);
dispatch(checkLoginFailure(`${error.translation_key}`));
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch(checkLoginFailure(errorMessage));
});
};
@@ -0,0 +1,7 @@
import {SHOW_BAN_USER_DIALOG, HIDE_BAN_USER_DIALOG} from '../constants/banUserDialog';
export const showBanUserDialog = ({userId, username, commentId, commentStatus}) =>
({type: SHOW_BAN_USER_DIALOG, userId, username, commentId, commentStatus});
export const hideBanUserDialog = () => ({type: HIDE_BAN_USER_DIALOG});
+11 -7
View File
@@ -10,11 +10,12 @@ import {
SET_COMMENTER_STATUS,
SHOW_BANUSER_DIALOG,
HIDE_BANUSER_DIALOG,
SHOW_SUSPENDUSER_DIALOG,
HIDE_SUSPENDUSER_DIALOG
SHOW_REJECT_USERNAME_DIALOG,
HIDE_REJECT_USERNAME_DIALOG
} from '../constants/community';
import coralApi from '../../../coral-framework/helpers/request';
import t from 'coral-framework/services/i18n';
export const fetchAccounts = (query = {}) => (dispatch) => {
@@ -30,7 +31,11 @@ export const fetchAccounts = (query = {}) => (dispatch) => {
totalPages
});
})
.catch((error) => dispatch({type: FETCH_COMMENTERS_FAILURE, error}));
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: FETCH_COMMENTERS_FAILURE, error: errorMessage});
});
};
const requestFetchAccounts = () => ({
@@ -47,7 +52,6 @@ export const newPage = () => ({
});
export const setRole = (id, role) => (dispatch) => {
return coralApi(`/users/${id}/role`, {method: 'POST', body: {role}})
.then(() => {
return dispatch({type: SET_ROLE, id, role});
@@ -65,6 +69,6 @@ export const setCommenterStatus = (id, status) => (dispatch) => {
export const showBanUserDialog = (user) => ({type: SHOW_BANUSER_DIALOG, user});
export const hideBanUserDialog = () => ({type: HIDE_BANUSER_DIALOG});
// Suspend User Dialog
export const showSuspendUserDialog = (user) => ({type: SHOW_SUSPENDUSER_DIALOG, user});
export const hideSuspendUserDialog = () => ({type: HIDE_SUSPENDUSER_DIALOG});
// Reject Username Dialog
export const showRejectUsernameDialog = (user) => ({type: SHOW_REJECT_USERNAME_DIALOG, user});
export const hideRejectUsernameDialog = () => ({type: HIDE_REJECT_USERNAME_DIALOG});
+33 -5
View File
@@ -2,6 +2,7 @@ import coralApi from 'coral-framework/helpers/request';
import * as actions from '../constants/install';
import validate from 'coral-framework/helpers/validate';
import errorMsj from 'coral-framework/helpers/error';
import t from 'coral-framework/services/i18n';
export const nextStep = () => ({type: actions.NEXT_STEP});
export const previousStep = () => ({type: actions.PREVIOUS_STEP});
@@ -17,7 +18,8 @@ const clearErrors = () => ({type: actions.CLEAR_ERRORS});
const validation = (formData, dispatch, next) => {
if (!(formData != null)) {
return dispatch(hasError());
dispatch(hasError());
return;
}
const validKeys = Object.keys(formData)
@@ -40,7 +42,8 @@ const validation = (formData, dispatch, next) => {
});
if (empty.length) {
return dispatch(hasError());
dispatch(hasError());
return;
}
// RegExp Validation
@@ -59,7 +62,30 @@ const validation = (formData, dispatch, next) => {
});
if (validation.length) {
return dispatch(hasError());
dispatch(hasError());
return;
}
// Confirm Validation
const prefixLength = 'confirm'.length;
const confirm = validKeys
.filter((name) => {
if (!name.startsWith('confirm')) {
return false;
}
// Check that 'confirmX' equals 'X'.
const other = name.substr(prefixLength, 1).toLowerCase() + name.substr(prefixLength + 1);
const cond = formData[other] !== formData[name];
if (cond) {
dispatch(addError(name, errorMsj[name]));
}
return cond;
});
if (confirm.length) {
dispatch(hasError());
return;
}
dispatch(clearErrors());
@@ -90,7 +116,8 @@ export const finishInstall = () => (dispatch, getState) => {
})
.catch((error) => {
console.error(error);
dispatch(installFailure(`${error.translation_key}`));
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch(installFailure(errorMessage));
});
};
@@ -113,6 +140,7 @@ export const checkInstall = (next) => (dispatch) => {
})
.catch((error) => {
console.error(error);
dispatch(checkInstallFailure(`${error.translation_key}`));
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch(checkInstallFailure(errorMessage));
});
};
+13 -10
View File
@@ -3,16 +3,6 @@ import * as actions from 'constants/moderation';
export const toggleModal = (open) => ({type: actions.TOGGLE_MODAL, open});
export const singleView = () => ({type: actions.SINGLE_VIEW});
// Ban User Dialog
export const showBanUserDialog = (user, commentId, commentStatus, showRejectedNote) => ({type: actions.SHOW_BANUSER_DIALOG, user, commentId, commentStatus, showRejectedNote});
export const hideBanUserDialog = () => ({type: actions.HIDE_BANUSER_DIALOG});
// Suspend User Dialog
export const showSuspendUserDialog = (userId, username, commentId, commentStatus) =>
({type: actions.SHOW_SUSPEND_USER_DIALOG, userId, username, commentId, commentStatus});
export const hideSuspendUserDialog = () => ({type: actions.HIDE_SUSPEND_USER_DIALOG});
// hide shortcuts note
export const hideShortcutsNote = () => {
try {
@@ -51,3 +41,16 @@ export const toggleSelectCommentInUserDetail = (id, active) => {
id
};
};
export const toggleStorySearch = (active) => ({
type: active ? actions.SHOW_STORY_SEARCH : actions.HIDE_STORY_SEARCH
});
export const storySearchChange = (value) => ({
type: actions.STORY_SEARCH_CHANGE_VALUE,
value
});
export const clearState = () => ({
type: actions.MODERATION_CLEAR_STATE
});
+7 -2
View File
@@ -1,4 +1,5 @@
import coralApi from '../../../coral-framework/helpers/request';
import t from 'coral-framework/services/i18n';
export const SETTINGS_LOADING = 'SETTINGS_LOADING';
export const SETTINGS_RECEIVED = 'SETTINGS_RECEIVED';
@@ -20,7 +21,9 @@ export const fetchSettings = () => (dispatch) => {
dispatch({type: SETTINGS_RECEIVED, settings});
})
.catch((error) => {
dispatch({type: SETTINGS_FETCH_ERROR, error});
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: SETTINGS_FETCH_ERROR, error: errorMessage});
});
};
@@ -49,6 +52,8 @@ export const saveSettingsToServer = () => (dispatch, getState) => {
dispatch({type: SAVE_SETTINGS_SUCCESS, settings});
})
.catch((error) => {
dispatch({type: SAVE_SETTINGS_FAILED, error});
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: SAVE_SETTINGS_FAILED, error: errorMessage});
});
};
@@ -0,0 +1,7 @@
import {SHOW_SUSPEND_USER_DIALOG, HIDE_SUSPEND_USER_DIALOG} from '../constants/suspendUserDialog.js';
export const showSuspendUserDialog = ({userId, username, commentId, commentStatus}) =>
({type: SHOW_SUSPEND_USER_DIALOG, userId, username, commentId, commentStatus});
export const hideSuspendUserDialog = () => ({type: HIDE_SUSPEND_USER_DIALOG});
+16 -3
View File
@@ -1,5 +1,6 @@
import coralApi from '../../../coral-framework/helpers/request';
import * as userTypes from '../constants/users';
import t from 'coral-framework/services/i18n';
/**
* Action disptacher related to users
@@ -10,7 +11,11 @@ export const userStatusUpdate = (status, userId, commentId) => {
dispatch({type: userTypes.UPDATE_STATUS_REQUEST});
return coralApi(`/users/${userId}/status`, {method: 'POST', body: {status: status, comment_id: commentId}})
.then((res) => dispatch({type: userTypes.UPDATE_STATUS_SUCCESS, res}))
.catch((error) => dispatch({type: userTypes.UPDATE_STATUS_FAILURE, error}));
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: userTypes.UPDATE_STATUS_FAILURE, error: errorMessage});
});
};
};
@@ -18,7 +23,11 @@ export const userStatusUpdate = (status, userId, commentId) => {
export const sendNotificationEmail = (userId, subject, body) => {
return (dispatch) => {
return coralApi(`/users/${userId}/email`, {method: 'POST', body: {subject, body}})
.catch((error) => dispatch({type: userTypes.USER_EMAIL_FAILURE, error}));
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: userTypes.USER_EMAIL_FAILURE, error: errorMessage});
});
};
};
@@ -26,6 +35,10 @@ export const sendNotificationEmail = (userId, subject, body) => {
export const enableUsernameEdit = (userId) => {
return (dispatch) => {
return coralApi(`/users/${userId}/username-enable`, {method: 'POST'})
.catch((error) => dispatch({type: userTypes.USERNAME_ENABLE_FAILURE, error}));
.catch((error) => {
console.error(error);
const errorMessage = error.translation_key ? t(`error.${error.translation_key}`) : error.toString();
dispatch({type: userTypes.USERNAME_ENABLE_FAILURE, error: errorMessage});
});
};
};
@@ -2,7 +2,6 @@ import React, {PropTypes} from 'react';
import Layout from 'coral-admin/src/components/ui/Layout';
import styles from './NotFound.css';
import {Button, TextField, Alert, Success} from 'coral-ui';
import t from 'coral-framework/services/i18n';
import Recaptcha from 'react-recaptcha';
class AdminLogin extends React.Component {
@@ -35,7 +34,7 @@ class AdminLogin extends React.Component {
const {errorMessage, loginMaxExceeded, recaptchaPublic} = this.props;
const signInForm = (
<form onSubmit={this.handleSignIn}>
{errorMessage && <Alert>{t(`error.${errorMessage}`)}</Alert>}
{errorMessage && <Alert>{errorMessage}</Alert>}
<TextField
label='Email Address'
value={this.state.email}
@@ -0,0 +1,44 @@
import React, {PropTypes} from 'react';
import {Dialog} from 'coral-ui';
import styles from './BanUserDialog.css';
import Button from 'coral-ui/components/Button';
import t from 'coral-framework/services/i18n';
const BanUserDialog = ({open, onCancel, onPerform, username, info}) => (
<Dialog
className={styles.dialog}
id="banUserDialog"
open={open}
onCancel={onCancel}
title={t('bandialog.ban_user')}>
<span className={styles.close} onClick={onCancel}>×</span>
<div>
<div className={styles.header}>
<h2>{t('bandialog.ban_user')}</h2>
</div>
<div className={styles.separator}>
<h3>{t('bandialog.are_you_sure', username)}</h3>
<i>{info}</i>
</div>
<div className={styles.buttons}>
<Button cStyle="cancel" className={styles.cancel} onClick={onCancel} raised>
{t('bandialog.cancel')}
</Button>
<Button cStyle="black" className={styles.ban} onClick={onPerform} raised>
{t('bandialog.yes_ban_user')}
</Button>
</div>
</div>
</Dialog>
);
BanUserDialog.propTypes = {
open: PropTypes.bool,
onPerform: PropTypes.func.isRequired,
onCancel: PropTypes.func.isRequired,
username: PropTypes.string,
info: PropTypes.string,
};
export default BanUserDialog;
@@ -16,8 +16,8 @@ const shortcuts = [
{
title: 'modqueue.actions',
shortcuts: {
't': 'modqueue.approve',
'r': 'modqueue.reject'
'd': 'modqueue.approve',
'f': 'modqueue.reject'
}
}
];
@@ -40,8 +40,8 @@ export default class ModerationKeysModal extends React.Component {
<p className={styles.ctaHeader}>{t('modqueue.mod_faster')}</p>
<p><strong>{t('modqueue.try_these')}:</strong></p>
<ul>
<li><span>{t('modqueue.approve')}</span> <span className={styles.smallKey}>t</span></li>
<li><span>{t('modqueue.reject')}</span> <span className={styles.smallKey}>r</span></li>
<li><span>{t('modqueue.approve')}</span> <span className={styles.smallKey}>d</span></li>
<li><span>{t('modqueue.reject')}</span> <span className={styles.smallKey}>f</span></li>
</ul>
<p><span>{t('modqueue.view_more_shortcuts')}</span> <span className={styles.smallKey}>{t('modqueue.shift_key')}</span> + <span className={styles.smallKey}>/</span></p>
</div>
@@ -8,8 +8,8 @@ import SuspendUserModal from './SuspendUserModal';
// Each action has different meaning and configuration
const menuOptionsMap = {
'reject': {status: 'REJECTED', icon: 'close', key: 'r'},
'approve': {status: 'ACCEPTED', icon: 'done', key: 't'},
'reject': {status: 'REJECTED', icon: 'close', key: 'f'},
'approve': {status: 'ACCEPTED', icon: 'done', key: 'd'},
'flag': {status: 'FLAGGED', icon: 'flag', filter: 'Untouched'},
'ban': {status: 'BANNED', icon: 'not interested'}
};
@@ -49,7 +49,6 @@ class SuspendUserDialog extends React.Component {
handlePerform = () => {
this.props.onPerform({
id: this.props.userId,
message: this.state.message,
// Add 1 minute more to help `timeago.js` to display the correct duration.
@@ -153,11 +152,10 @@ class SuspendUserDialog extends React.Component {
SuspendUserDialog.propTypes = {
open: PropTypes.bool.isRequired,
onCancel: PropTypes.func.isRequired,
onPerform: PropTypes.func.isRequired,
username: PropTypes.string,
userId: PropTypes.string,
onCancel: PropTypes.func.isRequired,
organizationName: PropTypes.string,
username: PropTypes.string,
};
export default SuspendUserDialog;
@@ -0,0 +1,51 @@
.root {
background-color: #fff;
border: 1px solid #ccc;
overflow: hidden;
padding-left: 5px;
padding-top: 5px;
}
.rootFocuesd {
border-color: rgb(142, 76, 65);
}
.tag {
background-color: rgb(255, 220, 214);
border-radius: 2px;
border: 1px solid rgb(244, 126, 107);
color: rgb(244, 126, 107);
display: inline-block;
font-family: sans-serif;
font-size: 13px;
font-weight: 400;
margin-bottom: 5px;
margin-right: 5px;
padding: 5px;
}
.tagRemove {
cursor: pointer;
font-weight: bold;
color: rgb(101, 24, 23);
&::before {
content: " ×";
}
}
.input > input {
background: transparent;
border: 0;
color: #777;
font-family: sans-serif;
font-size: 13px;
font-weight: 400;
margin-bottom: 6px;
margin-top: 1px;
outline: none;
padding: 5px;
}
@@ -0,0 +1,31 @@
import React from 'react';
import TagsInput from 'react-tagsinput';
import styles from './TagsInput.css';
import AutosizeInput from 'react-input-autosize';
const autosizingRenderInput = ({onChange, value, addTag: _, ...other}) =>
<AutosizeInput type='text' onChange={onChange} value={value} {...other} />;
export default (props) => {
return (
<TagsInput
addOnBlur={true}
addOnPaste={true}
pasteSplit={(data) => data.split(',').map((d) => d.trim())}
className={styles.root}
focusedClassName={styles.rootFocus}
renderInput={autosizingRenderInput}
{...props}
tagProps={{
className: styles.tag,
classNameRemove: styles.tagRemove,
...props.tagProps,
}}
inputProps={{
className: styles.input,
...props.inputProps,
}}
/>
);
};
@@ -133,7 +133,7 @@
animation-fill-mode: both; }
.toastify {
z-index: 999;
z-index: 99999;
position: fixed;
padding: 4px;
width: 350px;
@@ -197,7 +197,7 @@
border-radius: 2px;
box-shadow: 0 2px 15px 0 rgba(0, 0, 0, 0.1), 0 3px 20px 0 rgba(0, 0, 0, 0.05); }
.toastify-content--info {
background: #2488cb; }
background: #404040; }
.toastify-content--success {
background: #008577; }
.toastify-content--warning {
@@ -207,6 +207,7 @@
.toastify__body {
color: white;
overflow-x: scroll;
font-size: 15px;
font-weight: 400;
}
@@ -40,12 +40,12 @@
height: 100%;
}
.rightPanel ul {
.rightPanel > ul {
list-style: none;
margin-right: 20px;
}
.rightPanel li {
.rightPanel > ul > li {
display: inline-block;
float: right;
margin-left: 15px;
@@ -54,6 +54,12 @@
line-height: 33px;
}
.rightPanel a {
color: black;
text-decoration: none;
font-weight: 400;
}
.rightPanel .settings {
line-height: 0;
}
+15 -3
View File
@@ -71,12 +71,24 @@ const CoralHeader = ({
<IconButton name="settings" id="menu-settings"/>
<Menu target="menu-settings" align="right">
<MenuItem onClick={() => showShortcuts(true)}>{t('configure.shortcuts')}</MenuItem>
<MenuItem onClick={handleLogout}>{t('configure.sign_out')}</MenuItem>
<MenuItem>
<a href="https://github.com/coralproject/talk/releases" target="_blank">
View latest version
</a>
</MenuItem>
<MenuItem>
<a href="https://coralproject.net/contribute.html#other-ideas-and-bug-reports" target="_blank">
Report a bug or give feedback
</a>
</MenuItem>
<MenuItem onClick={handleLogout}>
{t('configure.sign_out')}
</MenuItem>
</Menu>
</div>
</li>
<li>
{`v${process.env.VERSION}`}
<li>
{`v${process.env.VERSION}`}
</li>
</ul>
</div>
@@ -1,6 +1,5 @@
.layout {
max-width: 1280px;
margin: 0 auto;
overflow: hidden;
background-color: #FAFAFA;
}
@@ -10,7 +10,7 @@ const Layout = ({
toggleShortcutModal,
restricted = false,
...props}) => (
<LayoutMDL fixedDrawer>
<LayoutMDL className={styles.layout} fixedDrawer>
<Header
handleLogout={handleLogout}
showShortcuts={toggleShortcutModal}
@@ -0,0 +1,2 @@
export const SHOW_BAN_USER_DIALOG = 'SHOW_BAN_USER_DIALOG';
export const HIDE_BAN_USER_DIALOG = 'HIDE_BAN_USER_DIALOG';
@@ -13,5 +13,5 @@ export const FETCH_FLAGGED_COMMENTERS_FAILURE = 'FETCH_FLAGGED_COMMENTERS_FAILUR
export const SHOW_BANUSER_DIALOG = 'SHOW_BANUSER_DIALOG';
export const HIDE_BANUSER_DIALOG = 'HIDE_BANUSER_DIALOG';
export const SHOW_SUSPENDUSER_DIALOG = 'SHOW_SUSPENDUSER_DIALOG';
export const HIDE_SUSPENDUSER_DIALOG = 'HIDE_SUSPENDUSER_DIALOG';
export const SHOW_REJECT_USERNAME_DIALOG = 'SHOW_REJECT_USERNAME_DIALOG';
export const HIDE_REJECT_USERNAME_DIALOG = 'HIDE_REJECT_USERNAME_DIALOG';
@@ -1,10 +1,6 @@
export const TOGGLE_MODAL = 'TOGGLE_MODAL';
export const SINGLE_VIEW = 'SINGLE_VIEW';
export const SHOW_BANUSER_DIALOG = 'SHOW_BANUSER_DIALOG';
export const HIDE_BANUSER_DIALOG = 'HIDE_BANUSER_DIALOG';
export const HIDE_SHORTCUTS_NOTE = 'HIDE_SHORTCUTS_NOTE';
export const SHOW_SUSPEND_USER_DIALOG = 'SHOW_SUSPEND_USER_DIALOG';
export const HIDE_SUSPEND_USER_DIALOG = 'HIDE_SUSPEND_USER_DIALOG';
export const VIEW_USER_DETAIL = 'VIEW_USER_DETAIL';
export const HIDE_USER_DETAIL = 'HIDE_USER_DETAIL';
export const SET_SORT_ORDER = 'MODERATION_SET_SORT_ORDER';
@@ -12,3 +8,7 @@ export const CHANGE_USER_DETAIL_STATUSES = 'CHANGE_USER_DETAIL_STATUSES';
export const SELECT_USER_DETAIL_COMMENT = 'SELECT_USER_DETAIL_COMMENT';
export const UNSELECT_USER_DETAIL_COMMENT = 'UNSELECT_USER_DETAIL_COMMENT';
export const CLEAR_USER_DETAIL_SELECTIONS = 'CLEAR_USER_DETAIL_SELECTIONS';
export const SHOW_STORY_SEARCH = 'SHOW_STORY_SEARCH';
export const HIDE_STORY_SEARCH = 'HIDE_STORY_SEARCH';
export const STORY_SEARCH_CHANGE_VALUE = 'STORY_SEARCH_CHANGE_VALUE';
export const MODERATION_CLEAR_STATE = 'MODERATION_CLEAR_STATE';
@@ -0,0 +1,2 @@
export const SHOW_SUSPEND_USER_DIALOG = 'SHOW_SUSPEND_USER_DIALOG';
export const HIDE_SUSPEND_USER_DIALOG = 'HIDE_SUSPEND_USER_DIALOG';
@@ -0,0 +1,63 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import BanUserDialog from '../components/BanUserDialog';
import {hideBanUserDialog} from '../actions/banUserDialog';
import {withSetUserStatus, withSetCommentStatus} from 'coral-framework/graphql/mutations';
import {compose} from 'react-apollo';
import t from 'coral-framework/services/i18n';
class BanUserDialogContainer extends Component {
banUser = async () => {
const {userId, commentId, commentStatus, setUserStatus, setCommentStatus, hideBanUserDialog} = this.props;
await setUserStatus({userId, status: 'BANNED'});
hideBanUserDialog();
if (commentId && commentStatus && commentStatus !== 'REJECTED') {
await setCommentStatus({commentId, status: 'REJECTED'});
}
}
getInfo() {
let note = t('bandialog.note_ban_user');
if (this.props.commentStatus && this.props.commentStatus !== 'REJECTED') {
note = t('bandialog.note_reject_comment');
}
return t('bandialog.note', note);
}
render() {
return (
<BanUserDialog
open={this.props.open}
onPerform={this.banUser}
onCancel={this.props.hideBanUserDialog}
username={this.props.username}
info={this.getInfo()}
/>
);
}
}
const mapStateToProps = ({banUserDialog: {open, userId, username, commentId, commentStatus}}) => ({
open,
userId,
username,
commentId,
commentStatus,
});
const mapDispatchToProps = (dispatch) => ({
...bindActionCreators({
hideBanUserDialog,
}, dispatch),
});
export default compose(
withSetUserStatus,
withSetCommentStatus,
connect(
mapStateToProps,
mapDispatchToProps,
),
)(BanUserDialogContainer);
+7 -1
View File
@@ -5,6 +5,8 @@ import {fetchConfig} from '../actions/config';
import AdminLogin from '../components/AdminLogin';
import {logout} from 'coral-framework/actions/auth';
import {FullLoading} from '../components/FullLoading';
import BanUserDialog from './BanUserDialog';
import SuspendUserDialog from './SuspendUserDialog';
import {toggleModal as toggleShortcutModal} from '../actions/moderation';
import {checkLogin, handleLogin, requestPasswordReset} from '../actions/auth';
import {can} from 'coral-framework/services/perms';
@@ -52,7 +54,11 @@ class LayoutContainer extends Component {
handleLogout={handleLogout}
toggleShortcutModal={toggleShortcutModal}
{...this.props}
/>
>
<BanUserDialog />
<SuspendUserDialog />
{this.props.children}
</Layout>
);
} else if (loggedIn) {
return (
@@ -0,0 +1,83 @@
import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import SuspendUserDialog from '../components/SuspendUserDialog';
import {hideSuspendUserDialog} from '../actions/suspendUserDialog';
import {withSetCommentStatus, withSuspendUser} from 'coral-framework/graphql/mutations';
import {compose, gql} from 'react-apollo';
import * as notification from 'coral-admin/src/services/notification';
import t, {timeago} from 'coral-framework/services/i18n';
import withQuery from 'coral-framework/hocs/withQuery';
import get from 'lodash/get';
class SuspendUserDialogContainer extends Component {
suspendUser = async ({message, until}) => {
const {userId, username, commentStatus, commentId, hideSuspendUserDialog, setCommentStatus, suspendUser} = this.props;
hideSuspendUserDialog();
try {
const result = await suspendUser({id: userId, message, until});
if (result.data.suspendUser.errors) {
throw result.data.suspendUser.errors;
}
notification.success(
t('suspenduser.notify_suspend_until', username, timeago(until)),
);
if (commentId && commentStatus && commentStatus !== 'REJECTED') {
return setCommentStatus({commentId, status: 'REJECTED'})
.then((result) => {
if (result.data.setCommentStatus.errors) {
throw result.data.setCommentStatus.errors;
}
});
}
}
catch(err) {
notification.showMutationErrors(err);
}
};
render() {
return (
<SuspendUserDialog
open={this.props.open}
onPerform={this.suspendUser}
onCancel={this.props.hideSuspendUserDialog}
organizationName={get(this.props, 'root.settings.organizationName')}
username={this.props.username}
/>
);
}
}
const withOrganizationName = withQuery(gql`
query CoralAdmin_SuspendUserDialog {
settings {
organizationName
}
}
`);
const mapStateToProps = ({suspendUserDialog: {open, userId, username, commentId, commentStatus}}) => ({
open,
userId,
username,
commentId,
commentStatus,
});
const mapDispatchToProps = (dispatch) => ({
...bindActionCreators({
hideSuspendUserDialog,
}, dispatch),
});
export default compose(
connect(
mapStateToProps,
mapDispatchToProps,
),
withSuspendUser,
withSetCommentStatus,
withOrganizationName,
)(SuspendUserDialogContainer);
-54
View File
@@ -1,6 +1,4 @@
import {add} from 'coral-framework/services/graphqlRegistry';
import update from 'immutability-helper';
const queues = ['all', 'premod', 'flagged', 'accepted', 'rejected'];
const extension = {
mutations: {
@@ -10,58 +8,6 @@ const extension = {
RejectUsername: () => ({
refetchQueries: ['CoralAdmin_Community'],
}),
SetCommentStatus: ({variables: {commentId, status}}) => ({
updateQueries: {
CoralAdmin_Moderation: (prev) => {
const comment = queues.reduce((comment, queue) => {
return comment ? comment : prev[queue].nodes.find((c) => c.id === commentId);
}, null);
let acceptedNodes = prev.accepted.nodes;
let acceptedCount = prev.acceptedCount;
let rejectedNodes = prev.rejected.nodes;
let rejectedCount = prev.rejectedCount;
if (status !== comment.status) {
if (status === 'ACCEPTED') {
comment.status = 'ACCEPTED';
acceptedCount++;
acceptedNodes = [comment, ...acceptedNodes];
}
else if (status === 'REJECTED') {
comment.status = 'REJECTED';
rejectedCount++;
rejectedNodes = [comment, ...rejectedNodes];
}
}
const premodNodes = prev.premod.nodes.filter((c) => c.id !== commentId);
const flaggedNodes = prev.flagged.nodes.filter((c) => c.id !== commentId);
const premodCount = premodNodes.length < prev.premod.nodes.length ? prev.premodCount - 1 : prev.premodCount;
const flaggedCount = flaggedNodes.length < prev.flagged.nodes.length ? prev.flaggedCount - 1 : prev.flaggedCount;
if (status === 'REJECTED') {
acceptedNodes = prev.accepted.nodes.filter((c) => c.id !== commentId);
acceptedCount = acceptedNodes.length < prev.accepted.nodes.length ? prev.acceptedCount - 1 : prev.acceptedCount;
}
else if (status === 'ACCEPTED') {
rejectedNodes = prev.rejected.nodes.filter((c) => c.id !== commentId);
rejectedCount = rejectedNodes.length < prev.rejected.nodes.length ? prev.rejectedCount - 1 : prev.rejectedCount;
}
return update(prev, {
premodCount: {$set: Math.max(0, premodCount)},
flaggedCount: {$set: Math.max(0, flaggedCount)},
acceptedCount: {$set: Math.max(0, acceptedCount)},
rejectedCount: {$set: Math.max(0, rejectedCount)},
premod: {nodes: {$set: premodNodes}},
flagged: {nodes: {$set: flaggedNodes}},
accepted: {nodes: {$set: acceptedNodes}},
rejected: {nodes: {$set: rejectedNodes}},
});
}
}
}),
},
};
+137
View File
@@ -0,0 +1,137 @@
import update from 'immutability-helper';
import * as notification from 'coral-admin/src/services/notification';
const queues = ['all', 'premod', 'flagged', 'accepted', 'rejected'];
const limit = 10;
const ascending = (a, b) => {
const dateA = new Date(a.created_at);
const dateB = new Date(b.created_at);
if (dateA < dateB) { return -1; }
if (dateA > dateB) { return 1; }
return 0;
};
const descending = (a, b) => -ascending(a, b);
function queueHasComment(root, queue, id) {
return root[queue].nodes.find((c) => c.id === id);
}
function removeCommentFromQueue(root, queue, id) {
if (!queueHasComment(root, queue, id)) {
return root;
}
return update(root, {
[`${queue}Count`]: {$set: root[`${queue}Count`] - 1},
[queue]: {
nodes: {$apply: (nodes) => nodes.filter((c) => c.id !== id)},
},
});
}
function shouldCommentBeAdded(root, queue, comment, sort) {
if (root[`${queue}Count`] < limit) {
// Adding all comments until first limit has reached.
return true;
}
const cursor = new Date(root[queue].endCursor);
return sort === 'CHRONOLOGICAL'
? new Date(comment.created_at) <= cursor
: new Date(comment.created_at) >= cursor;
}
function addCommentToQueue(root, queue, comment, sort) {
if (queueHasComment(root, queue, comment.id)) {
return root;
}
const sortAlgo = sort === 'CHRONOLOGICAL' ? ascending : descending;
const changes = {
[`${queue}Count`]: {$set: root[`${queue}Count`] + 1},
};
if (shouldCommentBeAdded(root, queue, comment, sort)) {
const nodes = root[queue].nodes.concat(comment).sort(sortAlgo);
changes[queue] = {
nodes: {$set: nodes},
startCursor: {$set: nodes[0].created_at},
endCursor: {$set: nodes[nodes.length - 1].created_at},
};
}
return update(root, changes);
}
function getCommentQueues(comment) {
const queues = ['all'];
if (comment.status === 'ACCEPTED') {
queues.push('accepted');
}
else if (comment.status === 'REJECTED') {
queues.push('rejected');
}
else if (comment.status === 'PREMOD') {
queues.push('premod');
}
if (
['NONE', 'PREMOD'].indexOf(comment.status) >= 0
&& comment.actions && comment.actions.some((a) => a.__typename === 'FlagAction')
) {
queues.push('flagged');
}
return queues;
}
/**
* Assimilate comment changes into current store.
* @param {Object} root current state of the store
* @param {Object} comment comment that was changed
* @param {string} sort current sort order of the queues
* @param {Object} [notify] show know notifications if set
* @param {string} notify.activeQueue current active queue
* @param {string} notify.text notification text to show
* @param {bool} notify.anyQueue if true show the notification when the comment is shown
* in the current active queue besides the 'all' queue.
* @return {Object} next state of the store
*/
export function handleCommentChange(root, comment, sort, notify) {
let next = root;
const nextQueues = getCommentQueues(comment);
let notificationShown = false;
const showNotificationOnce = () => {
if (notificationShown) {
return;
}
notification.info(notify.text);
notificationShown = true;
};
queues.forEach((queue) => {
if (nextQueues.indexOf(queue) >= 0) {
if (!queueHasComment(next, queue, comment.id)) {
next = addCommentToQueue(next, queue, comment, sort);
if (notify && notify.activeQueue === queue && shouldCommentBeAdded(next, queue, comment, sort)) {
showNotificationOnce(comment);
}
}
} else if(queueHasComment(next, queue, comment.id)){
next = removeCommentFromQueue(next, queue, comment.id);
if (notify && notify.activeQueue === queue) {
showNotificationOnce(comment);
}
}
if (
notify
&& (queue === 'all' || notify.anyQueue)
&& queueHasComment(next, queue, comment.id)
&& notify.activeQueue === queue
) {
showNotificationOnce(comment);
}
});
return next;
}
+4 -2
View File
@@ -1,8 +1,9 @@
import React from 'react';
import {render} from 'react-dom';
import {ApolloProvider} from 'react-apollo';
import smoothscroll from 'smoothscroll-polyfill';
import {client} from './services/client';
import {getClient} from './services/client';
import store from './services/store';
import App from './components/App';
@@ -13,9 +14,10 @@ import {loadPluginsTranslations, injectPluginsReducers} from 'coral-framework/he
loadPluginsTranslations();
injectPluginsReducers();
smoothscroll.polyfill();
render(
<ApolloProvider client={client} store={store}>
<ApolloProvider client={getClient()} store={store}>
<App />
</ApolloProvider>
, document.querySelector('#root')
@@ -0,0 +1,30 @@
import {SHOW_BAN_USER_DIALOG, HIDE_BAN_USER_DIALOG} from '../constants/banUserDialog';
const initialState = {
open: false,
userId: null,
username: '',
commentId: null,
commentStatus: '',
};
export default function banUserDialog(state = initialState, action) {
switch (action.type) {
case SHOW_BAN_USER_DIALOG:
return {
...state,
open: true,
userId: action.userId,
username: action.username,
commentId: action.commentId,
commentStatus: action.commentStatus,
};
case HIDE_BAN_USER_DIALOG:
return {
...state,
open: false,
};
default:
return state;
}
}
+7 -7
View File
@@ -9,8 +9,8 @@ import {
SET_COMMENTER_STATUS,
SHOW_BANUSER_DIALOG,
HIDE_BANUSER_DIALOG,
SHOW_SUSPENDUSER_DIALOG,
HIDE_SUSPENDUSER_DIALOG
SHOW_REJECT_USERNAME_DIALOG,
HIDE_REJECT_USERNAME_DIALOG
} from '../constants/community';
const initialState = Map({
@@ -24,7 +24,7 @@ const initialState = Map({
pagePeople: 0,
user: Map({}),
banDialog: false,
suspendDialog: false
rejectUsernameDialog: false
});
export default function community (state = initialState, action) {
@@ -79,14 +79,14 @@ export default function community (state = initialState, action) {
user: Map(action.user),
banDialog: true
});
case HIDE_SUSPENDUSER_DIALOG:
case HIDE_REJECT_USERNAME_DIALOG:
return state
.set('suspendDialog', false);
case SHOW_SUSPENDUSER_DIALOG:
.set('rejectUsernameDialog', false);
case SHOW_REJECT_USERNAME_DIALOG:
return state
.merge({
user: Map(action.user),
suspendDialog: true
rejectUsernameDialog: true
});
default :
return state;
+4
View File
@@ -5,9 +5,13 @@ import community from './community';
import moderation from './moderation';
import install from './install';
import config from './config';
import banUserDialog from './banUserDialog';
import suspendUserDialog from './suspendUserDialog';
export default {
auth,
banUserDialog,
suspendUserDialog,
assets,
settings,
community,
+11 -39
View File
@@ -1,57 +1,23 @@
import {fromJS, Map, Set} from 'immutable';
import {fromJS, Set} from 'immutable';
import * as actions from '../constants/moderation';
const initialState = fromJS({
singleView: false,
modalOpen: false,
user: {},
commentId: null,
commentStatus: null,
userDetailId: null,
userDetailActiveTab: 'all',
userDetailStatuses: ['NONE', 'ACCEPTED', 'REJECTED', 'PREMOD'],
userDetailSelectedIds: new Set(),
banDialog: false,
storySearchVisible: false,
storySearchString: '',
shortcutsNoteVisible: window.localStorage.getItem('coral:shortcutsNote') || 'show',
sortOrder: 'REVERSE_CHRONOLOGICAL',
suspendUserDialog: {
show: false,
userId: null,
username: '',
commentId: null,
commentStatus: '',
},
});
export default function moderation (state = initialState, action) {
switch (action.type) {
case actions.HIDE_BANUSER_DIALOG:
return state
.set('banDialog', false)
.set('commentStatus', null);
case actions.SHOW_BANUSER_DIALOG:
return state
.merge({
user: Map(action.user),
commentId: action.commentId,
commentStatus: action.commentStatus,
showRejectedNote: action.showRejectedNote,
banDialog: true
});
case actions.SHOW_SUSPEND_USER_DIALOG:
return state
.mergeDeep({
suspendUserDialog: {
show: true,
userId: action.userId,
username: action.username,
commentId: action.commentId,
commentStatus: action.commentStatus,
}
});
case actions.HIDE_SUSPEND_USER_DIALOG:
return state
.setIn(['suspendUserDialog', 'show'], false);
case actions.MODERATION_CLEAR_STATE:
return initialState;
case actions.SET_ACTIVE_TAB:
return state
.set('activeTab', action.activeTab);
@@ -80,6 +46,12 @@ export default function moderation (state = initialState, action) {
return state.update('userDetailSelectedIds', (set) => set.add(action.id));
case actions.UNSELECT_USER_DETAIL_COMMENT:
return state.update('userDetailSelectedIds', (set) => set.delete(action.id));
case actions.SHOW_STORY_SEARCH:
return state.set('storySearchVisible', true);
case actions.HIDE_STORY_SEARCH:
return state.set('storySearchVisible', false);
case actions.STORY_SEARCH_CHANGE_VALUE:
return state.set('storySearchString', action.value);
case actions.SET_SORT_ORDER:
return state.set('sortOrder', action.order);
default :
@@ -0,0 +1,30 @@
import {SHOW_SUSPEND_USER_DIALOG, HIDE_SUSPEND_USER_DIALOG} from '../constants/suspendUserDialog';
const initialState = {
open: false,
userId: null,
username: '',
commentId: null,
commentStatus: '',
};
export default function suspendUserDialog(state = initialState, action) {
switch (action.type) {
case SHOW_SUSPEND_USER_DIALOG:
return {
...state,
open: true,
userId: action.userId,
username: action.username,
commentId: action.commentId,
commentStatus: action.commentStatus,
};
case HIDE_SUSPEND_USER_DIALOG:
return {
...state,
open: false,
};
default:
return state;
}
}
@@ -1,23 +1,18 @@
import React from 'react';
import styles from './Community.css';
import BanUserButton from './BanUserButton';
import {Button} from 'coral-ui';
import {menuActionsMap} from '../../Moderation/helpers/moderationQueueActionsMap';
import t from 'coral-framework/services/i18n';
const ActionButton = ({type = '', user, ...props}) => {
if (type === 'BAN') {
return <BanUserButton icon='not interested' user={user} onClick={() => props.showBanUserDialog(user)} />;
}
return (
<Button
className={`${type.toLowerCase()} ${styles.actionButton}`}
cStyle={type.toLowerCase()}
icon={menuActionsMap[type].icon}
onClick={() => {
type === 'APPROVE' ? props.approveUser({userId: user.id}) : props.showSuspendUserDialog({user: user});
type === 'APPROVE' ? props.approveUser({userId: user.id}) : props.showRejectUsernameDialog({user: user});
}}
>{t(`modqueue.${menuActionsMap[type].text}`)}</Button>
);
@@ -1,11 +0,0 @@
.banButton {
-webkit-transform: scale(.8);
transform: scale(.8);
margin: 0;
i {
vertical-align: middle;
margin-right: 5px;
font-size: 14px;
}
}
@@ -1,24 +0,0 @@
import React, {PropTypes} from 'react';
import {Button, Icon} from 'coral-ui';
import styles from './BanUserButton.css';
import t from 'coral-framework/services/i18n';
const BanUserButton = ({user, ...props}) => (
<div className={styles.ban}>
<Button cStyle='ban'
className={`ban ${styles.banButton}`}
disabled={user.status === 'BANNED' ? 'disabled' : ''}
onClick={props.onClick}
raised>
<Icon name='not_interested' />
{t('comment.ban_user')}
</Button>
</div>
);
BanUserButton.propTypes = {
onClick: PropTypes.func.isRequired
};
export default BanUserButton;
@@ -1,164 +0,0 @@
.dialog {
border: none;
box-shadow: 0 9px 46px 8px rgba(0, 0, 0, 0.14), 0 11px 15px -7px rgba(0, 0, 0, 0.12), 0 24px 38px 3px rgba(0, 0, 0, 0.2);
width: 500px;
top: 50%;
transform: translateY(-50%);
height: 184px;
padding: 20px;
h2 {
color: black;
font-size: 1.76em;
font-weight: 500;
margin: 0;
}
h3 {
color: black;
font-size: 1.4em;
font-weight: 500;
margin: 0;
}
}
.textField {
margin-top: 15px;
}
.textField label {
font-size: 1.08em;
font-weight: bold;
margin-bottom: 5px;
}
.textField input {
width: 100%;
display: block;
border: none;
outline: none;
border: 1px solid rgba(0,0,0,.12);
padding: 10px 6px;
box-sizing: border-box;
border-radius: 2px;
margin: 5px auto;
}
.footer {
margin: 20px auto 10px;
text-align: center;
}
.footer span {
display: block;
margin-bottom: 5px;
}
.footer a {
color: #2c69b6;
cursor: pointer;
margin: 0 5px;
}
.socialConnections {
margin-bottom: 20px;
}
.signInButton {
margin-top: 10px;
}
.close {
font-size: 20px;
line-height: 14px;
top: 10px;
right: 10px;
position: absolute;
display: block;
font-weight: bold;
color: #363636;
cursor: pointer;
}
.close:hover {
color: #6b6b6b;
}
input.error{
border: solid 2px #f44336;
}
.errorMsg, .hint {
color: grey;
font-weight: 600;
padding: 3px 0 16px;
}
.alert {
padding: 10px;
margin-bottom: 20px;
border-radius: 2px;
}
.alert--success {
border: solid 1px #1ec00e;
background: #cbf1b8;
color: #006900;
}
.alert--error {
background: #FFEBEE;
color: #B71C1C;
}
.userBox a {
color: #2c69b6;
cursor: pointer;
margin: 0px;
}
.attention {
display: inline-block;
width: 15px;
height: 15px;
background: #B71C1C;
color: #FFEBEE;
font-weight: bolder;
padding: 4px;
vertical-align: middle;
border-radius: 20px;
box-sizing: border-box;
font-size: 9px;
line-height: 7px;
text-align: center;
margin-right: 5px;
}
.action {
margin-top: 15px;
}
.passwordRequestSuccess {
border: 1px solid green;
background-color: lightgreen;
padding: 10px;
}
.passwordRequestFailure {
border: 1px solid orange;
background-color: 1px solid coral;
padding: 10px;
}
.cancel {
margin-right: 10px;
width: 47%;
}
.ban {
width: 47%;
}
.buttons {
margin: 20px 0;
}
@@ -1,51 +0,0 @@
import React, {PropTypes} from 'react';
import {Dialog} from 'coral-ui';
import styles from './BanUserDialog.css';
import Button from 'coral-ui/components/Button';
import t from 'coral-framework/services/i18n';
const BanUserDialog = ({open, handleClose, handleBanUser, user}) => (
<Dialog
className={styles.dialog}
id="banuserDialog"
open={open}
onClose={handleClose}
onCancel={handleClose}
title={t('community.ban_user')}>
<span className={styles.close} onClick={handleClose}>×</span>
<div>
<div className={styles.header}>
<h2>{t('community.ban_user')}</h2>
</div>
<div className={styles.separator}>
<h3>{t('community.are_you_sure', user.username)}</h3>
<i>{t('community.note')}</i>
</div>
<div className={styles.buttons}>
<Button cStyle="cancel" className={styles.cancel} onClick={handleClose} raised>
{t('community.cancel')}
</Button>
<Button
cStyle="black" className={styles.ban}
onClick={() => {
handleBanUser({userId: user.id}).then(() => {
handleClose();
});
}}
raised>
{t('community.yes_ban_user')}
</Button>
</div>
</div>
</Dialog>
);
BanUserDialog.propTypes = {
handleBanUser: PropTypes.func.isRequired,
handleClose: PropTypes.func.isRequired,
user: PropTypes.object.isRequired,
};
export default BanUserDialog;
@@ -1,10 +1,9 @@
import React, {Component} from 'react';
import CommunityMenu from './CommunityMenu';
import BanUserDialog from './BanUserDialog';
import SuspendUserDialog from './SuspendUserDialog';
import People from './People';
import FlaggedAccounts from './FlaggedAccounts';
import RejectUsernameDialog from './RejectUsernameDialog';
export default class Community extends Component {
@@ -80,19 +79,15 @@ export default class Community extends Component {
<FlaggedAccounts
commenters={users}
showBanUserDialog={props.showBanUserDialog}
showSuspendUserDialog={props.showSuspendUserDialog}
showRejectUsernameDialog={props.showRejectUsernameDialog}
approveUser={props.approveUser}
rejectUsername={props.rejectUsername}
showSuspendUserDialog={props.showSuspendUserDialog}
currentUser={this.props.currentUser}
/>
<BanUserDialog
open={community.banDialog}
user={community.user}
handleClose={props.hideBanUserDialog}
handleBanUser={props.banUser}
/>
<SuspendUserDialog
open={community.suspendDialog}
handleClose={props.hideSuspendUserDialog}
<RejectUsernameDialog
open={community.rejectUsernameDialog}
handleClose={props.hideRejectUsernameDialog}
user={community.user}
rejectUsername={props.rejectUsername}
/>
@@ -9,8 +9,6 @@ const FlaggedAccounts = ({...props}) => {
const {commenters} = props;
const hasResults = commenters && !!commenters.length;
// if (commenter.status === 'PENDING' && commenter.actions.length > 0) {
return (
<div className={styles.container}>
<div className={styles.mainFlaggedContent}>
@@ -24,8 +22,9 @@ const FlaggedAccounts = ({...props}) => {
modActionButtons={['APPROVE', 'REJECT']}
showBanUserDialog={props.showBanUserDialog}
showSuspendUserDialog={props.showSuspendUserDialog}
showRejectUsernameDialog={props.showRejectUsernameDialog}
approveUser={props.approveUser}
suspendUser={props.suspendUser}
currentUser={props.currentUser}
/>;
})
: <EmptyCard>{t('community.no_flagged_accounts')}</EmptyCard>
@@ -1,30 +1,30 @@
import React, {Component, PropTypes} from 'react';
import {Dialog, Button} from 'coral-ui';
import styles from './SuspendUserDialog.css';
import styles from './RejectUsernameDialog.css';
import t from 'coral-framework/services/i18n';
const stages = [
{
title: 'suspenduser.title_reject',
description: 'suspenduser.description_reject',
title: 'reject_username.title_reject',
description: 'reject_username.description_reject',
options: {
'j': 'suspenduser.no_cancel',
'k': 'suspenduser.yes_suspend'
'j': 'reject_username.no_cancel',
'k': 'reject_username.yes_suspend'
}
},
{
title: 'suspenduser.title_notify',
description: 'suspenduser.description_notify',
title: 'reject_username.title_notify',
description: 'reject_username.description_notify',
options: {
'j': 'bandialog.cancel',
'k': 'suspenduser.send'
'k': 'reject_username.send'
}
}
];
class SuspendUserDialog extends Component {
class RejectUsernameDialog extends Component {
state = {email: '', stage: 0}
@@ -35,7 +35,7 @@ class SuspendUserDialog extends Component {
}
componentDidMount() {
this.setState({email: t('suspenduser.email_message_reject'), about: t('suspenduser.username')});
this.setState({email: t('reject_username.email_message_reject'), about: t('reject_username.username')});
}
/*
@@ -72,22 +72,22 @@ class SuspendUserDialog extends Component {
return <Dialog
className={styles.suspendDialog}
id="suspendUserDialog"
id="rejectUsernameDialog"
open={open}
onClose={handleClose}
onCancel={handleClose}
title={t('suspenduser.suspend_user')}>
title={t('reject_username.suspend_user')}>
<div className={styles.title}>
{t(stages[stage].title, t('suspenduser.username'))}
{t(stages[stage].title, t('reject_username.username'))}
</div>
<div className={styles.container}>
<div className={styles.description}>
{t(stages[stage].description, t('suspenduser.username'))}
{t(stages[stage].description, t('reject_username.username'))}
</div>
{
stage === 1 &&
<div className={styles.writeContainer}>
<div className={styles.emailMessage}>{t('suspenduser.write_message')}</div>
<div className={styles.emailMessage}>{t('reject_username.write_message')}</div>
<div className={styles.emailContainer}>
<textarea
rows={5}
@@ -100,7 +100,7 @@ class SuspendUserDialog extends Component {
<div className={styles.modalButtons}>
{Object.keys(stages[stage].options).map((key, i) => (
<Button key={i} onClick={this.onActionClick(stage, i)}>
{t(stages[stage].options[key], t('suspenduser.username'))}
{t(stages[stage].options[key], t('reject_username.username'))}
</Button>
))}
</div>
@@ -109,4 +109,4 @@ class SuspendUserDialog extends Component {
}
}
export default SuspendUserDialog;
export default RejectUsernameDialog;
@@ -2,15 +2,18 @@ import React from 'react';
import styles from './Community.css';
import ActionButton from './ActionButton';
import {username} from 'coral-plugin-flags/helpers/flagReasons';
import ActionsMenu from 'coral-admin/src/components/ActionsMenu';
import ActionsMenuItem from 'coral-admin/src/components/ActionsMenuItem';
import t from 'coral-framework/services/i18n';
const shortReasons = {
'This comment is offensive': t('community.offensive'),
'This looks like an ad/marketing': t('community.spam_ads'),
'This user is impersonating': t('community.impersonating'),
'I don\'t like this username': t('community.dont_like_username'),
'Other': t('community.other')
[username.other]: t('community.other'),
[username.spam]: t('community.spam_ads'),
[username.offensive]: t('community.offensive'),
[username.nolike]: t('community.dont_like_username'),
[username.impersonating]: t('community.impersonating'),
};
// Render a single user for the list
@@ -18,6 +21,16 @@ const User = (props) => {
const {user, modActionButtons} = props;
let userStatus = user.status;
const showSuspenUserDialog = () => props.showSuspendUserDialog({
userId: user.id,
username: user.username,
});
const showBanUserDialog = () => props.showBanUserDialog({
userId: user.id,
username: user.username,
});
// Do not display unless the user status is 'pending' or 'banned'.
// This means that they have already been reviewed and approved.
return (userStatus === 'PENDING' || userStatus === 'BANNED') &&
@@ -28,12 +41,19 @@ const User = (props) => {
<span>
{user.username}
</span>
<ActionButton
className={styles.banButton}
type='BAN'
user={user}
showBanUserDialog={props.showBanUserDialog}
/>
{props.currentUser.id !== user.id &&
<ActionsMenu icon="not_interested">
<ActionsMenuItem
disabled={user.status === 'BANNED'}
onClick={showSuspenUserDialog}>
Suspend User</ActionsMenuItem>
<ActionsMenuItem
disabled={user.status === 'BANNED'}
onClick={showBanUserDialog}>
Ban User
</ActionsMenuItem>
</ActionsMenu>
}
</div>
</div>
@@ -78,11 +98,10 @@ const User = (props) => {
<div className={`actions ${styles.actions}`}>
{modActionButtons.map((action, i) =>
<ActionButton key={i}
type={action.toUpperCase()}
user={user}
approveUser={props.approveUser}
suspendUser={props.suspendUser}
showSuspendUserDialog={props.showSuspendUserDialog}
type={action.toUpperCase()}
user={user}
approveUser={props.approveUser}
showRejectUsernameDialog={props.showRejectUsernameDialog}
/>
)}
</div>
@@ -91,6 +91,7 @@ span {
.moderateAsset {
a {
text-align: center;
-webkit-box-flex: 1;
-ms-flex: 1;
flex: 1;
@@ -103,21 +104,9 @@ span {
opacity: 1;
&:hover {
opacity: .8;
opacity: .8;
cursor: pointer;
}
&:first-child {
text-align: left;
}
&:nth-child(2) {
text-align: center;
}
&:last-child {
text-align: right;
}
}
}
}
@@ -7,14 +7,15 @@ import {Spinner} from 'coral-ui';
import {withSetUserStatus, withRejectUsername} from 'coral-framework/graphql/mutations';
import {showBanUserDialog} from 'actions/banUserDialog';
import {showSuspendUserDialog} from 'actions/suspendUserDialog';
import {
fetchAccounts,
updateSorting,
newPage,
showBanUserDialog,
hideBanUserDialog,
showSuspendUserDialog,
hideSuspendUserDialog
showRejectUsernameDialog,
hideRejectUsernameDialog
} from '../../../actions/community';
import Community from '../components/Community';
@@ -85,16 +86,17 @@ export const withCommunityQuery = withQuery(gql`
});
const mapStateToProps = (state) => ({
community: state.community.toJS()
community: state.community.toJS(),
currentUser: state.auth.toJS().user,
});
const mapDispatchToProps = (dispatch) =>
bindActionCreators({
fetchAccounts,
showBanUserDialog,
hideBanUserDialog,
showSuspendUserDialog,
hideSuspendUserDialog,
showRejectUsernameDialog,
hideRejectUsernameDialog,
updateSorting,
newPage,
}, dispatch);
@@ -136,13 +136,6 @@
resize: none;
}
#bannedWordlist, #suspectWordlist {
display: block;
input {
width: 100%;
}
}
.customCSSInput {
width: 100%;
font-size: 14px;
@@ -1,7 +1,7 @@
import React from 'react';
import {Card} from 'coral-ui';
import styles from './Configure.css';
import TagsInput from 'react-tagsinput';
import TagsInput from 'coral-admin/src/components/TagsInput';
import t from 'coral-framework/services/i18n';
const Domainlist = ({domains, onChangeDomainlist}) => {
@@ -14,8 +14,6 @@ const Domainlist = ({domains, onChangeDomainlist}) => {
<TagsInput
value={domains}
inputProps={{placeholder: 'URL'}}
addOnPaste={true}
pasteSplit={(data) => data.split(',').map((d) => d.trim())}
onChange={(tags) => onChangeDomainlist('whitelist', tags)}
/>
</div>
@@ -165,7 +165,7 @@ const StreamSettings = ({updateSettings, settingsError, settings, errors}) => {
checked={settings.autoCloseStream} />
</div>
<div className={styles.content}>
{t('configure.close_after')}
<div className={styles.settingsHeader}>{t('configure.close_after')}</div>
<br />
<Textfield
type='number'
@@ -1,6 +1,6 @@
import React from 'react';
import t from 'coral-framework/services/i18n';
import TagsInput from 'react-tagsinput';
import TagsInput from 'coral-admin/src/components/TagsInput';
import styles from './Configure.css';
import {Card} from 'coral-ui';
@@ -13,8 +13,6 @@ const Wordlist = ({suspectWords, bannedWords, onChangeWordlist}) => (
<TagsInput
value={bannedWords}
inputProps={{placeholder: 'word or phrase'}}
addOnPaste={true}
pasteSplit={(data) => data.split(',').map((d) => d.trim())}
onChange={(tags) => onChangeWordlist('banned', tags)}
/>
</div>
@@ -26,8 +24,6 @@ const Wordlist = ({suspectWords, bannedWords, onChangeWordlist}) => (
<TagsInput
value={suspectWords}
inputProps={{placeholder: 'word or phrase'}}
addOnPaste={true}
pasteSplit={(data) => data.split(',').map((d) => d.trim())}
onChange={(tags) => onChangeWordlist('suspect', tags)} />
</div>
</Card>
@@ -48,7 +48,7 @@ const InitialStep = (props) => {
label={t('install.create.confirm_password')}
onChange={handleUserChange}
showErrors={install.showErrors}
errorMsg={install.errors.confirm_password}
errorMsg={install.errors.confirmPassword}
/>
{
@@ -1,7 +1,7 @@
import React from 'react';
import styles from './style.css';
import {Button, Card} from 'coral-ui';
import TagsInput from 'react-tagsinput';
import TagsInput from 'coral-admin/src/components/TagsInput';
import t from 'coral-framework/services/i18n';
@@ -16,8 +16,6 @@ const PermittedDomainsStep = (props) => {
<TagsInput
value={domains}
inputProps={{placeholder: 'URL'}}
addOnPaste={true}
pasteSplit={(data) => data.split(',').map((d) => d.trim())}
onChange={(tags) => handleDomainsChange(tags)}
/>
</Card>
@@ -1,52 +0,0 @@
import React, {PropTypes} from 'react';
import {Dialog} from 'coral-ui';
import styles from './BanUserDialog.css';
import Button from 'coral-ui/components/Button';
import t from 'coral-framework/services/i18n';
const onBanClick = (userId, commentId, commentStatus, handleBanUser, rejectComment, handleClose) => (e) => {
e.preventDefault();
handleBanUser({userId})
.then(handleClose)
.then(() => commentStatus === 'REJECTED' ? null : rejectComment({commentId}));
};
const BanUserDialog = ({open, handleClose, handleBanUser, rejectComment, user, commentId, commentStatus, showRejectedNote}) => (
<Dialog
className={styles.dialog}
id="banuserDialog"
open={open}
onClose={handleClose}
onCancel={handleClose}
title={t('bandialog.ban_user')}>
<span className={styles.close} onClick={handleClose}>×</span>
<div>
<div className={styles.header}>
<h2>{t('bandialog.ban_user')}</h2>
</div>
<div className={styles.separator}>
<h3>{t('bandialog.are_you_sure', user.name)}</h3>
<i>{showRejectedNote && t('bandialog.note')}</i>
</div>
<div className={styles.buttons}>
<Button cStyle="cancel" className={styles.cancel} onClick={handleClose} raised>
{t('bandialog.cancel')}
</Button>
<Button cStyle="black" className={styles.ban} onClick={onBanClick(user.id, commentId, commentStatus, handleBanUser, rejectComment, handleClose)} raised>
{t('bandialog.yes_ban_user')}
</Button>
</div>
</div>
</Dialog>
);
BanUserDialog.propTypes = {
handleBanUser: PropTypes.func.isRequired,
handleClose: PropTypes.func.isRequired,
rejectComment: PropTypes.func.isRequired,
commentId: PropTypes.string,
user: PropTypes.object.isRequired,
};
export default BanUserDialog;
@@ -0,0 +1,16 @@
import React from 'react';
import {Button} from 'coral-ui';
import t from 'coral-framework/services/i18n';
import {withCopyToClipboard} from 'coral-framework/hocs';
class ButtonCopyToClipboard extends React.Component {
render () {
return (
<Button {...this.props} >
{t('common.copy')}
</Button>
);
}
}
export default withCopyToClipboard(ButtonCopyToClipboard);
@@ -12,194 +12,239 @@ import {getActionSummary} from 'coral-framework/utils';
import ActionButton from 'coral-admin/src/components/ActionButton';
import ActionsMenu from 'coral-admin/src/components/ActionsMenu';
import ActionsMenuItem from 'coral-admin/src/components/ActionsMenuItem';
import cn from 'classnames';
import {murmur3} from 'murmurhash-js';
import {CSSTransitionGroup} from 'react-transition-group';
const linkify = new Linkify();
import t, {timeago} from 'coral-framework/services/i18n';
const Comment = ({
actions = [],
comment,
viewUserDetail,
suspectWords,
bannedWords,
minimal,
selected,
toggleSelect,
...props
}) => {
const links = linkify.getMatches(comment.body);
const linkText = links ? links.map((link) => link.raw) : [];
const flagActionSummaries = getActionSummary('FlagActionSummary', comment);
const flagActions =
comment.actions &&
comment.actions.filter((a) => a.__typename === 'FlagAction');
let commentType = '';
if (comment.status === 'PREMOD') {
commentType = 'premod';
} else if (flagActions && flagActions.length) {
commentType = 'flagged';
}
class Comment extends React.Component {
// since words are checked against word boundaries on the backend,
// should be the behavior on the front end as well.
// currently the highlighter plugin does not support out of the box.
const searchWords = [...suspectWords, ...bannedWords]
.filter((w) => {
return new RegExp(`(^|\\s)${w}(\\s|$)`).test(comment.body);
})
.concat(linkText);
render() {
const {
actions = [],
comment,
viewUserDetail,
suspectWords,
bannedWords,
minimal,
selected,
toggleSelect,
className,
...props
} = this.props;
let selectionStateCSS;
if (minimal) {
selectionStateCSS = selected ? styles.minimalSelection : '';
} else {
selectionStateCSS = selected ? 'mdl-shadow--16dp' : 'mdl-shadow--2dp';
}
const links = linkify.getMatches(comment.body);
const linkText = links ? links.map((link) => link.raw) : [];
const flagActionSummaries = getActionSummary('FlagActionSummary', comment);
const flagActions =
comment.actions &&
comment.actions.filter((a) => a.__typename === 'FlagAction');
let commentType = '';
if (comment.status === 'PREMOD') {
commentType = 'premod';
} else if (flagActions && flagActions.length) {
commentType = 'flagged';
}
return (
<li
tabIndex={props.index}
className={`mdl-card ${selectionStateCSS} ${styles.Comment} ${styles.listItem} ${minimal ? styles.minimal : ''}`}
>
<div className={styles.container}>
<div className={styles.itemHeader}>
<div className={styles.author}>
{
!minimal && (
<span className={styles.username} onClick={() => viewUserDetail(comment.user.id)}>
{comment.user.name}
</span>
)
}
{
minimal && typeof selected === 'boolean' && typeof toggleSelect === 'function' && (
<input
className={styles.bulkSelectInput}
type='checkbox'
value={comment.id}
checked={selected}
onChange={(e) => toggleSelect(e.target.value, e.target.checked)} />
)
}
<span className={styles.created}>
{timeago(comment.created_at || Date.now() - props.index * 60 * 1000)}
</span>
{props.currentUserId !== comment.user.id &&
<ActionsMenu icon="not_interested">
<ActionsMenuItem
disabled={comment.user.status === 'BANNED'}
onClick={() => props.showSuspendUserDialog(comment.user.id, comment.user.name, comment.id, comment.status)}>
Suspend User</ActionsMenuItem>
<ActionsMenuItem
disabled={comment.user.status === 'BANNED'}
onClick={() => props.showBanUserDialog(comment.user, comment.id, comment.status, comment.status !== 'REJECTED')}>
Ban User
</ActionsMenuItem>
</ActionsMenu>
}
<CommentType type={commentType} />
</div>
{comment.user.status === 'banned'
? <span className={styles.banned}>
<Icon name="error_outline" />
{t('comment.banned_user')}
// since words are checked against word boundaries on the backend,
// should be the behavior on the front end as well.
// currently the highlighter plugin does not support out of the box.
const searchWords = [...suspectWords, ...bannedWords]
.filter((w) => {
return new RegExp(`(^|\\s)${w}(\\s|$)`, 'i').test(comment.body);
})
.concat(linkText);
let selectionStateCSS;
if (minimal) {
selectionStateCSS = selected ? styles.minimalSelection : '';
} else {
selectionStateCSS = selected ? 'mdl-shadow--16dp' : 'mdl-shadow--2dp';
}
const showSuspenUserDialog = () => props.showSuspendUserDialog({
userId: comment.user.id,
username: comment.user.username,
commentId: comment.id,
commentStatus: comment.status,
});
const showBanUserDialog = () => props.showBanUserDialog({
userId: comment.user.id,
username: comment.user.username,
commentId: comment.id,
commentStatus: comment.status,
});
return (
<li
tabIndex={props.index}
className={cn(className, 'mdl-card', selectionStateCSS, styles.Comment, styles.listItem, {[styles.minimal]: minimal, [styles.selected]: selected})}
>
<div className={styles.container}>
<div className={styles.itemHeader}>
<div className={styles.author}>
{
!minimal && (
<span className={styles.username} onClick={() => viewUserDetail(comment.user.id)}>
{comment.user.username}
</span>
)
}
{
minimal && typeof selected === 'boolean' && typeof toggleSelect === 'function' && (
<input
className={styles.bulkSelectInput}
type='checkbox'
value={comment.id}
checked={selected}
onChange={(e) => toggleSelect(e.target.value, e.target.checked)} />
)
}
<span className={styles.created}>
{timeago(comment.created_at || Date.now() - props.index * 60 * 1000)}
</span>
: null}
<Slot
data={props.data}
root={props.root}
fill="adminCommentInfoBar"
comment={comment}
/>
</div>
<div className={styles.moderateArticle}>
Story: {comment.asset.title}
{!props.currentAsset &&
<Link to={`/admin/moderate/${comment.asset.id}`}>{t('modqueue.moderate')}</Link>}
</div>
<div className={styles.itemBody}>
<p className={styles.body}>
<Highlighter
searchWords={searchWords}
textToHighlight={comment.body}
/>
{' '}
<a
className={styles.external}
href={`${comment.asset.url}#${comment.id}`}
target="_blank"
>
<Icon name="open_in_new" /> {t('comment.view_context')}
</a>
</p>
<Slot
data={props.data}
root={props.root}
fill="adminCommentContent"
comment={comment}
/>
<div className={styles.sideActions}>
{links
? <span className={styles.hasLinks}>
<Icon name="error_outline" /> Contains Link
{
(comment.editing && comment.editing.edited)
? <span>&nbsp;<span className={styles.editedMarker}>({t('comment.edited')})</span></span>
: null
}
{props.currentUserId !== comment.user.id &&
<ActionsMenu icon="not_interested">
<ActionsMenuItem
disabled={comment.user.status === 'BANNED'}
onClick={showSuspenUserDialog}>
Suspend User</ActionsMenuItem>
<ActionsMenuItem
disabled={comment.user.status === 'BANNED'}
onClick={showBanUserDialog}>
Ban User
</ActionsMenuItem>
</ActionsMenu>
}
<CommentType type={commentType} />
</div>
{comment.user.status === 'banned'
? <span className={styles.banned}>
<Icon name="error_outline" />
{t('comment.banned_user')}
</span>
: null}
<div className={`actions ${styles.actions}`}>
{actions.map((action, i) => {
const active =
(action === 'REJECT' && comment.status === 'REJECTED') ||
(action === 'APPROVE' && comment.status === 'ACCEPTED');
return (
<ActionButton
minimal={minimal}
key={i}
type={action}
user={comment.user}
status={comment.status}
active={active}
acceptComment={() =>
(comment.status === 'ACCEPTED'
? null
: props.acceptComment({commentId: comment.id}))}
rejectComment={() =>
(comment.status === 'REJECTED'
? null
: props.rejectComment({commentId: comment.id}))}
/>
);
})}
</div>
<Slot
data={props.data}
root={props.root}
fill="adminSideActions"
comment={comment}
/>
<Slot
data={props.data}
root={props.root}
fill="adminCommentInfoBar"
comment={comment}
/>
</div>
<div className={styles.moderateArticle}>
Story: {comment.asset.title}
{!props.currentAsset &&
<Link to={`/admin/moderate/all/${comment.asset.id}`}>{t('modqueue.moderate')}</Link>}
</div>
<CSSTransitionGroup
component={'div'}
style={{position: 'relative'}}
transitionName={{
enter: styles.bodyEnter,
enterActive: styles.bodyEnterActive,
leave: styles.bodyLeave,
leaveActive: styles.bodyLeaveActive,
}}
transitionEnter={true}
transitionLeave={true}
transitionEnterTimeout={3600}
transitionLeaveTimeout={2800}
>
<div className={styles.itemBody} key={murmur3(comment.body)}>
<p className={styles.body}>
<Highlighter
searchWords={searchWords}
textToHighlight={comment.body}
/>
{' '}
<a
className={styles.external}
href={`${comment.asset.url}?commentId=${comment.id}`}
target="_blank"
>
<Icon name="open_in_new" /> {t('comment.view_context')}
</a>
</p>
<Slot
data={props.data}
root={props.root}
fill="adminCommentContent"
comment={comment}
/>
<div className={styles.sideActions}>
{links
? <span className={styles.hasLinks}>
<Icon name="error_outline" /> Contains Link
</span>
: null}
<div className={`actions ${styles.actions}`}>
{actions.map((action, i) => {
const active =
(action === 'REJECT' && comment.status === 'REJECTED') ||
(action === 'APPROVE' && comment.status === 'ACCEPTED');
return (
<ActionButton
minimal={minimal}
key={i}
type={action}
user={comment.user}
status={comment.status}
active={active}
acceptComment={() =>
(comment.status === 'ACCEPTED'
? null
: props.acceptComment({commentId: comment.id}))}
rejectComment={() =>
(comment.status === 'REJECTED'
? null
: props.rejectComment({commentId: comment.id}))}
/>
);
})}
</div>
<Slot
data={props.data}
root={props.root}
fill="adminSideActions"
comment={comment}
/>
</div>
</div>
</CSSTransitionGroup>
</div>
</div>
<Slot
data={props.data}
root={props.root}
fill="adminCommentDetailArea"
comment={comment}
/>
{flagActions && flagActions.length
? <FlagBox
actions={flagActions}
actionSummaries={flagActionSummaries}
/>
: null}
</li>
);
};
<Slot
data={props.data}
root={props.root}
fill="adminCommentDetailArea"
comment={comment}
/>
{flagActions && flagActions.length
? <FlagBox
actions={flagActions}
actionSummaries={flagActionSummaries}
viewUserDetail={() => viewUserDetail(comment.user.id)}
/>
: null}
</li>
);
}
}
Comment.propTypes = {
minimal: PropTypes.bool,
viewUserDetail: PropTypes.func.isRequired,
acceptComment: PropTypes.func.isRequired,
rejectComment: PropTypes.func.isRequired,
className: PropTypes.string,
suspectWords: PropTypes.arrayOf(PropTypes.string).isRequired,
bannedWords: PropTypes.arrayOf(PropTypes.string).isRequired,
currentAsset: PropTypes.object,
@@ -67,3 +67,17 @@
color: black;
}
}
.username {
color: #393B44;
text-decoration: none;
cursor: pointer;
font-weight: 600;
padding: 2px 5px;
border-radius: 2px;
margin-left: -5px;
transition: background-color 200ms ease;
&:hover {
background-color: #E0E0E0;
}
}
@@ -33,7 +33,7 @@ class FlagBox extends Component {
}
render() {
const {actionSummaries, actions} = this.props;
const {actionSummaries, actions, viewUserDetail} = this.props;
const {showDetail} = this.state;
return (
@@ -59,9 +59,14 @@ class FlagBox extends Component {
<li key={i}>
{this.reasonMap(summary.reason)} (<strong>{summary.count}</strong>)
<ul>
{
actionList.map((action, j) => <li key={`${i}_${j}`} className={styles.subDetail}><span>{action.user.username}</span> {action.message}</li>)
}
{actionList.map((action, j) =>
<li key={`${i}_${j}`} className={styles.subDetail}>
<a className={styles.username} onClick={viewUserDetail}>
{action.user.username}
</a>
{action.message}
</li>
)}
</ul>
</li>
);
@@ -2,18 +2,21 @@ import React, {Component} from 'react';
import key from 'keymaster';
import styles from './styles.css';
import BanUserDialog from './BanUserDialog';
import SuspendUserDialog from './SuspendUserDialog';
import ModerationQueue from './ModerationQueue';
import ModerationMenu from './ModerationMenu';
import ModerationHeader from './ModerationHeader';
import NotFoundAsset from './NotFoundAsset';
import ModerationKeysModal from '../../../components/ModerationKeysModal';
import UserDetail from '../containers/UserDetail';
import StorySearch from '../containers/StorySearch';
export default class Moderation extends Component {
state = {
selectedIndex: 0,
constructor() {
super();
this.state = {
selectedIndex: 0
};
}
componentWillMount() {
@@ -24,12 +27,21 @@ export default class Moderation extends Component {
key('esc', () => toggleModal(false));
key('j', this.select(true));
key('k', this.select(false));
key('r', this.moderate(false));
key('t', this.moderate(true));
key('f', this.moderate(false));
key('d', this.moderate(true));
}
onClose = () => {
this.toggleModal(false);
this.props.toggleModal(false);
}
closeSearch = () => {
const {toggleStorySearch} = this.props;
toggleStorySearch(false);
}
openSearch = () => {
this.props.toggleStorySearch(true);
}
moderate = (accept) => () => {
@@ -49,24 +61,22 @@ export default class Moderation extends Component {
getComments = () => {
const {root, route} = this.props;
const activeTab = route.path === ':id' ? 'premod' : route.path;
return root[activeTab];
return root[activeTab].nodes;
}
select = (next) => () => {
if (next) {
this.setState((prevState) =>
({
...prevState,
selectedIndex: prevState.selectedIndex < this.getComments().length - 1
? prevState.selectedIndex + 1 : prevState.selectedIndex
}));
this.setState((state) => ({
...state,
selectedIndex: state.selectedIndex < this.getComments().length - 1
? state.selectedIndex + 1 : state.selectedIndex
}));
} else {
this.setState((prevState) =>
({
...prevState,
selectedIndex: prevState.selectedIndex > 0 ?
prevState.selectedIndex - 1 : prevState.selectedIndex
}));
this.setState((state) => ({
...state,
selectedIndex: state.selectedIndex > 0
? state.selectedIndex - 1 : state.selectedIndex
}));
}
}
@@ -76,8 +86,8 @@ export default class Moderation extends Component {
key.unbind('esc');
key.unbind('j');
key.unbind('k');
key.unbind('r');
key.unbind('t');
key.unbind('f');
key.unbind('d');
}
componentDidUpdate(_, prevState) {
@@ -92,19 +102,10 @@ export default class Moderation extends Component {
}
render () {
const {root, moderation, settings, assets, viewUserDetail, hideUserDetail, ...props} = this.props;
const providedAssetId = this.props.params.id;
const activeTab = this.props.route.path === ':id' ? 'premod' : this.props.route.path;
let asset;
if (providedAssetId) {
asset = assets.find((asset) => asset.id === this.props.params.id);
if (!asset) {
return <NotFoundAsset assetId={providedAssetId} />;
}
}
const {root, moderation, settings, viewUserDetail, hideUserDetail, activeTab, ...props} = this.props;
const assetId = this.props.params.id;
const {asset} = root;
const comments = root[activeTab];
let activeTabCount;
@@ -128,7 +129,12 @@ export default class Moderation extends Component {
return (
<div>
<ModerationHeader asset={asset} />
<ModerationHeader
searchVisible={this.props.moderation.storySearchVisible}
openSearch={this.openSearch}
closeSearch={this.closeSearch}
asset={asset}
/>
<ModerationMenu
asset={asset}
allCount={root.allCount}
@@ -154,36 +160,19 @@ export default class Moderation extends Component {
acceptComment={props.acceptComment}
rejectComment={props.rejectComment}
loadMore={props.loadMore}
assetId={providedAssetId}
assetId={assetId}
sort={this.props.moderation.sortOrder}
commentCount={activeTabCount}
currentUserId={this.props.auth.user.id}
viewUserDetail={viewUserDetail}
hideUserDetail={hideUserDetail}
/>
<BanUserDialog
open={moderation.banDialog}
user={moderation.user}
commentId={moderation.commentId}
commentStatus={moderation.commentStatus}
handleClose={props.hideBanUserDialog}
handleBanUser={props.banUser}
showRejectedNote={moderation.showRejectedNote}
rejectComment={props.rejectComment}
/>
<SuspendUserDialog
open={moderation.suspendUserDialog.show}
username={moderation.suspendUserDialog.username}
userId={moderation.suspendUserDialog.userId}
organizationName={root.settings.organizationName}
onCancel={props.hideSuspendUserDialog}
onPerform={this.props.suspendUser}
/>
<ModerationKeysModal
hideShortcutsNote={props.hideShortcutsNote}
shortcutsNoteVisible={moderation.shortcutsNoteVisible}
open={moderation.modalOpen}
onClose={this.onClose}/>
{moderation.userDetailId && (
<UserDetail
id={moderation.userDetailId}
@@ -195,6 +184,13 @@ export default class Moderation extends Component {
acceptComment={props.acceptComment}
rejectComment={props.rejectComment} />
)}
<StorySearch
assetId={assetId}
moderation={this.props.moderation}
closeSearch={this.closeSearch}
storySearchChange={this.props.storySearchChange}
/>
</div>
);
}
@@ -1,30 +1,35 @@
import React from 'react';
import {Link} from 'react-router';
import React, {PropTypes} from 'react';
import {Icon} from 'coral-ui';
import styles from './styles.css';
import t from 'coral-framework/services/i18n';
const ModerationHeader = (props) => (
const ModerationHeader = ({asset, searchVisible, openSearch, closeSearch}) => {
const trigger = searchVisible ? closeSearch : openSearch;
const searchTriggerIcon = <Icon className={styles.searchTrigger} name={searchVisible ? 'arrow_drop_up' : 'arrow_drop_down'} />;
const title = asset
? <a onClick={trigger} className="mdl-tabs__tab">{asset.title} {searchTriggerIcon}</a>
: <a onClick={trigger} className="mdl-tabs__tab">{t('modqueue.all_streams')} {searchTriggerIcon}</a>;
return (
<div className=''>
<div className={`mdl-tabs ${styles.header}`}>
{
props.asset ?
<div className={`mdl-tabs__tab-bar ${styles.moderateAsset}`}>
<Link className="mdl-tabs__tab" to="/admin/moderate">{t('modqueue.all_streams')}</Link>
<a className="mdl-tabs__tab" href={props.asset.url} target="_blank">
<span>{props.asset.title}</span>
<Icon className={styles.settingsButton} name="open_in_new"/>
</a>
<Link className="mdl-tabs__tab" to="/admin/stories">Select Stream</Link>
</div>
:
<div className={`mdl-tabs__tab-bar ${styles.moderateAsset}`}>
<a className="mdl-tabs__tab" />
<a className="mdl-tabs__tab">{t('modqueue.all_streams')}</a>
<Link className="mdl-tabs__tab" to="/admin/stories">{t('modqueue.select_stream')}</Link>
</div>
}
<div className={`mdl-tabs__tab-bar ${styles.moderateAsset}`}>
{title}
</div>
</div>
</div>
);
);
};
ModerationHeader.propTypes = {
asset: PropTypes.shape({
title: PropTypes.string,
id: PropTypes.string
}),
openSearch: PropTypes.func.isRequired,
closeSearch: PropTypes.func.isRequired
};
export default ModerationHeader;
@@ -6,8 +6,10 @@ import EmptyCard from '../../../components/EmptyCard';
import {actionsMap} from '../helpers/moderationQueueActionsMap';
import LoadMore from './LoadMore';
import t from 'coral-framework/services/i18n';
import {CSSTransitionGroup} from 'react-transition-group';
class ModerationQueue extends React.Component {
isLoadingMore = false;
static propTypes = {
viewUserDetail: PropTypes.func.isRequired,
@@ -22,7 +24,19 @@ class ModerationQueue extends React.Component {
}
loadMore = () => {
this.props.loadMore(this.props.activeTab);
if (!this.isLoadingMore) {
this.isLoadingMore = true;
this.props.loadMore(this.props.activeTab)
.then(() => this.isLoadingMore = false)
.catch((e) => {
this.isLoadingMore = false;
throw e;
});
}
}
constructor(props) {
super(props);
}
componentDidUpdate (prev) {
@@ -43,20 +57,34 @@ class ModerationQueue extends React.Component {
commentCount,
singleView,
viewUserDetail,
activeTab,
...props
} = this.props;
return (
<div id="moderationList" className={`${styles.list} ${singleView ? styles.singleView : ''}`}>
<ul style={{paddingLeft: 0}}>
<CSSTransitionGroup
key={activeTab}
component={'ul'}
style={{paddingLeft: 0}}
transitionName={{
enter: styles.commentEnter,
enterActive: styles.commentEnterActive,
leave: styles.commentLeave,
leaveActive: styles.commentLeaveActive,
}}
transitionEnter={true}
transitionLeave={true}
transitionEnterTimeout={1000}
transitionLeaveTimeout={1000}
>
{
comments.length
? comments.map((comment, i) => {
comments.map((comment, i) => {
const status = comment.action_summaries ? 'FLAGGED' : comment.status;
return <Comment
data={this.props.data}
root={this.props.root}
key={i}
key={comment.id}
index={i}
comment={comment}
selected={i === selectedIndex}
@@ -72,9 +100,14 @@ class ModerationQueue extends React.Component {
currentUserId={this.props.currentUserId}
/>;
})
: <EmptyCard>{t('modqueue.empty_queue')}</EmptyCard>
}
</ul>
</CSSTransitionGroup>
{comments.length === 0 &&
<div className={styles.emptyCardContainer}>
<EmptyCard>{t('modqueue.empty_queue')}</EmptyCard>
</div>
}
<LoadMore
loadMore={this.loadMore}
showLoadMore={comments.length < commentCount}
@@ -0,0 +1,30 @@
import React, {PropTypes} from 'react';
import styles from './StorySearch.css';
const formatDate = (date) => {
const d = new Date(date);
return `${d.getMonth() + 1}/${d.getDate()}/${d.getFullYear()}`;
};
const Story = ({author, title, createdAt, open, id, goToStory}) => {
return (
<li className={styles.story} onClick={() => goToStory(id)}>
<span className={styles.title}>{title}</span>
<div className={styles.meta}>
<span className={styles.author}>By {author}</span>
<span className={styles.createdAt}>{formatDate(createdAt)}</span>
<span className={styles.status}>{open ? 'Open' : 'Closed'}</span>
</div>
</li>
);
};
Story.propTypes = {
id: PropTypes.string.isRequired,
author: PropTypes.string.isRequired,
title: PropTypes.string.isRequired,
createdAt: PropTypes.string.isRequired,
open: PropTypes.bool.isRequired
};
export default Story;
@@ -0,0 +1,147 @@
.overlay {
position: absolute;
top: 58px;
left: 0;
right: 0;
bottom: 0;
width: 100%;
z-index: 99;
opacity: 0;
}
.container {
position: absolute;
background-color: white;
top: 106px;
left: 0;
right: 0;
margin-left: auto;
margin-right: auto;
width: 50%;
box-shadow: 0px 3px 5px 0px rgba(0,0,0,0.15);
z-index: 100;
max-width: 820px;
}
.positionShim {
left: -50%;
}
.headInput {
background-color: #efefef;
padding: 10px 27px;
box-sizing: border-box;
}
.searchInput {
width: calc(100% - 100px);
padding: 8px;
height: 100%;
font-size: 16px;
margin-right: 5px;
position: relative;
top: 3px;
box-sizing: border-box;
border-radius: 3px;
border: solid 1px #dfdfdf;
max-height: 45px;
max-width: 600px;
font-weight: 300;
}
.cta > a {
display: inline-block;
cursor: pointer;
color: #000;
text-decoration: none;
font-weight: bold;
font-size: 15px;
margin: 0;
box-sizing: border-box;
font-size: 15px;
font-weight: 500;
padding: 12px 30px;
letter-spacing: 0.25px;
}
/*.storyList {
border-top: 1px solid #ddd;
}*/
.story {
padding: 7px 50px;
border-bottom: 1px solid #ddd;
cursor: pointer;
display: block;
text-decoration: none;
height: 50px;
box-sizing: border-box;
transition: background-color 400ms;
&:hover {
background-color: #efefef;
}
&:last-child {
border-bottom: none;
}
}
.title, .meta {
margin: 0;
color: black;
font-size: 15px;
}
.author, .createdAt, .status {
font-size: 17px;
display: inline-block;
font-size: .8em;
}
.createdAt {
text-align: center;
}
.author {
display: inline-block;
width: 200px;
color: #aaa;
}
.createdAt {
display: inline-block;
width: 200px;
color: #aaa;
}
.searchButton {
width: 90px;
height: 35px;
}
.searchResults {
padding: 7px 27px;
background: #F5F5F5;
}
.searchResults i {
font-size: 16px;
vertical-align: middle;
}
.accessStories {
font-size: 18px;
}
.headlineRecent {
font-size: 15px;
font-weight: 500;
letter-spacing: 0.25px;
vertical-align: middle;
margin-left: 8px;
}
.noResults {
padding: 10px 24px 15px 49px;
}
@@ -0,0 +1,98 @@
import React from 'react';
import PropTypes from 'prop-types';
import styles from './StorySearch.css';
import {Button, Spinner, Icon} from 'coral-ui';
import Story from './Story';
const StorySearch = (props) => {
const {
root: {
assets = []
},
data: {loading}
} = props;
if (!props.moderation.storySearchVisible) {
return null;
}
return (
<div>
<div className={styles.container} role='alertdialog' onKeyDown={props.handleEsc}>
<div className={styles.positionShim}>
<div className={styles.headInput}>
<input
className={styles.searchInput}
onChange={props.handleSearchChange}
onKeyDown={props.handleEnter}
value={props.searchValue}
autoFocus
/>
<Button
cStyle='blue'
className={styles.searchButton}
onClick={props.search}
raised >
Search
</Button>
</div>
<div className={styles.results}>
{props.assetId &&
<div className={styles.cta}>
<a onClick={props.goToModerateAll}>Moderate comments on All Stories</a>
</div>
}
<div className={styles.storyList}>
{
props.moderation.storySearchString ? (
<div className={styles.searchResults}>
<Icon name="search" />
<span className={styles.headlineRecent}>Search Results</span>
</div>
) : (
<div className={styles.searchResults}>
<Icon name="access_time" />
<span className={styles.headlineRecent}>Most Recent Stories</span>
</div>
)
}
{
loading
? <Spinner />
: assets.map((story, i) => {
const storyOpen = story.closedAt === null || new Date(story.closedAt) > new Date();
return <Story
key={i}
id={story.id}
title={story.title}
createdAt={new Date(story.created_at).toISOString()}
open={storyOpen}
author={story.author}
goToStory={props.goToStory}
/>;
})
}
{assets.length === 0 && <div className={styles.noResults}>No results</div>}
</div>
</div>
</div>
</div>
<div className={styles.overlay} onClick={props.clearAndCloseSearch} />
</div>
);
};
StorySearch.propTypes = {
search: PropTypes.func.isRequired,
goToStory: PropTypes.func.isRequired,
clearAndCloseSearch: PropTypes.func.isRequired,
moderation: PropTypes.object.isRequired,
handleSearchChange: PropTypes.func.isRequired,
assetId: PropTypes.string
};
export default StorySearch;
@@ -35,9 +35,8 @@
border: none;
background-color: transparent;
font-size: 16px;
position: absolute;
width: 90%;
outline: none;
width: calc(100% - 90px);
}
.commentStatuses {
@@ -1,11 +1,14 @@
import React, {PropTypes} from 'react';
import {Button, Drawer} from 'coral-ui';
import styles from './UserDetail.css';
import Slot from 'coral-framework/components/Slot';
import Comment from './Comment';
import styles from './UserDetail.css';
import {Button, Drawer} from 'coral-ui';
import {Slot} from 'coral-framework/components';
import ButtonCopyToClipboard from './ButtonCopyToClipboard';
import {actionsMap} from '../helpers/moderationQueueActionsMap';
import ClickOutside from 'coral-framework/components/ClickOutside';
export default class UserDetail extends React.Component {
static propTypes = {
id: PropTypes.string.isRequired,
hideUserDetail: PropTypes.func.isRequired,
@@ -22,16 +25,6 @@ export default class UserDetail extends React.Component {
bulkReject: PropTypes.func.isRequired,
}
copyPermalink = () => {
this.profile.select();
try {
document.execCommand('copy');
} catch (e) {
/* nothing */
}
}
rejectThenReload = (info) => {
this.props.rejectComment(info).then(() => {
this.props.data.refetch();
@@ -88,86 +81,92 @@ export default class UserDetail extends React.Component {
}
return (
<Drawer handleClickOutside={hideUserDetail}>
<h3>{user.username}</h3>
<Button className={styles.copyButton} onClick={this.copyPermalink}>Copy</Button>
{profile && <input className={styles.profileEmail} readOnly type="text" ref={(ref) => this.profile = ref} value={profile} />}
<Slot
fill="userProfile"
data={this.props.data}
root={this.props.root}
user={user}
/>
<p className={styles.memberSince}><strong>Member since</strong> {new Date(user.created_at).toLocaleString()}</p>
<hr/>
<p>
<strong>Account summary</strong>
<br/><small className={styles.small}>Data represents the last six months of activity</small>
</p>
<div className={styles.stats}>
<div className={styles.stat}>
<p>Total Comments</p>
<p>{totalComments}</p>
</div>
<div className={styles.stat}>
<p>Reject Rate</p>
<p>{`${(rejectedPercent).toFixed(1)}%`}</p>
</div>
</div>
{
selectedIds.length === 0
? (
<ul className={styles.commentStatuses}>
<li className={tab === 'all' ? styles.active : ''} onClick={this.showAll}>All</li>
<li className={tab === 'rejected' ? styles.active : ''} onClick={this.showRejected}>Rejected</li>
</ul>
)
: (
<div className={styles.bulkActionGroup}>
<Button
onClick={bulkAccept}
className={styles.bulkAction}
cStyle='approve'
icon='done'>
</Button>
<Button
onClick={bulkReject}
className={styles.bulkAction}
cStyle='reject'
icon='close'>
</Button>
{`${selectedIds.length} comments selected`}
</div>
)
}
<ClickOutside onClickOutside={hideUserDetail}>
<Drawer onClose={hideUserDetail}>
<h3>{user.username}</h3>
<div>
<div>
{profile && <input className={styles.profileEmail} readOnly type="text" ref={(ref) => this.profile = ref} value={profile} />}
<ButtonCopyToClipboard className={styles.copyButton} copyText={profile} />
</div>
<Slot
fill="userProfile"
data={this.props.data}
root={this.props.root}
user={user}
/>
<p className={styles.memberSince}><strong>Member since</strong> {new Date(user.created_at).toLocaleString()}</p>
<hr/>
<p>
<strong>Account summary</strong>
<br/><small className={styles.small}>Data represents the last six months of activity</small>
</p>
<div className={styles.stats}>
<div className={styles.stat}>
<p>Total Comments</p>
<p>{totalComments}</p>
</div>
<div className={styles.stat}>
<p>Reject Rate</p>
<p>{`${(rejectedPercent).toFixed(1)}%`}</p>
</div>
</div>
{
nodes.map((comment, i) => {
const status = comment.action_summaries ? 'FLAGGED' : comment.status;
const selected = selectedIds.indexOf(comment.id) !== -1;
return <Comment
key={i}
index={i}
comment={comment}
selected={false}
suspectWords={suspectWords}
bannedWords={bannedWords}
viewUserDetail={() => {}}
actions={actionsMap[status]}
showBanUserDialog={showBanUserDialog}
showSuspendUserDialog={showSuspendUserDialog}
acceptComment={this.acceptThenReload}
rejectComment={this.rejectThenReload}
selected={selected}
toggleSelect={toggleSelect}
currentAsset={null}
currentUserId={this.props.id}
minimal={true} />;
})
selectedIds.length === 0
? (
<ul className={styles.commentStatuses}>
<li className={tab === 'all' ? styles.active : ''} onClick={this.showAll}>All</li>
<li className={tab === 'rejected' ? styles.active : ''} onClick={this.showRejected}>Rejected</li>
</ul>
)
: (
<div className={styles.bulkActionGroup}>
<Button
onClick={bulkAccept}
className={styles.bulkAction}
cStyle='approve'
icon='done'>
</Button>
<Button
onClick={bulkReject}
className={styles.bulkAction}
cStyle='reject'
icon='close'>
</Button>
{`${selectedIds.length} comments selected`}
</div>
)
}
</div>
</Drawer>
<div>
{
nodes.map((comment, i) => {
const status = comment.action_summaries ? 'FLAGGED' : comment.status;
const selected = selectedIds.indexOf(comment.id) !== -1;
return <Comment
key={comment.id}
index={i}
comment={comment}
selected={false}
suspectWords={suspectWords}
bannedWords={bannedWords}
viewUserDetail={() => {}}
actions={actionsMap[status]}
showBanUserDialog={showBanUserDialog}
showSuspendUserDialog={showSuspendUserDialog}
acceptComment={this.acceptThenReload}
rejectComment={this.rejectThenReload}
selected={selected}
toggleSelect={toggleSelect}
currentAsset={null}
currentUserId={this.props.id}
minimal={true} />;
})
}
</div>
</Drawer>
</ClickOutside>
);
}
}
@@ -116,29 +116,20 @@ span {
transition: background-color 200ms;
opacity: 1;
&:first-child {
text-align: left;
&:hover {
cursor: pointer;
background-color: #212121;
}
span {
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 344px;
display: inline-block;
vertical-align: top;
}
&:nth-child(2) {
&:hover {
cursor: pointer;
background-color: #212121;
}
span {
text-align: center;
text-overflow: ellipsis;
white-space: nowrap;
overflow: hidden;
max-width: 344px;
display: inline-block;
vertical-align: top;
}
}
&:last-child {
text-align: right;
}
}
}
}
@@ -199,8 +190,6 @@ span {
}
&.selected {
max-width: 720px;
max-height: 410px;
}
.context {
@@ -479,3 +468,63 @@ span {
.bulkSelectInput {
cursor: pointer;
}
.emptyCardContainer {
margin-top: 16px;
}
.commentLeave {
opacity: 1.0;
transition: opacity 800ms;
}
.commentLeaveActive {
opacity: 0;
}
.commentEnter {
opacity: 0;
transition: opacity 800ms;
}
.commentEnterActive {
opacity: 1.0;
}
.bodyLeave {
position: absolute;
width: 100%;
top: 0;
background-color: white;
opacity: 1.0;
transition: background 400ms, opacity 800ms 1600ms;
pointer-events: none;
}
.bodyLeaveActive {
opacity: 0;
background-color: rgba(255,255,0, 0.2);
}
.bodyEnter {
opacity: 0;
pointer-events: none;
}
.bodyEnterActive {
opacity: 1.0;
transition: opacity 800ms 2400ms;
}
.editedMarker {
font-style: italic;
color: #666;
font-size: 12px;
line-height: 1px;
font-weight: 300;
}
.searchTrigger {
position: relative;
top: .3em;
}
@@ -26,7 +26,7 @@ export default withFragments({
status
user {
id
name: username
username
status
}
asset {
@@ -49,6 +49,9 @@ export default withFragments({
}
}
}
editing {
edited
}
${pluginFragments.spreads('comment')}
}
${pluginFragments.definitions('comment')}
@@ -2,75 +2,137 @@ import React, {Component} from 'react';
import {connect} from 'react-redux';
import {bindActionCreators} from 'redux';
import {compose, gql} from 'react-apollo';
import isEqual from 'lodash/isEqual';
import withQuery from 'coral-framework/hocs/withQuery';
import {getDefinitionName} from 'coral-framework/utils';
import * as notification from 'coral-admin/src/services/notification';
import t, {timeago} from 'coral-framework/services/i18n';
import t from 'coral-framework/services/i18n';
import update from 'immutability-helper';
import truncate from 'lodash/truncate';
import NotFoundAsset from '../components/NotFoundAsset';
import {withSetUserStatus, withSuspendUser, withSetCommentStatus} from 'coral-framework/graphql/mutations';
import {withSetCommentStatus} from 'coral-framework/graphql/mutations';
import {handleCommentChange} from '../../../graphql/utils';
import {fetchSettings} from 'actions/settings';
import {updateAssets} from 'actions/assets';
import {showBanUserDialog} from 'actions/banUserDialog';
import {showSuspendUserDialog} from 'actions/suspendUserDialog';
import {
toggleModal,
singleView,
showBanUserDialog,
hideBanUserDialog,
showSuspendUserDialog,
hideSuspendUserDialog,
hideShortcutsNote,
toggleStorySearch,
viewUserDetail,
hideUserDetail,
setSortOrder,
storySearchChange,
clearState
} from 'actions/moderation';
import {Spinner} from 'coral-ui';
import Moderation from '../components/Moderation';
import Comment from './Comment';
function prepareNotificationText(text) {
return truncate(text, {length: 50}).replace('\n', ' ');
}
class ModerationContainer extends Component {
subscriptions = [];
get activeTab() { return this.props.route.path; }
subscribeToUpdates(variables = this.props.data.variables) {
const sub1 = this.props.data.subscribeToMore({
document: COMMENT_ACCEPTED_SUBSCRIPTION,
variables,
updateQuery: (prev, {subscriptionData: {data: {commentAccepted: comment}}}) => {
const user = comment.status_history[comment.status_history.length - 1].assigned_by;
const sort = this.props.moderation.sortOrder;
const notify = this.props.auth.user.id === user.id
? {}
: {
activeQueue: this.activeTab,
text: t('modqueue.notify_accepted', user.username, prepareNotificationText(comment.body)),
anyQueue: false,
};
return handleCommentChange(prev, comment, sort, notify);
},
});
const sub2 = this.props.data.subscribeToMore({
document: COMMENT_REJECTED_SUBSCRIPTION,
variables,
updateQuery: (prev, {subscriptionData: {data: {commentRejected: comment}}}) => {
const user = comment.status_history[comment.status_history.length - 1].assigned_by;
const sort = this.props.moderation.sortOrder;
const notify = this.props.auth.user.id === user.id
? {}
: {
activeQueue: this.activeTab,
text: t('modqueue.notify_rejected', user.username, prepareNotificationText(comment.body)),
anyQueue: false,
};
return handleCommentChange(prev, comment, sort, notify);
},
});
const sub3 = this.props.data.subscribeToMore({
document: COMMENT_EDITED_SUBSCRIPTION,
variables,
updateQuery: (prev, {subscriptionData: {data: {commentEdited: comment}}}) => {
const sort = this.props.moderation.sortOrder;
const notify = {
activeQueue: this.activeTab,
text: t('modqueue.notify_edited', comment.user.username, prepareNotificationText(comment.body)),
anyQueue: false,
};
return handleCommentChange(prev, comment, sort, notify);
},
});
const sub4 = this.props.data.subscribeToMore({
document: COMMENT_FLAGGED_SUBSCRIPTION,
variables,
updateQuery: (prev, {subscriptionData: {data: {commentFlagged: comment}}}) => {
const user = comment.actions[comment.actions.length - 1].user;
const sort = this.props.moderation.sortOrder;
const notify = {
activeQueue: this.activeTab,
text: t('modqueue.notify_flagged', user.username, prepareNotificationText(comment.body)),
anyQueue: true,
};
return handleCommentChange(prev, comment, sort, notify);
},
});
this.subscriptions.push(sub1, sub2, sub3, sub4);
}
unsubscribe() {
this.subscriptions.forEach((unsubscribe) => unsubscribe());
this.subscriptions = [];
}
resubscribe(variables) {
this.unsubscribe();
this.subscribeToUpdates(variables);
}
componentWillMount() {
this.props.clearState();
this.props.fetchSettings();
this.subscribeToUpdates();
}
componentWillUnmount() {
this.unsubscribe();
}
componentWillReceiveProps(nextProps) {
const {updateAssets} = this.props;
if(!isEqual(nextProps.root.assets, this.props.root.assets)) {
updateAssets(nextProps.root.assets);
}
}
suspendUser = async (args) => {
this.props.hideSuspendUserDialog();
try {
const result = await this.props.suspendUser(args);
if (result.data.suspendUser.errors) {
throw result.data.suspendUser.errors;
}
notification.success(
t('suspenduser.notify_suspend_until',
this.props.moderation.suspendUserDialog.username,
timeago(args.until)),
);
const {commentStatus, commentId} = this.props.moderation.suspendUserDialog;
if (commentStatus !== 'REJECTED') {
return this.props.rejectComment({commentId})
.then((result) => {
if (result.data.setCommentStatus.errors) {
throw result.data.setCommentStatus.errors;
}
});
}
// Resubscribe when we change between assets.
if(this.props.data.variables.asset_id !== nextProps.data.variables.asset_id) {
this.resubscribe(nextProps.data.variables);
}
catch(err) {
notification.showMutationErrors(err);
}
};
banUser = ({userId}) => {
return this.props.setUserStatus({userId, status: 'BANNED'});
}
acceptComment = ({commentId}) => {
@@ -113,6 +175,9 @@ class ModerationContainer extends Component {
return update(prev, {
[tab]: {
nodes: {$push: comments.nodes},
hasNextPage: {$set: comments.hasNextPage},
startCursor: {$set: comments.startCursor},
endCursor: {$set: comments.endCursor},
},
});
}
@@ -120,39 +185,100 @@ class ModerationContainer extends Component {
};
render () {
const {root, data} = this.props;
const {root, root: {asset}, data, params: {id: assetId}} = this.props;
if (data.error) {
return <div>Error</div>;
}
if (!('premodCount' in root)) {
return <div><Spinner/></div>;
if (assetId) {
if (asset === null) {
// Not found.
return <NotFoundAsset assetId={assetId} />;
}
if (asset === undefined || asset.id !== assetId) {
// Still loading.
return <Spinner />;
}
} else if(asset !== undefined || !('premodCount' in root)) {
// loading.
return <Spinner />;
}
return <Moderation
{...this.props}
loadMore={this.loadMore}
banUser={this.banUser}
acceptComment={this.acceptComment}
rejectComment={this.rejectComment}
suspendUser={this.suspendUser}
activeTab={this.activeTab}
/>;
}
}
const COMMENT_EDITED_SUBSCRIPTION = gql`
subscription CommentEdited($asset_id: ID){
commentEdited(asset_id: $asset_id){
...${getDefinitionName(Comment.fragments.comment)}
}
}
${Comment.fragments.comment}
`;
const COMMENT_FLAGGED_SUBSCRIPTION = gql`
subscription CommentFlagged($asset_id: ID){
commentFlagged(asset_id: $asset_id){
...${getDefinitionName(Comment.fragments.comment)}
}
}
${Comment.fragments.comment}
`;
const COMMENT_ACCEPTED_SUBSCRIPTION = gql`
subscription CommentAccepted($asset_id: ID){
commentAccepted(asset_id: $asset_id){
...${getDefinitionName(Comment.fragments.comment)}
status_history {
type
created_at
assigned_by {
id
username
}
}
}
}
${Comment.fragments.comment}
`;
const COMMENT_REJECTED_SUBSCRIPTION = gql`
subscription CommentRejected($asset_id: ID){
commentRejected(asset_id: $asset_id){
...${getDefinitionName(Comment.fragments.comment)}
status_history {
type
created_at
assigned_by {
id
username
}
}
}
}
${Comment.fragments.comment}
`;
const LOAD_MORE_QUERY = gql`
query CoralAdmin_Moderation_LoadMore($limit: Int = 10, $cursor: Date, $sort: SORT_ORDER, $asset_id: ID, $statuses:[COMMENT_STATUS!], $action_type: ACTION_TYPE) {
comments(query: {limit: $limit, cursor: $cursor, asset_id: $asset_id, statuses: $statuses, sort: $sort, action_type: $action_type}) {
nodes {
...${getDefinitionName(Comment.fragments.comment)}
action_summaries {
count
... on FlagActionSummary {
reason
}
}
}
hasNextPage
startCursor
endCursor
}
}
${Comment.fragments.comment}
@@ -171,7 +297,7 @@ const commentConnectionFragment = gql`
`;
const withModQueueQuery = withQuery(gql`
query CoralAdmin_Moderation($asset_id: ID, $sort: SORT_ORDER) {
query CoralAdmin_Moderation($asset_id: ID, $sort: SORT_ORDER, $allAssets: Boolean!) {
all: comments(query: {
statuses: [NONE, PREMOD, ACCEPTED, REJECTED],
asset_id: $asset_id,
@@ -208,7 +334,7 @@ const withModQueueQuery = withQuery(gql`
}) {
...CoralAdmin_Moderation_CommentConnection
}
assets: assets {
asset(id: $asset_id) @skip(if: $allAssets) {
id
title
url
@@ -244,6 +370,7 @@ const withModQueueQuery = withQuery(gql`
variables: {
asset_id: id,
sort: sortOrder,
allAssets: id === null
}
};
},
@@ -287,31 +414,28 @@ const mapStateToProps = (state) => ({
moderation: state.moderation.toJS(),
settings: state.settings.toJS(),
auth: state.auth.toJS(),
assets: state.assets.get('assets')
});
const mapDispatchToProps = (dispatch) => ({
...bindActionCreators({
toggleModal,
singleView,
updateAssets,
fetchSettings,
showBanUserDialog,
hideBanUserDialog,
hideShortcutsNote,
toggleStorySearch,
showSuspendUserDialog,
hideSuspendUserDialog,
viewUserDetail,
hideUserDetail,
setSortOrder,
storySearchChange,
clearState
}, dispatch),
});
export default compose(
connect(mapStateToProps, mapDispatchToProps),
withSetCommentStatus,
withSetUserStatus,
withSuspendUser,
withQueueCountPolling,
withModQueueQuery,
)(ModerationContainer);
@@ -0,0 +1,113 @@
import React from 'react';
import {compose, gql} from 'react-apollo';
import StorySearch from '../components/StorySearch';
import {withRouter} from 'react-router';
import withQuery from 'coral-framework/hocs/withQuery';
import {isEmpty} from 'lodash';
class StorySearchContainer extends React.Component {
constructor(props) {
super(props);
this.state = {
searchValue: props.moderation.storySearchString
};
}
componentWillUnmount() {
this.props.storySearchChange('');
}
clearSearch = () => {
this.setState({searchValue: ''}, () => {
this.search();
});
}
clearAndCloseSearch = () => {
if (!isEmpty(this.state.searchValue)) {
this.clearSearch();
}
this.props.closeSearch();
}
handleSearchChange = (e) => {
const {value} = e.target;
this.setState({
searchValue: value
});
}
handleEsc = (e) => {
if (e.key === 'Escape') {
e.preventDefault();
this.clearAndCloseSearch();
}
}
handleEnter = (e) => {
if (e.key === 'Enter') {
e.preventDefault();
this.search();
}
}
search = () => {
const {searchValue} = this.state;
this.props.storySearchChange(searchValue);
}
goToStory = (id) => {
const {router} = this.props;
router.push(`/admin/moderate/all/${id}`);
this.clearAndCloseSearch();
}
goToModerateAll = () => {
const {router} = this.props;
router.push('/admin/moderate/all');
this.clearAndCloseSearch();
}
render () {
return (
<StorySearch
search={this.search}
goToStory={this.goToStory}
goToModerateAll={this.goToModerateAll}
handleEsc={this.handleEsc}
handleEnter={this.handleEnter}
searchValue={this.state.searchValue}
handleSearchChange={this.handleSearchChange}
clearAndCloseSearch={this.clearAndCloseSearch}
{...this.props}
/>
);
}
}
export const withAssetSearchQuery = withQuery(gql`
query SearchStories($value: String = "") {
assets(query: {value: $value, limit: 10}) {
id
title
url
created_at
closedAt
author
}
}
`, {
options: ({moderation: {storySearchString = ''}}) => {
return {
variables: {
value: storySearchString
}
};
}
});
export default compose(
withRouter,
withAssetSearchQuery
)(StorySearchContainer);
@@ -5,9 +5,9 @@ export const actionsMap = {
};
export const menuActionsMap = {
'REJECT': {status: 'REJECTED', text: 'reject', icon: 'close', key: 'r'},
'REJECT': {status: 'REJECTED', text: 'reject', icon: 'close', key: 'f'},
'REJECTED': {status: 'REJECTED', text: 'rejected', icon: 'close'},
'APPROVE': {status: 'ACCEPTED', text: 'approve', icon: 'done', key: 't'},
'APPROVE': {status: 'ACCEPTED', text: 'approve', icon: 'done', key: 'd'},
'FLAGGED': {status: 'FLAGGED', text: 'flag', icon: 'flag', filter: 'Untouched'},
'BAN': {status: 'BANNED', text: 'ban_user', icon: 'not interested'},
'': {icon: 'done'}
+4 -18
View File
@@ -1,20 +1,6 @@
import ApolloClient, {addTypename} from 'apollo-client';
import {networkInterface} from 'coral-framework/services/transport';
import {getClient as getFrameworkClient} from 'coral-framework/services/client';
import fragmentMatcher from './fragmentMatcher';
export const client = new ApolloClient({
fragmentMatcher,
connectToDevTools: true,
addTypename: true,
queryTransformer: addTypename,
dataIdFromObject: (result) => {
if (result.id && result.__typename) { // eslint-disable-line no-underscore-dangle
return `${result.__typename}_${result.id}`; // eslint-disable-line no-underscore-dangle
}
return null;
},
networkInterface
});
export default client;
export function getClient() {
return getFrameworkClient({fragmentMatcher});
}
+3 -3
View File
@@ -1,10 +1,10 @@
import {createStore, combineReducers, applyMiddleware, compose} from 'redux';
import thunk from 'redux-thunk';
import mainReducer from '../reducers';
import {client} from './client';
import {getClient} from './client';
const middlewares = [
applyMiddleware(client.middleware()),
applyMiddleware(getClient().middleware()),
applyMiddleware(thunk)
];
@@ -16,7 +16,7 @@ if (window.devToolsExtension) {
const coralReducers = {
...mainReducer,
apollo: client.reducer()
apollo: getClient().reducer()
};
const store = createStore(
@@ -1,4 +1,4 @@
import {pym} from 'coral-framework';
import pym from 'coral-framework/services/pym';
import * as actions from '../constants/stream';
export const setActiveReplyBox = (id) => ({type: actions.SET_ACTIVE_REPLY_BOX, id});
@@ -47,3 +47,7 @@ export const removeCommentClassName = (idx) => ({
type: actions.REMOVE_COMMENT_CLASSNAME,
idx
});
export const setActiveTab = (tab) => (dispatch) => {
dispatch({type: actions.SET_ACTIVE_TAB, tab});
};
@@ -0,0 +1,202 @@
import React from 'react';
import LoadMore from './LoadMore';
import IgnoredCommentTombstone from './IgnoredCommentTombstone';
import NewCount from './NewCount';
import {TransitionGroup} from 'react-transition-group';
import {forEachError} from 'coral-framework/utils';
import Comment from '../components/Comment';
const hasComment = (nodes, id) => nodes.some((node) => node.id === id);
// resetCursors will return the id cursors of the first and second comment of
// the current comment list. The cursors are used to dertermine which
// comments to show. The spare cursor functions as a backup in case one
// of the comments gets deleted.
function resetCursors(state, props) {
const comments = props.root.asset.comments;
if (comments && comments.nodes.length) {
const idCursors = [comments.nodes[0].id];
if (comments.nodes[1]) {
idCursors.push(comments.nodes[1].id);
}
return {idCursors};
}
return {idCursors: []};
}
// invalidateCursor is called whenever a comment is removed which is referenced
// by one of the 2 id cursors. It returns a new set of id cursors calculated
// using the help of the backup cursor.
function invalidateCursor(invalidated, state, props) {
const alt = invalidated === 1 ? 0 : 1;
const comments = props.root.asset.comments;
const idCursors = [];
if (state.idCursors[alt]) {
idCursors.push(state.idCursors[alt]);
const index = comments.nodes.findIndex((node) => node.id === idCursors[0]);
const nextInLine = comments.nodes[index + 1];
if (nextInLine) {
idCursors.push(nextInLine.id);
}
}
return {idCursors};
}
class AllCommentsPane extends React.Component {
constructor(props) {
super(props);
this.state = {
...resetCursors(this.state, props),
loadingState: '',
};
}
componentWillReceiveProps(next) {
const {comments: prevComments} = this.props;
const {comments: nextComments} = next;
if (!prevComments && nextComments) {
this.setState(resetCursors);
return;
}
if (
prevComments && nextComments &&
nextComments.nodes.length < prevComments.nodes.length
) {
// Invalidate first cursor if referenced comment was removed.
if (this.state.idCursors[0] && !hasComment(nextComments.nodes, this.state.idCursors[0])) {
this.setState(invalidateCursor(0, this.state, next));
}
// Invalidate second cursor if referenced comment was removed.
if (this.state.idCursors[1] && !hasComment(nextComments.nodes, this.state.idCursors[1])) {
this.setState(invalidateCursor(1, this.state, next));
}
}
}
loadMore = () => {
this.setState({loadingState: 'loading'});
this.props.loadMore()
.then(() => {
this.setState({loadingState: 'success'});
})
.catch((error) => {
this.setState({loadingState: 'error'});
forEachError(error, ({msg}) => {this.props.addNotification('error', msg);});
});
}
viewNewComments = () => {
this.setState(resetCursors);
};
// getVisibileComments returns a list containing comments
// which were authored by current user or comes after the `idCursor`.
getVisibleComments() {
const {comments, currentUser: user} = this.props;
const idCursor = this.state.idCursors[0];
const userId = user ? user.id : null;
if (!comments) {
return [];
}
const view = [];
let pastCursor = false;
comments.nodes.forEach((comment) => {
if (comment.id === idCursor) {
pastCursor = true;
}
if (pastCursor || comment.user.id === userId) {
view.push(comment);
}
});
return view;
}
render() {
const {
data,
root,
comments,
commentClassNames,
addTag,
removeTag,
ignoreUser,
setActiveReplyBox,
activeReplyBox,
addNotification,
disableReply,
postComment,
asset,
currentUser,
postFlag,
postDontAgree,
loadNewReplies,
deleteAction,
showSignInDialog,
commentIsIgnored,
charCountEnable,
maxCharCount,
editComment,
} = this.props;
const {loadingState} = this.state;
const view = this.getVisibleComments();
return (
<div className="talk-stream-comments-container">
<NewCount
count={comments.nodes.length - view.length}
loadMore={this.viewNewComments}
/>
<TransitionGroup component='div' className="embed__stream">
{view.map((comment) => {
return commentIsIgnored(comment)
? <IgnoredCommentTombstone key={comment.id} />
: <Comment
commentClassNames={commentClassNames}
data={data}
root={root}
disableReply={disableReply}
setActiveReplyBox={setActiveReplyBox}
activeReplyBox={activeReplyBox}
addNotification={addNotification}
depth={0}
postComment={postComment}
asset={asset}
currentUser={currentUser}
postFlag={postFlag}
postDontAgree={postDontAgree}
addTag={addTag}
removeTag={removeTag}
ignoreUser={ignoreUser}
commentIsIgnored={commentIsIgnored}
loadMore={loadNewReplies}
deleteAction={deleteAction}
showSignInDialog={showSignInDialog}
key={comment.id}
comment={comment}
charCountEnable={charCountEnable}
maxCharCount={maxCharCount}
editComment={editComment}
/>;
})}
</TransitionGroup>
<LoadMore
topLevel={true}
moreComments={asset.comments.hasNextPage}
loadMore={this.loadMore}
loadingState={loadingState}
/>
</div>
);
}
}
export default AllCommentsPane;
@@ -1,11 +1,49 @@
.Reply {
.root {
margin-left: 20px;
margin-bottom: 16px;
position: relative;
margin-bottom: 15px;
padding-top: 12px;
}
.Comment {
margin-bottom: 15px;
position: relative;
.rootLevel0:first-child {
padding-top: 0;
border: 0;
}
.rootLevel0 {
margin-left: 0px;
border-top: 1px solid rgba(0, 0, 0, 0.1);
}
.comment {
padding-left: 15px;
display: flex;
flex-flow: row;
}
.commentLevel0 {
padding-left: 0px;
}
.commentLevel1 {
border-left: 3px #212121 solid;
}
.commentLevel2 {
border-left: 2px #6a6a6a solid;
}
.commentLevel3 {
border-left: 2px #9e9e9e solid;
}
.commentLevel4 {
border-left: 2px #c1c1c1 solid;
}
.highlightedComment {
padding-left: 15px;
border-left: 3px solid rgb(35,118,216);
}
.pendingComment {
@@ -22,6 +60,13 @@
font-style: italic;
}
.hr {
border: 0;
height: 0;
border-top: 1px solid rgba(0, 0, 0, 0.1);
border-bottom: 1px solid rgba(255, 255, 255, 0.3);
}
/* element in the top right of the Comment */
.topRight {
float: right;
@@ -111,3 +156,20 @@
.enter {
animation: enter 1000ms;
}
.commentContainer {
flex: auto;
}
.commentAvatar {
max-width: 60px;
}
.commentAvatar:empty {
display: none;
}
.timerIcon {
vertical-align: middle;
font-size: 14px;
}

Some files were not shown because too many files have changed in this diff Show More