Skip to content

Commit 5966eb7

Browse files
authored
Merge pull request #4850 from coralproject/develop
v9.11.1
2 parents bac35a5 + f03ff41 commit 5966eb7

File tree

6 files changed

+24
-13
lines changed

6 files changed

+24
-13
lines changed

client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coralproject/talk",
3-
"version": "9.11.0",
3+
"version": "9.11.1",
44
"author": "The Coral Project",
55
"homepage": "https://coralproject.net/",
66
"sideEffects": [

common/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "common",
3-
"version": "9.11.0",
3+
"version": "9.11.1",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

config/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "common",
3-
"version": "9.11.0",
3+
"version": "9.11.1",
44
"description": "",
55
"main": "dist/index.js",
66
"types": "dist/index.d.ts",

server/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@coralproject/talk",
3-
"version": "9.11.0",
3+
"version": "9.11.1",
44
"author": "The Coral Project",
55
"homepage": "https://coralproject.net/",
66
"sideEffects": [

server/src/core/server/services/notifications/externalService.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,13 @@ const CreateNotificationsMutation = `
116116
}
117117
`;
118118

119+
export const automatedModerator = {
120+
id: "00000000-0000-0000-0000-000000000002",
121+
email: "automated-moderator",
122+
username: "<automated-moderator>",
123+
type: ProfileType,
124+
};
125+
119126
export class ExternalNotificationsService {
120127
private _active: boolean;
121128
private url?: string | null;
@@ -289,6 +296,7 @@ export class ExternalNotificationsService {
289296
const data = {
290297
source: NotificationSource,
291298
type: NotificationType.CoralCommentApproved,
299+
from: automatedModerator,
292300
to: this.userToExternalProfile(input.to),
293301
story: this.storyToInput(input.story),
294302
site: this.siteToInput(input.site),
@@ -315,6 +323,7 @@ export class ExternalNotificationsService {
315323
const data = {
316324
source: NotificationSource,
317325
type: NotificationType.CoralCommentRejected,
326+
from: automatedModerator,
318327
to: this.userToExternalProfile(input.to),
319328
story: this.storyToInput(input.story),
320329
site: this.siteToInput(input.site),
@@ -341,6 +350,7 @@ export class ExternalNotificationsService {
341350
const data = {
342351
source: NotificationSource,
343352
type: NotificationType.CoralCommentFeatured,
353+
from: automatedModerator,
344354
to: this.userToExternalProfile(input.to),
345355
story: this.storyToInput(input.story),
346356
site: this.siteToInput(input.site),

server/src/core/server/stacks/rejectComment.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -213,16 +213,17 @@ const rejectComment = async (
213213

214214
if (
215215
sendNotification &&
216-
!(reason?.code === GQLREJECTION_REASON_CODE.BANNED_WORD) &&
217-
tenant.dsa?.enabled
216+
!(reason?.code === GQLREJECTION_REASON_CODE.BANNED_WORD)
218217
) {
219-
await notifications.create(tenant.id, tenant.locale, {
220-
targetUserID: result.after.authorID!,
221-
comment: result.after,
222-
rejectionReason: reason,
223-
type: GQLNOTIFICATION_TYPE.COMMENT_REJECTED,
224-
previousStatus: result.before.status,
225-
});
218+
if (tenant.dsa?.enabled) {
219+
await notifications.create(tenant.id, tenant.locale, {
220+
targetUserID: result.after.authorID!,
221+
comment: result.after,
222+
rejectionReason: reason,
223+
type: GQLNOTIFICATION_TYPE.COMMENT_REJECTED,
224+
previousStatus: result.before.status,
225+
});
226+
}
226227

227228
await sendExternalRejectNotification(
228229
mongo,

0 commit comments

Comments
 (0)