From 1dcdd4a9c92b1f190d40819bdfc2e6574d936f9d Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Thu, 16 Feb 2017 12:04:24 -0700 Subject: [PATCH 01/13] make Dashboard first tab per Sam. simplify tabs --- .../coral-admin/src/components/ui/Header.js | 14 ++--- .../components/ModerationMenu.js | 53 ++++++++----------- 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/client/coral-admin/src/components/ui/Header.js b/client/coral-admin/src/components/ui/Header.js index 6eacaba9e..141d7fecf 100644 --- a/client/coral-admin/src/components/ui/Header.js +++ b/client/coral-admin/src/components/ui/Header.js @@ -14,11 +14,17 @@ export default ({handleLogout, restricted = false}) => (
+ {lang.t('configure.dashboard')} + + {lang.t('configure.moderate')} - + @@ -35,12 +41,6 @@ export default ({handleLogout, restricted = false}) => ( activeClassName={styles.active}> {lang.t('configure.configure')} - - {lang.t('configure.dashboard')} -
    diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js index 0694152a2..a91b2cbab 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js @@ -6,38 +6,27 @@ import {Link} from 'react-router'; const lang = new I18n(translations); -const ModerationMenu = (props) => ( -
    -
    - { - props.asset ? ( -
    - - {lang.t('modqueue.premod')} - - - {lang.t('modqueue.rejected')} - - - {lang.t('modqueue.flagged')} - -
    - ) : ( -
    - - {lang.t('modqueue.premod')} - - - {lang.t('modqueue.rejected')} - - - {lang.t('modqueue.flagged')} - -
    - ) - } +const ModerationMenu = ({asset}) => { + const premodPath = asset ? `/admin/moderate/premod/${asset.id}` : '/admin/moderate/premod'; + const rejectPath = asset ? `/admin/moderate/rejected/${asset.id}` : '/admin/moderate/rejected'; + const flagPath = asset ? `/admin/modetate/flagged/${asset.id}` : '/admin/moderate/flagged'; + return ( +
    +
    +
    + + {lang.t('modqueue.premod')} + + + {lang.t('modqueue.rejected')} + + + {lang.t('modqueue.flagged')} + +
    +
    -
    -); + ); +}; export default ModerationMenu; From c53aa1d93bca14141e3a38e407afc130601da5fc Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Thu, 16 Feb 2017 12:48:36 -0700 Subject: [PATCH 02/13] add a badge to the queues to show the count. proptypes --- .../ModerationQueue/ModerationContainer.js | 4 +++- .../components/ModerationMenu.js | 20 ++++++++++++++----- 2 files changed, 18 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js index 7755b5bb0..42ea06f2c 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js @@ -70,8 +70,10 @@ class ModerationContainer extends Component {
    { +const ModerationMenu = ({asset, premodCount, rejectCount, flagCount}) => { const premodPath = asset ? `/admin/moderate/premod/${asset.id}` : '/admin/moderate/premod'; const rejectPath = asset ? `/admin/moderate/rejected/${asset.id}` : '/admin/moderate/rejected'; const flagPath = asset ? `/admin/modetate/flagged/${asset.id}` : '/admin/moderate/flagged'; @@ -15,13 +16,13 @@ const ModerationMenu = ({asset}) => {
    - {lang.t('modqueue.premod')} + {lang.t('modqueue.premod')} - {lang.t('modqueue.rejected')} + {lang.t('modqueue.rejected')} - {lang.t('modqueue.flagged')} + {lang.t('modqueue.flagged')}
    @@ -29,4 +30,13 @@ const ModerationMenu = ({asset}) => { ); }; +ModerationMenu.propTypes = { + premodCount: PropTypes.number.isRequired, + rejectCount: PropTypes.number.isRequired, + flagCount: PropTypes.number.isRequired, + asset: PropTypes.shape({ + id: PropTypes.string.isRequired + }) +}; + export default ModerationMenu; From 902cd8300dfbf269219849b659391bb4915cdfd8 Mon Sep 17 00:00:00 2001 From: gaba Date: Thu, 16 Feb 2017 12:17:20 -0800 Subject: [PATCH 03/13] Adds back the timeout to close window. --- views/auth-callback.ejs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/views/auth-callback.ejs b/views/auth-callback.ejs index 66b9cfede..d38d759ee 100644 --- a/views/auth-callback.ejs +++ b/views/auth-callback.ejs @@ -3,7 +3,7 @@ From 1e81ec9f4e067dd7f2a0b2b6ff58e5af5f9d945a Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 16 Feb 2017 15:11:41 -0700 Subject: [PATCH 04/13] Added new commentCount edge, added more docs --- graph/loaders/comments.js | 33 ++++++++++++++++++ graph/resolvers/root_query.js | 17 ++++++++++ graph/typeDefs.graphql | 64 ++++++++++++++++++++++++----------- yarn.lock | 16 ++++----- 4 files changed, 103 insertions(+), 27 deletions(-) diff --git a/graph/loaders/comments.js b/graph/loaders/comments.js index 24b66f4bd..a6b808ef2 100644 --- a/graph/loaders/comments.js +++ b/graph/loaders/comments.js @@ -68,6 +68,38 @@ const getCountsByParentID = (context, parent_ids) => { .then((results) => results.map((result) => result ? result.count : 0)); }; +/** + * Retrieves the count of comments based on the passed in query. + * @param {Object} context graph context + * @param {Object} query query to execute against the comments collection + * to compute the counts + * @return {Promise} resolves to the counts of the comments from the + * query + */ +const getCommentCountByQuery = (context, {ids, statuses, asset_id, parent_id}) => { + let query = CommentModel.find(); + + if (ids) { + query = query.where({id: {$in: ids}}); + } + + if (statuses) { + query = query.where({status: {$in: statuses}}); + } + + if (asset_id != null) { + query = query.where({asset_id}); + } + + if (parent_id !== undefined) { + query = query.where({parent_id}); + } + + return CommentModel + .find(query) + .count(); +}; + /** * Retrieves comments based on the passed in query that is filtered by the * current used passed in via the context. @@ -233,6 +265,7 @@ const genRecentComments = (_, ids) => { module.exports = (context) => ({ Comments: { getByQuery: (query) => getCommentsByQuery(context, query), + getCountByQuery: (query) => getCommentCountByQuery(context, query), countByAssetID: new util.SharedCacheDataLoader('Comments.countByAssetID', 3600, (ids) => getCountsByAssetID(context, ids)), countByParentID: new util.SharedCacheDataLoader('Comments.countByParentID', 3600, (ids) => getCountsByParentID(context, ids)), genRecentReplies: new DataLoader((ids) => genRecentReplies(context, ids)), diff --git a/graph/resolvers/root_query.js b/graph/resolvers/root_query.js index eb66274dd..ced4e65cf 100644 --- a/graph/resolvers/root_query.js +++ b/graph/resolvers/root_query.js @@ -39,6 +39,23 @@ const RootQuery = { return Comments.getByQuery(query); }, + commentCount(_, {query: {action_type, statuses, asset_id, parent_id}}, {user, loaders: {Actions, Comments}}) { + if (user == null || !user.hasRoles('ADMIN')) { + return null; + } + + if (action_type) { + return Actions.getByTypes({action_type, item_type: 'COMMENTS'}) + .then((ids) => { + + // Perform the query using the available resolver. + return Comments.getCountByQuery({ids, statuses, asset_id, parent_id}); + }); + } + + return Comments.getCountByQuery({statuses, asset_id, parent_id}); + }, + metrics(_, {from, to, sort, limit = 10}, {user, loaders: {Metrics}}) { if (user == null || !user.hasRoles('ADMIN')) { return null; diff --git a/graph/typeDefs.graphql b/graph/typeDefs.graphql index cabb50985..72a54a0cd 100644 --- a/graph/typeDefs.graphql +++ b/graph/typeDefs.graphql @@ -27,7 +27,7 @@ type User { # The ID of the User. id: ID! - # username of a user. + # Username of a user. username: String! # Action summaries against the user. @@ -96,10 +96,40 @@ enum ACTION_TYPE { # CommentsQuery allows the ability to query comments by a specific methods. input CommentsQuery { - # current status of a comment. + # Current status of a comment. Requires the `ADMIN` role. statuses: [COMMENT_STATUS!] - # asset that a comment is on. + # Asset that a comment is on. + asset_id: ID + + # The parent of the comment that we want to retrieve. + parent_id: ID + + # Comments returned will only be ones which have at least one action of this + # type. Requires the `ADMIN` role. + action_type: ACTION_TYPE + + # Limit the number of results to be returned. + limit: Int = 10 + + # Skip results from the last created_at timestamp. + cursor: Date + + # Filter by a specific tag name. + tag: [String] + + # Sort the results by created_at. + sort: SORT_ORDER = REVERSE_CHRONOLOGICAL +} + +# CommentCountQuery allows the ability to query comment counts by specific +# methods. +input CommentCountQuery { + + # Current status of a comment. Requires the `ADMIN` role. + statuses: [COMMENT_STATUS!] + + # Asset that a comment is on. asset_id: ID # the parent of the comment that we want to retrieve. @@ -109,17 +139,8 @@ input CommentsQuery { # type. action_type: ACTION_TYPE - # limit the number of results to be returned. - limit: Int = 10 - - # skip results from the last created_at timestamp. - cursor: Date - - # filter by a specific tag name. + # Filter by a specific tag name. tag: [String] - - # sort the results by created_at. - sort: SORT_ORDER = REVERSE_CHRONOLOGICAL } # Comment is the base representation of user interaction in Talk. @@ -146,7 +167,7 @@ type Comment { # The count of replies on a comment. replyCount: Int - # Actions completed on the parent. + # Actions completed on the parent. Requires the `ADMIN` role. actions: [Action] # Action summaries against a comment. @@ -350,7 +371,7 @@ type Asset { closedAt: Date # Summary of all Actions against all entities associated with the Asset. - # (likes, flags, etc.) + # (likes, flags, etc.). Requires the `ADMIN` role. action_summaries: [AssetActionSummary] # The date that the asset was created. @@ -418,7 +439,7 @@ type RootQuery { # Site wide settings and defaults. settings: Settings - # All assets. + # All assets. Requires the `ADMIN` role. assets: [Asset] # Find or create an asset by url, or just find with the ID. @@ -427,7 +448,12 @@ type RootQuery { # Comments returned based on a query. comments(query: CommentsQuery!): [Comment] - # The currently logged in user based on the request. + # Returne the count of comments satisfied by the query. Note that this edge is + # expensive as it is not batched. Requires the `ADMIN` role. + commentCount(query: CommentCountQuery!): Int + + # The currently logged in user based on the request. Requires any logged in + # role. me: User # Metrics related to user actions are saturated into the assets returned. The @@ -554,10 +580,10 @@ type RootMutation { # Delete an action based on the action id. deleteAction(id: ID!): DeleteActionResponse - # Sets User status + # Sets User status. Requires the `ADMIN` role. setUserStatus(id: ID!, status: USER_STATUS!): SetUserStatusResponse - # Sets Comment status + # Sets Comment status. Requires the `ADMIN` role. setCommentStatus(id: ID!, status: COMMENT_STATUS!): SetCommentStatusResponse } diff --git a/yarn.lock b/yarn.lock index f1c047be2..5413439fa 100644 --- a/yarn.lock +++ b/yarn.lock @@ -175,11 +175,11 @@ anymatch@^1.3.0: arrify "^1.0.0" micromatch "^2.1.5" -apollo-client@^0.7.3: - version "0.7.3" - resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-0.7.3.tgz#f27702409ce4b90c3adbd78d8434c3e8d762c7dd" +apollo-client@^0.8.3: + version "0.8.6" + resolved "https://registry.yarnpkg.com/apollo-client/-/apollo-client-0.8.6.tgz#9aa18b03ec338f0a3804122df7f77493a10b72a0" dependencies: - graphql-anywhere "^2.0.0" + graphql-anywhere "^2.1.0" graphql-tag "^1.1.1" redux "^3.4.0" symbol-observable "^1.0.2" @@ -3303,7 +3303,7 @@ graceful-fs@~2.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/graceful-readlink/-/graceful-readlink-1.0.1.tgz#4cafad76bc62f02fa039b2f94e9a3dd3a391a725" -graphql-anywhere@^2.0.0: +graphql-anywhere@^2.0.0, graphql-anywhere@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/graphql-anywhere/-/graphql-anywhere-2.1.0.tgz#888c0a1718db3ff866b313070747777380560f69" @@ -6375,9 +6375,9 @@ react-addons-test-utils@15.3.2: version "15.3.2" resolved "https://registry.yarnpkg.com/react-addons-test-utils/-/react-addons-test-utils-15.3.2.tgz#c09a44f583425a4a9c1b38444d7a6c3e6f0f41f6" -react-apollo@^0.8.1: - version "0.8.3" - resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-0.8.3.tgz#e799bdc913948bb487dfa90921b2ea8d08464816" +react-apollo@^0.10.0: + version "0.10.1" + resolved "https://registry.yarnpkg.com/react-apollo/-/react-apollo-0.10.1.tgz#97fd50855f8575672aa68330b9c64a201cd13343" dependencies: graphql-anywhere "^2.0.0" hoist-non-react-statics "^1.2.0" From 84dcf3b3b63aaaeafe976d31701e93547d7f68f5 Mon Sep 17 00:00:00 2001 From: Wyatt Johnson Date: Thu, 16 Feb 2017 15:47:24 -0700 Subject: [PATCH 05/13] Added some comments --- graph/loaders/comments.js | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/graph/loaders/comments.js b/graph/loaders/comments.js index a6b808ef2..ad78a1e92 100644 --- a/graph/loaders/comments.js +++ b/graph/loaders/comments.js @@ -133,6 +133,7 @@ const getCommentsByQuery = ({user}, {ids, statuses, asset_id, parent_id, author_ }); } + // Only let an admin request any user or the current user request themself. if (user && (user.hasRoles('ADMIN') || user.id === author_id) && author_id != null) { comments = comments.where({author_id}); } @@ -168,7 +169,13 @@ const getCommentsByQuery = ({user}, {ids, statuses, asset_id, parent_id, author_ .limit(limit); }; -const genRecentReplies = (_, ids) => { +/** + * Gets the recent replies. + * @param {Object} context graph context + * @param {Array} ids ids of parent ids + * @return {Promise} resolves to recent replies + */ +const genRecentReplies = (context, ids) => { return CommentModel.aggregate([ // get all the replies for the comments in question @@ -212,6 +219,12 @@ const genRecentReplies = (_, ids) => { .then(util.arrayJoinBy(ids, 'parent_id')); }; +/** + * Gets the recent comments. + * @param {Object} context graph context + * @param {Array} ids ids of asset ids + * @return {Promise} resolves to recent comments from assets + */ const genRecentComments = (_, ids) => { return CommentModel.aggregate([ From a267397f060aca06061f1c3cae36c024cd988865 Mon Sep 17 00:00:00 2001 From: David Erwin Date: Thu, 16 Feb 2017 17:56:46 -0500 Subject: [PATCH 06/13] Standardizing username --- bin/cli-setup | 2 +- bin/cli-users | 2 +- services/passport.js | 4 ++-- services/setup.js | 2 +- services/users.js | 4 ++-- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/bin/cli-setup b/bin/cli-setup index 7985bf220..086c473d5 100755 --- a/bin/cli-setup +++ b/bin/cli-setup @@ -120,7 +120,7 @@ const performSetup = () => { message: 'Username', filter: (username) => { return UsersService - .isValidDisplayName(username, false) + .isValidUsername(username, false) .catch((err) => { throw err.message; }); diff --git a/bin/cli-users b/bin/cli-users index 473c07d9c..fccb4b8bb 100755 --- a/bin/cli-users +++ b/bin/cli-users @@ -79,7 +79,7 @@ function getUserCreateAnswers(options) { message: 'Username', filter: (username) => { return UsersService - .isValidDisplayName(username) + .isValidUsername(username) .catch((err) => { throw err.message; }); diff --git a/services/passport.js b/services/passport.js index d265d9812..0560e54bc 100644 --- a/services/passport.js +++ b/services/passport.js @@ -103,9 +103,9 @@ if (process.env.TALK_FACEBOOK_APP_ID && process.env.TALK_FACEBOOK_APP_SECRET && clientSecret: process.env.TALK_FACEBOOK_APP_SECRET, callbackURL: `${process.env.TALK_ROOT_URL}/api/v1/auth/facebook/callback`, - // TODO: remove displayName reference when we have steps in the FE to handle + // TODO: remove username reference when we have steps in the FE to handle // the username create flow. - profileFields: ['id', 'displayName', 'picture.type(large)'] + profileFields: ['id', 'username', 'picture.type(large)'] }, (accessToken, refreshToken, profile, done) => { UsersService .findOrCreateExternalUser(profile) diff --git a/services/setup.js b/services/setup.js index 2bfbc66a0..1f1542d5e 100644 --- a/services/setup.js +++ b/services/setup.js @@ -57,7 +57,7 @@ module.exports = class SetupService { // Verify other properties of the user. return Promise.all([ - UsersService.isValidDisplayName(username, false), + UsersService.isValidUsername(username, false), UsersService.isValidPassword(password), settingsModel.validate() ]); diff --git a/services/users.js b/services/users.js index f715fa9f4..13858f575 100644 --- a/services/users.js +++ b/services/users.js @@ -176,7 +176,7 @@ module.exports = class UsersService { * @param {Boolean} checkAgainstWordlist enables cheching against the wordlist * @return {Promise} */ - static isValidUserName(username, checkAgainstWordlist = true) { + static isValidUsername(username, checkAgainstWordlist = true) { const onlyLettersNumbersUnderscore = /^[A-Za-z0-9_]+$/; if (!username) { @@ -230,7 +230,7 @@ module.exports = class UsersService { username = username.trim(); return Promise.all([ - UsersService.isValidUserName(username), + UsersService.isValidUsername(username), UsersService.isValidPassword(password) ]) .then(() => { // username is valid From f925e6a8ea2fecfd9805928bc3c9925cd58581ac Mon Sep 17 00:00:00 2001 From: Riley Davis Date: Thu, 16 Feb 2017 16:39:02 -0700 Subject: [PATCH 07/13] fix bug when likes or flags were 0 for an article --- client/coral-admin/src/components/FlagWidget.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/coral-admin/src/components/FlagWidget.js b/client/coral-admin/src/components/FlagWidget.js index 8116d4ff9..187306c8c 100644 --- a/client/coral-admin/src/components/FlagWidget.js +++ b/client/coral-admin/src/components/FlagWidget.js @@ -23,8 +23,8 @@ const FlagWidget = ({assets}) => { { assets.length ? assets.map((asset, index) => { - const flagCount = asset.action_summaries.find(s => s.__typename === 'FlagAssetActionSummary').actionCount; - const likeCount = asset.action_summaries.find(s => s.__typename === 'LikeAssetActionSummary').actionCount; + const flagSummary = asset.action_summaries.find(s => s.__typename === 'FlagAssetActionSummary'); + const likeSummary = asset.action_summaries.find(s => s.__typename === 'LikeAssetActionSummary'); return ( {index + 1}. @@ -32,8 +32,8 @@ const FlagWidget = ({assets}) => { {asset.title}

    {asset.author} - Published: {new Date(asset.created_at).toLocaleDateString()}

    - {likeCount} - {flagCount} + {flagSummary ? flagSummary.actionCount : 0} + {likeSummary ? likeSummary.actionCount : 0} {asset.commentCount} ); From 41d06109854c102d1dbf4374a1adbe48f1778f53 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 13:22:41 -0300 Subject: [PATCH 08/13] PropTypes --- .../ModerationQueue/ModerationContainer.js | 6 +++--- .../ModerationQueue/components/CommentCount.css | 14 ++++++++++++++ .../ModerationQueue/components/CommentCount.js | 12 ++++++++++++ .../ModerationQueue/components/ModerationMenu.js | 10 +++++----- .../src/graphql/queries/modQueueQuery.graphql | 13 +++++++++++++ 5 files changed, 47 insertions(+), 8 deletions(-) create mode 100644 client/coral-admin/src/containers/ModerationQueue/components/CommentCount.css create mode 100644 client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js diff --git a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js index 42ea06f2c..f685ac094 100644 --- a/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js +++ b/client/coral-admin/src/containers/ModerationQueue/ModerationContainer.js @@ -71,9 +71,9 @@ class ModerationContainer extends Component { ( + {props.children} +); + +CommentCount.propTypes = { + children: PropTypes.node +}; + +export default CommentCount; diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js index 47383c535..945c28be4 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js @@ -1,13 +1,13 @@ import React, {PropTypes} from 'react'; +import CommentCount from './CommentCount'; import styles from './styles.css'; import I18n from 'coral-framework/modules/i18n/i18n'; import translations from 'coral-admin/src/translations.json'; import {Link} from 'react-router'; -import {Badge} from 'react-mdl'; const lang = new I18n(translations); -const ModerationMenu = ({asset, premodCount, rejectCount, flagCount}) => { +const ModerationMenu = ({asset, premodCount, rejectedCount, flaggedCount}) => { const premodPath = asset ? `/admin/moderate/premod/${asset.id}` : '/admin/moderate/premod'; const rejectPath = asset ? `/admin/moderate/rejected/${asset.id}` : '/admin/moderate/rejected'; const flagPath = asset ? `/admin/modetate/flagged/${asset.id}` : '/admin/moderate/flagged'; @@ -16,13 +16,13 @@ const ModerationMenu = ({asset, premodCount, rejectCount, flagCount}) => {
    - {lang.t('modqueue.premod')} + {lang.t('modqueue.premod')}{premodCount} - {lang.t('modqueue.rejected')} + {lang.t('modqueue.rejected')}{rejectedCount} - {lang.t('modqueue.flagged')} + {lang.t('modqueue.flagged')}{flaggedCount}
    diff --git a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql index 735f3294e..f57e25eb2 100644 --- a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql +++ b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql @@ -30,4 +30,17 @@ query ModQueue ($asset_id: ID!) { id title } + premodCount: commentCount(query: { + statuses: [PREMOD], + asset_id: $asset_id + }) + rejectedCount: commentCount(query: { + statuses: [REJECTED], + asset_id: $asset_id + }) + flaggedCount: commentCount(query: { + action_type: FLAG, + asset_id: $asset_id, + statuses: [NONE, PREMOD] + }) } From 7eca9db63cd51385b8f46470140c67f6a9ab3be2 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 13:53:34 -0300 Subject: [PATCH 09/13] null assetIDs and old typo --- .../ModerationQueue/components/ModerationMenu.js | 8 ++++---- client/coral-admin/src/graphql/queries/index.js | 2 +- .../coral-admin/src/graphql/queries/modQueueQuery.graphql | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js index 945c28be4..d431e4175 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js @@ -10,7 +10,7 @@ const lang = new I18n(translations); const ModerationMenu = ({asset, premodCount, rejectedCount, flaggedCount}) => { const premodPath = asset ? `/admin/moderate/premod/${asset.id}` : '/admin/moderate/premod'; const rejectPath = asset ? `/admin/moderate/rejected/${asset.id}` : '/admin/moderate/rejected'; - const flagPath = asset ? `/admin/modetate/flagged/${asset.id}` : '/admin/moderate/flagged'; + const flagPath = asset ? `/admin/moderate/flagged/${asset.id}` : '/admin/moderate/flagged'; return (
    @@ -32,10 +32,10 @@ const ModerationMenu = ({asset, premodCount, rejectedCount, flaggedCount}) => { ModerationMenu.propTypes = { premodCount: PropTypes.number.isRequired, - rejectCount: PropTypes.number.isRequired, - flagCount: PropTypes.number.isRequired, + rejectedCount: PropTypes.number.isRequired, + flaggedCount: PropTypes.number.isRequired, asset: PropTypes.shape({ - id: PropTypes.string.isRequired + id: PropTypes.string }) }; diff --git a/client/coral-admin/src/graphql/queries/index.js b/client/coral-admin/src/graphql/queries/index.js index 5a429756e..3325249e1 100644 --- a/client/coral-admin/src/graphql/queries/index.js +++ b/client/coral-admin/src/graphql/queries/index.js @@ -20,7 +20,7 @@ export const mostFlags = graphql(MOST_FLAGS, { }); export const modQueueQuery = graphql(MOD_QUEUE_QUERY, { - options: ({params: {id = ''}}) => { + options: ({params: {id = null}}) => { return { variables: { asset_id: id diff --git a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql index f57e25eb2..200e97d37 100644 --- a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql +++ b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql @@ -1,6 +1,6 @@ #import "../fragments/commentView.graphql" -query ModQueue ($asset_id: ID!) { +query ModQueue ($asset_id: ID) { premod: comments(query: { statuses: [PREMOD], asset_id: $asset_id From 25f366c5f19707098ef87944c9214af0fe143542 Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 13:55:35 -0300 Subject: [PATCH 10/13] Comment Count Component --- .../containers/ModerationQueue/components/CommentCount.js | 4 ++-- .../ModerationQueue/components/ModerationMenu.js | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js b/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js index 9835aaf44..14cf8ecfc 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/CommentCount.js @@ -2,11 +2,11 @@ import React, {PropTypes} from 'react'; import styles from './CommentCount.css'; const CommentCount = props => ( - {props.children} + {props.count} ); CommentCount.propTypes = { - children: PropTypes.node + count: PropTypes.number.isRequired }; export default CommentCount; diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js index d431e4175..767bc815d 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationMenu.js @@ -16,14 +16,14 @@ const ModerationMenu = ({asset, premodCount, rejectedCount, flaggedCount}) => {
    - {lang.t('modqueue.premod')}{premodCount} + {lang.t('modqueue.premod')} - {lang.t('modqueue.rejected')}{rejectedCount} + {lang.t('modqueue.rejected')} - {lang.t('modqueue.flagged')}{flaggedCount} - + {lang.t('modqueue.flagged')} +
    From 761afeaf4f97f22452710ca63016318fec67cdbd Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 14:15:16 -0300 Subject: [PATCH 11/13] Stream cog, settings --- .../ModerationQueue/components/ModerationHeader.js | 6 +++++- .../src/containers/ModerationQueue/components/styles.css | 8 ++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js index 474d8fd27..10ec27af3 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js @@ -1,5 +1,6 @@ import React from 'react'; import {Link} from 'react-router'; +import {Icon} from 'coral-ui'; import styles from './styles.css'; const ModerationHeader = props => ( @@ -9,7 +10,10 @@ const ModerationHeader = props => ( props.asset ?
    All Streams - {props.asset.title} + + {props.asset.title} + + Select Stream
    : diff --git a/client/coral-admin/src/containers/ModerationQueue/components/styles.css b/client/coral-admin/src/containers/ModerationQueue/components/styles.css index 705fdd16f..e2fd31911 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/styles.css +++ b/client/coral-admin/src/containers/ModerationQueue/components/styles.css @@ -77,6 +77,14 @@ span { color: white; margin-bottom: -1px; + .settingsButton { + i { + vertical-align: middle; + margin-left: 10px; + margin-top: -4px; + } + } + .moderateAsset { a { -webkit-box-flex: 1; From 051978a1eeb53483c54ca0bafed5c8388fce643a Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 14:21:47 -0300 Subject: [PATCH 12/13] to the configure --- .../containers/ModerationQueue/components/ModerationHeader.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js index 10ec27af3..bcd06b072 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js @@ -12,7 +12,7 @@ const ModerationHeader = props => ( All Streams {props.asset.title} - + Select Stream
    From 2d374fcdab1c04cddeb642cd264da826ce50a24f Mon Sep 17 00:00:00 2001 From: Belen Curcio Date: Fri, 17 Feb 2017 15:08:55 -0300 Subject: [PATCH 13/13] =?UTF-8?q?=C3=9Asing=20the=20db=20url?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../containers/ModerationQueue/components/ModerationHeader.js | 2 +- client/coral-admin/src/graphql/queries/modQueueQuery.graphql | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js index bcd06b072..c5a11b642 100644 --- a/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js +++ b/client/coral-admin/src/containers/ModerationQueue/components/ModerationHeader.js @@ -12,7 +12,7 @@ const ModerationHeader = props => ( All Streams {props.asset.title} - + Select Stream
    diff --git a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql index 200e97d37..86cd26bbd 100644 --- a/client/coral-admin/src/graphql/queries/modQueueQuery.graphql +++ b/client/coral-admin/src/graphql/queries/modQueueQuery.graphql @@ -29,6 +29,7 @@ query ModQueue ($asset_id: ID) { assets: assets { id title + url } premodCount: commentCount(query: { statuses: [PREMOD],