mirror of
https://github.com/wassname/talk.git
synced 2026-08-08 11:28:12 +08:00
[CORL-810] Custom Moderation Phases (#2901)
* feat: initial implementation
* feat: renamed fields from mutations
* fix: more renaming to streamline {Key,Secret}->SigningSecret
* feat: introduced WrappedInternalError
* feat: enhanced extern payload, more fetch options
- Added tenant.{id,domain} to extern payload
- Added site.id to the extern payload
- Added response size limit to fetch
- Added new SCRAPE_MAX_RESPONSE_SIZE env var for managing the size of
responses for scraping
* fix: fixed bug with scrape invocation
* feat: added more queries + mutations
- Added Query.externalModerationPhase
- Added Mutation.createExternalModerationPhase
- Added Mutation.updateExternalModerationPhase
- Added Mutation.enableExternalModerationPhase
- Added Mutation.disableExternalModerationPhase
- Added Mutation.deleteExternalModerationPhase
- Added Mutation.rotateExternalModerationPhaseSigningSecret
* feat: added secret management
* fix: linting
* fix: merge conflict fix
* feat: added UI
* fix: linting
* fix: linting
* fix: updated snapshots
* fix: improved docs
* fix: improved docs
* fix: added locales
* review: improve naming
* review: some review changes
- Switched /moderation/phase to /moderation/phases
- Fixed scrolling
- Fixed redirection
* fix: added scroll timeout for webhooks
This commit is contained in:
@@ -23,6 +23,7 @@ import {
|
||||
retrieveComment,
|
||||
} from "coral-server/models/comment";
|
||||
import {
|
||||
getDepth,
|
||||
hasAncestors,
|
||||
hasPublishedStatus,
|
||||
} from "coral-server/models/comment/helpers";
|
||||
@@ -91,7 +92,7 @@ const markCommentAsAnswered = async (
|
||||
// If we are the export on this story...
|
||||
story.settings.expertIDs.some((id) => id === author.id) &&
|
||||
// And this is the first reply (depth of 1)...
|
||||
comment.ancestorIDs.length === 1
|
||||
getDepth(comment) === 1
|
||||
) {
|
||||
// We need to mark the parent question as answered.
|
||||
// - Remove the unanswered tag.
|
||||
@@ -170,14 +171,14 @@ export default async function create(
|
||||
try {
|
||||
// Run the comment through the moderation phases.
|
||||
result = await processForModeration({
|
||||
action: "NEW",
|
||||
log,
|
||||
mongo,
|
||||
redis,
|
||||
config,
|
||||
nudge,
|
||||
story,
|
||||
action: "NEW",
|
||||
tenant,
|
||||
story,
|
||||
nudge,
|
||||
comment: { ...input, ancestorIDs },
|
||||
author,
|
||||
req,
|
||||
@@ -221,7 +222,8 @@ export default async function create(
|
||||
{
|
||||
...input,
|
||||
siteID: story.siteID,
|
||||
tags,
|
||||
// Remap the tags to include the createdAt.
|
||||
tags: tags.map((tag) => ({ type: tag, createdAt: now })),
|
||||
body,
|
||||
status,
|
||||
ancestorIDs,
|
||||
@@ -277,10 +279,11 @@ export default async function create(
|
||||
...action,
|
||||
commentID: comment.id,
|
||||
commentRevisionID: revision.id,
|
||||
|
||||
// Store the Story ID on the action.
|
||||
storyID: story.id,
|
||||
siteID: story.siteID,
|
||||
|
||||
// All these actions are created by the system.
|
||||
userID: null,
|
||||
})
|
||||
),
|
||||
now
|
||||
|
||||
Reference in New Issue
Block a user