Un-feature a comment when it is rejected (#2555)

Also decrements the featured count for the story if rejected using the
in-stream moderation.

CORL-554
This commit is contained in:
Nick Funk
2019-09-18 12:17:31 -04:00
committed by Kim Gardner
parent 2cc32d4332
commit 741739bc16
7 changed files with 87 additions and 16 deletions
+8 -1
View File
@@ -1,4 +1,7 @@
import { GQLCOMMENT_STATUS } from "coral-server/graph/tenant/schema/__generated__/types";
import {
GQLCOMMENT_STATUS,
GQLTAG,
} from "coral-server/graph/tenant/schema/__generated__/types";
import { Comment } from "./comment";
import { MODERATOR_STATUSES, PUBLISHED_STATUSES } from "./constants";
@@ -73,3 +76,7 @@ export function calculateRejectionRate(counts: CommentStatusCounts): number {
return rejected / (published + rejected);
}
export function hasTag(comment: Pick<Comment, "tags">, tag: GQLTAG) {
return comment.tags.some(v => v.type === tag);
}