import React from 'react'; import PropTypes from 'prop-types'; import Label from 'coral-ui/components/Label'; import Slot from 'coral-framework/components/Slot'; 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 && staffRoles.includes(action.user.role) ) ? 'Staff' : 'User'; } function hasSuspectedWords(actions) { return actions.some((action) => action.__typename === 'FlagAction' && action.reason === 'Matched suspect word filter'); } function hasHistoryFlag(actions) { return actions.some((action) => action.__typename === 'FlagAction' && action.reason === 'TRUST'); } const CommentLabels = ({comment, comment: {className, status, actions, hasParent}}) => { return (