diff --git a/backend/src/db/migrations/20250405030454-email-notification-settings.ts b/backend/src/db/migrations/20250405030454-email-notification-settings.ts index 44949be72..1418eaed1 100644 --- a/backend/src/db/migrations/20250405030454-email-notification-settings.ts +++ b/backend/src/db/migrations/20250405030454-email-notification-settings.ts @@ -12,8 +12,7 @@ export async function up(next) { await transaction.run(` MATCH (user:User) SET user.emailNotificationsCommentOnObservedPost = user.sendNotificationEmails - SET user.emailNotificationsPostByFollowedUser = user.sendNotificationEmails - SET user.emailNotificationsPostInGroup = user.sendNotificationEmails + SET user.emailNotificationsMention = user.sendNotificationEmails SET user.emailNotificationsGroupMemberJoined = user.sendNotificationEmails SET user.emailNotificationsGroupMemberLeft = user.sendNotificationEmails SET user.emailNotificationsGroupMemberRemoved = user.sendNotificationEmails @@ -45,8 +44,7 @@ export async function down(next) { MATCH (user:User) SET user.sendNotificationEmails = true REMOVE user.emailNotificationsCommentOnObservedPost - REMOVE user.emailNotificationsPostByFollowedUser - REMOVE user.emailNotificationsPostInGroup + REMOVE user.emailNotificationsMention REMOVE user.emailNotificationsGroupMemberJoined REMOVE user.emailNotificationsGroupMemberLeft REMOVE user.emailNotificationsGroupMemberRemoved diff --git a/backend/src/middleware/notifications/notificationsMiddleware.ts b/backend/src/middleware/notifications/notificationsMiddleware.ts index 824729615..7dc5190da 100644 --- a/backend/src/middleware/notifications/notificationsMiddleware.ts +++ b/backend/src/middleware/notifications/notificationsMiddleware.ts @@ -101,7 +101,7 @@ const handleContentDataOfPost = async (resolve, root, args, context, resolveInfo if (post) { await publishNotifications(context, [ notifyUsersOfMention('Post', post.id, idsOfUsers, 'mentioned_in_post', context), - ], 'TODO') + ], 'emailNotificationsMention') } return post } @@ -120,7 +120,7 @@ const handleContentDataOfComment = async (resolve, root, args, context, resolveI 'mentioned_in_comment', context, ), - ], 'TODO') + ], 'emailNotificationsMention') await publishNotifications(context, [ notifyUsersOfComment('Comment', comment.id, 'commented_on_post', context), @@ -129,11 +129,6 @@ const handleContentDataOfComment = async (resolve, root, args, context, resolveI return comment } -/* TODO unused -emailNotificationsPostByFollowedUser: true -emailNotificationsPostInGroup: true -*/ - const postAuthorOfComment = async (commentId, { context }) => { const session = context.driver.session() let postAuthorId diff --git a/backend/src/models/User.ts b/backend/src/models/User.ts index df0699a13..b1da09f0d 100644 --- a/backend/src/models/User.ts +++ b/backend/src/models/User.ts @@ -161,11 +161,7 @@ export default { type: 'boolean', default: true, }, - emailNotificationsPostByFollowedUser: { - type: 'boolean', - default: true, - }, - emailNotificationsPostInGroup: { + emailNotificationsMention: { type: 'boolean', default: true, }, diff --git a/backend/src/schema/resolvers/users.ts b/backend/src/schema/resolvers/users.ts index 3363ccaad..c0a23846e 100644 --- a/backend/src/schema/resolvers/users.ts +++ b/backend/src/schema/resolvers/users.ts @@ -159,6 +159,7 @@ export default { emailNotificationSettings.forEach((setting) => { const allowedSettingNames = [ 'commentOnObservedPost', + 'mention', 'postByFollowedUser', 'postInGroup', 'groupMemberJoined', @@ -395,11 +396,10 @@ export default { value: parent.emailNotificationsCommentOnObservedPost ?? true, }, { - name: 'postByFollowedUser', + name: 'mention', type: 'post', - value: parent.emailNotificationsPostByFollowedUser ?? true, + value: parent.emailNotificationsMention ?? true, }, - { name: 'postInGroup', type: 'post', value: parent.emailNotificationsPostInGroup ?? true}, { name: 'groupMemberJoined', type: 'group',