Notifications: Block muted channels from push notifs.

This commit is contained in:
Paul
2021-06-25 12:37:59 +01:00
parent 809c2f1d18
commit 5c0e14b6ca
10 changed files with 53 additions and 29 deletions

View File

@@ -8,7 +8,7 @@ import { connectState } from "../../redux/connector";
import { Message, SYSTEM_USER_ID, User } from "revolt.js";
import { NotificationOptions } from "../../redux/reducers/settings";
import { Route, Switch, useHistory, useParams } from "react-router-dom";
import { getNotificationState, Notifications } from "../../redux/reducers/notifications";
import { getNotificationState, Notifications, shouldNotify } from "../../redux/reducers/notifications";
interface Props {
options?: NotificationOptions;
@@ -49,13 +49,7 @@ function Notifier({ options, notifs }: Props) {
if (author?.relationship === Users.Relationship.Blocked) return;
const notifState = getNotificationState(notifs, channel);
switch (notifState) {
case 'muted':
case 'none': return;
case 'mention': {
if (!msg.mentions?.includes(client.user!._id)) return;
}
}
if (!shouldNotify(notifState, msg, client.user!._id)) return;
playSound('message');
if (!showNotification) return;