* Fix various Q&A moderation/tagging issues

- Allow Staff members to have their questions
answered and appropriately tagged
- Properly filter answering for only top level
questions (comments)
- Add documentation around various moderation
phases and comment creation steps
- Remove unnecessary status filter when setting
the status for a comment

* fix: abstracted out perspective configs

* fix: reworked tag injection

* Fix sorting/unused imports

Co-authored-by: Wyatt Johnson <accounts+github@wyattjoh.ca>
This commit is contained in:
Nick Funk
2020-02-27 14:40:01 -07:00
committed by GitHub
co-authored by Wyatt Johnson
parent c052d37a6f
commit 769ab2a910
22 changed files with 393 additions and 399 deletions
+1 -15
View File
@@ -1,12 +1,10 @@
import { Db } from "mongodb";
import { Config } from "coral-server/config";
import { CoralEventPublisherBroker } from "coral-server/events/publisher";
import { hasTag } from "coral-server/models/comment";
import { Tenant } from "coral-server/models/tenant";
import { removeTag } from "coral-server/services/comments";
import { moderate } from "coral-server/services/comments/moderation";
import { notifyPerspectiveModerationDecision } from "coral-server/services/perspective";
import { AugmentedRedis } from "coral-server/services/redis";
import {
@@ -19,7 +17,6 @@ import { publishChanges, updateAllCommentCounts } from "./helpers";
const rejectComment = async (
mongo: Db,
redis: AugmentedRedis,
config: Config,
broker: CoralEventPublisherBroker | null,
tenant: Tenant,
commentID: string,
@@ -56,6 +53,7 @@ const rejectComment = async (
...result,
...counts,
moderatorID,
commentRevisionID,
});
}
@@ -64,18 +62,6 @@ const rejectComment = async (
return removeTag(mongo, tenant, result.after.id, GQLTAG.FEATURED);
}
// We don't want to await on this so that
// we don't hold up the moderation flow and response
notifyPerspectiveModerationDecision(
mongo,
tenant,
config,
tenant.integrations.perspective,
result.after,
commentRevisionID,
GQLCOMMENT_STATUS.REJECTED
);
// Return the resulting comment.
return result.after;
};