Site Moderator Fixes (#3054)

* fix: disable banning for site moderators

* fix: fixed redirect issue for site moderators
This commit is contained in:
Wyatt Johnson
2020-07-30 16:04:28 +00:00
committed by GitHub
parent ceadcc7ae1
commit 9a9c92d360
2 changed files with 11 additions and 3 deletions
@@ -84,8 +84,13 @@ const ModerateContainer: FunctionComponent<Props> = ({
// If we've loaded a specific story, we'll have the site on that story too,
// so check if we're allowed to moderate it.
if (data.story && !data.story.site.canModerate) {
redirect();
if (data.story) {
if (!data.story.site.canModerate) {
redirect();
return;
}
// The viewer can moderate this site on the story!
return;
}
@@ -90,7 +90,7 @@ const ModerationActionsContainer: FunctionComponent<Props> = ({
const showBanOption =
!comment.author || !comment.author.id || viewer === null
? false
: comment.author.id !== viewer.id;
: comment.author.id !== viewer.id && !viewer.moderationScopes?.scoped;
const isQA = story.settings.mode === GQLSTORY_MODE.QA;
return (
@@ -285,6 +285,9 @@ const enhanced = withFragmentContainer<Props>({
viewer: graphql`
fragment ModerationActionsContainer_viewer on User {
id
moderationScopes {
scoped
}
}
`,
})(ModerationActionsContainer);