feat: add focus mode

This commit is contained in:
Paul Makles
2022-09-18 12:05:48 +01:00
parent eade491473
commit 0ca988427f
10 changed files with 40 additions and 12 deletions

View File

@@ -157,6 +157,8 @@ export default class NotificationOptions
return false;
}
// Check channel notification settings
const mentioned = message.mention_ids?.includes(user._id);
switch (this.computeForChannel(message.channel!)) {
case "muted":
case "none":
@@ -164,7 +166,12 @@ export default class NotificationOptions
return false;
case "mention":
// Ignore if it doesn't mention us.
if (!message.mention_ids?.includes(user._id)) return false;
if (!mentioned) return false;
}
// Check if we are in focus mode
if (user.status?.presence === "Focus" && !mentioned) {
return false;
}
return true;