diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md index b5e3077a3c..d59ade4a9a 100644 --- a/.github/PULL_REQUEST_TEMPLATE.md +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -37,8 +37,8 @@ Any related Github issue should be linked by adding its URL to this section. -## Where any tests migrated to React Testing Library? +## Were any tests migrated to React Testing Library? + ## Table of Contents - [Request Signing](#request-signing) diff --git a/server/package-lock.json b/server/package-lock.json index 1b70ccebd5..d833eadb75 100644 --- a/server/package-lock.json +++ b/server/package-lock.json @@ -1,12 +1,12 @@ { "name": "@coralproject/talk", - "version": "8.6.2", + "version": "8.6.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@coralproject/talk", - "version": "8.6.2", + "version": "8.6.3", "license": "Apache-2.0", "dependencies": { "@ampproject/toolbox-cache-url": "^2.9.0", diff --git a/server/package.json b/server/package.json index 6a1ab595b4..96bbeb13b3 100644 --- a/server/package.json +++ b/server/package.json @@ -1,6 +1,6 @@ { "name": "@coralproject/talk", - "version": "8.6.2", + "version": "8.6.3", "author": "The Coral Project", "homepage": "https://coralproject.net/", "sideEffects": [ diff --git a/server/src/core/server/events/listeners/slack/publishEvent.ts b/server/src/core/server/events/listeners/slack/publishEvent.ts index 02f5b3c042..e2165934f3 100644 --- a/server/src/core/server/events/listeners/slack/publishEvent.ts +++ b/server/src/core/server/events/listeners/slack/publishEvent.ts @@ -103,9 +103,12 @@ export default class SlackPublishEvent { ); const commentLink = getURLWithCommentID(this.story.url, this.comment.id); - const body = getHTMLPlainText(getLatestRevision(this.comment).body); + // We truncate to less than 3000 characters to stay under Slack limits + const truncatedBody = getHTMLPlainText( + getLatestRevision(this.comment).body + ).slice(0, 2999); return { - text: body, + text: truncatedBody, blocks: [ { type: "section", @@ -121,7 +124,7 @@ export default class SlackPublishEvent { block_id: "body-block", text: { type: "plain_text", - text: body, + text: truncatedBody, }, }, { diff --git a/server/src/core/server/events/listeners/webhook.ts b/server/src/core/server/events/listeners/webhook.ts index 2467ae2f36..c42a3373d7 100644 --- a/server/src/core/server/events/listeners/webhook.ts +++ b/server/src/core/server/events/listeners/webhook.ts @@ -17,6 +17,7 @@ export class WebhookCoralEventListener CoralEventType.STORY_CREATED, CoralEventType.COMMENT_CREATED, CoralEventType.COMMENT_REPLY_CREATED, + CoralEventType.COMMENT_LEFT_MODERATION_QUEUE, ]; private readonly queue: WebhookQueue; diff --git a/server/src/core/server/graph/plugins/helpers.ts b/server/src/core/server/graph/plugins/helpers.ts index e5f6c41543..94465e66f2 100644 --- a/server/src/core/server/graph/plugins/helpers.ts +++ b/server/src/core/server/graph/plugins/helpers.ts @@ -101,7 +101,7 @@ function hoistCoralErrorExtensions( } // Get the translation bundle. - const bundle = ctx.i18n.getBundle(ctx.lang); + const bundle = ctx.i18n.getBundle(ctx.tenant ? ctx.tenant.locale : ctx.lang); // Translate the extensions. const extensions = originalError.serializeExtensions(bundle, ctx.id); diff --git a/server/src/core/server/graph/resolvers/Subscription/commentEnteredModerationQueue.ts b/server/src/core/server/graph/resolvers/Subscription/commentEnteredModerationQueue.ts index e40e7c061b..f28d0c8fa0 100644 --- a/server/src/core/server/graph/resolvers/Subscription/commentEnteredModerationQueue.ts +++ b/server/src/core/server/graph/resolvers/Subscription/commentEnteredModerationQueue.ts @@ -17,6 +17,7 @@ export interface CommentEnteredModerationQueueInput extends SubscriptionPayload { queue: GQLMODERATION_QUEUE; commentID: string; + status?: string; storyID: string; siteID: string; section?: string; diff --git a/server/src/core/server/graph/resolvers/Subscription/commentLeftModerationQueue.ts b/server/src/core/server/graph/resolvers/Subscription/commentLeftModerationQueue.ts index 894fdcfc7d..479ff998ec 100644 --- a/server/src/core/server/graph/resolvers/Subscription/commentLeftModerationQueue.ts +++ b/server/src/core/server/graph/resolvers/Subscription/commentLeftModerationQueue.ts @@ -16,6 +16,7 @@ import { export interface CommentLeftModerationQueueInput extends SubscriptionPayload { queue: GQLMODERATION_QUEUE; commentID: string; + status?: string; storyID: string; siteID: string; section?: string; diff --git a/server/src/core/server/graph/schema/schema.graphql b/server/src/core/server/graph/schema/schema.graphql index 4618471fc9..58eb8f4139 100644 --- a/server/src/core/server/graph/schema/schema.graphql +++ b/server/src/core/server/graph/schema/schema.graphql @@ -1760,6 +1760,7 @@ enum WEBHOOK_EVENT_NAME { STORY_CREATED COMMENT_CREATED COMMENT_REPLY_CREATED + COMMENT_LEFT_MODERATION_QUEUE } type WebhookEndpoint { diff --git a/server/src/core/server/services/events/comments.ts b/server/src/core/server/services/events/comments.ts index 90a08e2438..69c8553859 100644 --- a/server/src/core/server/services/events/comments.ts +++ b/server/src/core/server/services/events/comments.ts @@ -162,12 +162,13 @@ export async function publishCommentFeatured( export async function publishModerationQueueChanges( broker: CoralEventPublisherBroker, moderationQueue: Pick, - comment: Pick + comment: Pick ) { if (moderationQueue.queues.pending === 1) { await CommentEnteredModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.PENDING, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section, @@ -176,6 +177,7 @@ export async function publishModerationQueueChanges( await CommentLeftModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.PENDING, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section, @@ -185,6 +187,7 @@ export async function publishModerationQueueChanges( await CommentEnteredModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.REPORTED, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section, @@ -193,6 +196,7 @@ export async function publishModerationQueueChanges( await CommentLeftModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.REPORTED, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section, @@ -202,6 +206,7 @@ export async function publishModerationQueueChanges( await CommentEnteredModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.UNMODERATED, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section, @@ -210,6 +215,7 @@ export async function publishModerationQueueChanges( await CommentLeftModerationQueueCoralEvent.publish(broker, { queue: GQLMODERATION_QUEUE.UNMODERATED, commentID: comment.id, + status: comment.status, storyID: comment.storyID, siteID: comment.siteID, section: comment.section,