diff --git a/client/coral-admin/src/components/CommentLabels.js b/client/coral-admin/src/components/CommentLabels.js index 7af7e9a7e..bff4f575a 100644 --- a/client/coral-admin/src/components/CommentLabels.js +++ b/client/coral-admin/src/components/CommentLabels.js @@ -6,10 +6,21 @@ import FlagLabel from 'coral-ui/components/FlagLabel'; import cn from 'classnames'; import styles from './CommentLabels.css'; +const staffRoles = ['ADMIN', 'STAFF', 'MODERATOR']; + function isUserFlagged(actions) { return actions.some((action) => action.__typename === 'FlagAction' && action.user); } +function getUserFlaggedType(actions) { + return actions + .some((action) => + action.__typename === 'FlagAction' && + action.user && + action.user.roles.some((role) => staffRoles.includes(role)) + ) ? 'Staff' : 'User'; +} + function hasSuspectedWords(actions) { return actions.some((action) => action.__typename === 'FlagAction' && action.reason === 'Matched suspect word filter'); } @@ -24,7 +35,7 @@ const CommentLabels = ({comment, comment: {className, status, actions, hasParent