Skip to content
This repository was archived by the owner on Oct 11, 2022. It is now read-only.

Commit 8c2a197

Browse files
authored
Merge pull request #4699 from withspectrum/fix-mention-unsub-link
Fix mention unsub link
2 parents 5a507f9 + c43a24c commit 8c2a197

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

api/routes/api/email.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ emailRouter.get('/unsubscribe', (req, res) => {
6161
case 'newThreadCreated':
6262
case 'newMessageInThreads':
6363
case 'newDirectMessage':
64+
case 'newMention':
6465
return unsubscribeUserFromEmailNotification(userId, type).then(() =>
6566
res
6667
.status(200)

athena/queues/mention-notification.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ export default async ({ data }: Job<MentionNotificationJobData>) => {
4646
// in a private channel where the user is not a member. Users can still be
4747
// mentioned in public channels where they are not a member
4848
const thread = await getThreadById(threadId);
49-
5049
// if for some reason no thread was found, or the thread was deleted
5150
// dont send any notification about the mention
5251
if (!thread || thread.deletedAt) return;
52+
debug('got thread');
5353

5454
const { isPrivate: channelIsPrivate } = await getChannelById(
5555
thread.channelId
@@ -74,6 +74,7 @@ export default async ({ data }: Job<MentionNotificationJobData>) => {
7474
) {
7575
return;
7676
}
77+
debug('user is member in community');
7778

7879
// see if a usersThreads record exists. If it does, and notifications are muted, we
7980
// should not send an email. If the record doesn't exist, it means the person being
@@ -120,8 +121,10 @@ export default async ({ data }: Job<MentionNotificationJobData>) => {
120121
]);
121122

122123
// if the user shouldn't get an email, just add an in-app notif
123-
if (!shouldEmail)
124+
if (!shouldEmail) {
125+
debug('recipient doesnt have an email');
124126
return storeUsersNotifications(storedNotification.id, recipient.id);
127+
}
125128

126129
// if the mention was in a message, get the data about the message
127130
const messagePromise = messageId ? await getMessageById(messageId) : null;

0 commit comments

Comments
 (0)