fix: fix for reported alert banner
This commit is contained in:
@@ -23,12 +23,11 @@ function AlertBanner({
|
||||
const { reasonCodesEnabled } = useSelector(selectModerationSettings);
|
||||
const userIsContentAuthor = getAuthenticatedUser().username === content.author;
|
||||
const canSeeLastEditOrClosedAlert = (userHasModerationPrivileges || userIsContentAuthor || userIsGroupTa);
|
||||
const isReportedByCurrentUser = getAuthenticatedUser().username === content?.abuseFlaggedBy;
|
||||
const canSeeReportedBanner = (userHasModerationPrivileges || userIsGroupTa || isReportedByCurrentUser);
|
||||
const canSeeReportedBanner = content?.abuseFlagged;
|
||||
|
||||
return (
|
||||
<>
|
||||
{content.abuseFlagged && canSeeReportedBanner && (
|
||||
{canSeeReportedBanner && (
|
||||
<Alert icon={Error} variant="danger" className="px-3 mb-2 py-10px shadow-none flex-fill">
|
||||
{intl.formatMessage(messages.abuseFlaggedMessage)}
|
||||
</Alert>
|
||||
|
||||
@@ -142,8 +142,7 @@ export const useAlertBannerVisible = (content) => {
|
||||
const { reasonCodesEnabled } = useSelector(selectModerationSettings);
|
||||
const userIsContentAuthor = getAuthenticatedUser().username === content.author;
|
||||
const canSeeLastEditOrClosedAlert = (userHasModerationPrivileges || userIsContentAuthor || userIsGroupTa);
|
||||
const isReportedByCurrentUser = getAuthenticatedUser().username === content?.abuseFlaggedBy;
|
||||
const canSeeReportedBanner = (userHasModerationPrivileges || userIsGroupTa || isReportedByCurrentUser);
|
||||
const canSeeReportedBanner = content.abuseFlagged;
|
||||
|
||||
return (
|
||||
(reasonCodesEnabled && canSeeLastEditOrClosedAlert && (content.lastEdit?.reason || content.closed))
|
||||
|
||||
@@ -2,7 +2,6 @@ import React, { useContext } from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
|
||||
import classNames from 'classnames';
|
||||
import { useSelector } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { useIntl } from '@edx/frontend-platform/i18n';
|
||||
@@ -12,7 +11,6 @@ import { PushPin } from '../../../components/icons';
|
||||
import { AvatarOutlineAndLabelColors, Routes, ThreadType } from '../../../data/constants';
|
||||
import AuthorLabel from '../../common/AuthorLabel';
|
||||
import { DiscussionContext } from '../../common/context';
|
||||
import { selectUserHasModerationPrivileges, selectUserIsGroupTa } from '../../data/selectors';
|
||||
import { discussionsPath, isPostPreviewAvailable } from '../../utils';
|
||||
import messages from './messages';
|
||||
import PostFooter from './PostFooter';
|
||||
@@ -42,12 +40,9 @@ function PostLink({
|
||||
category,
|
||||
learnerUsername,
|
||||
});
|
||||
const userHasModerationPrivileges = useSelector(selectUserHasModerationPrivileges);
|
||||
const userIsGroupTa = useSelector(selectUserIsGroupTa);
|
||||
const showAnsweredBadge = post.hasEndorsed && post.type === ThreadType.QUESTION;
|
||||
const authorLabelColor = AvatarOutlineAndLabelColors[post.authorLabel];
|
||||
const postReported = post.abuseFlagged || post.abuseFlaggedCount;
|
||||
const canSeeReportedBadge = postReported && (userHasModerationPrivileges || userIsGroupTa);
|
||||
const canSeeReportedBadge = post.abuseFlagged;
|
||||
const read = post.read || (!post.read && post.commentCount !== post.unreadCommentCount);
|
||||
|
||||
return (
|
||||
|
||||
Reference in New Issue
Block a user