Chat notifs (#11832)

* first part of chat notifs

* moved default notif to manage page

* spec

* notifs

* delete settings on room delete
This commit is contained in:
Barış Soner Uşaklı
2023-07-21 15:31:34 -04:00
committed by GitHub
parent f377650161
commit 61f036ce1d
15 changed files with 249 additions and 46 deletions

View File

@@ -200,4 +200,17 @@ SocketModules.chats.toggleOwner = async (socket, data) => {
await Messaging.toggleOwner(data.uid, data.roomId);
};
SocketModules.chats.setNotificationSetting = async (socket, data) => {
if (!data || !utils.isNumber(data.value) || !data.roomId) {
throw new Error('[[error:invalid-data]]');
}
const inRoom = await Messaging.isUserInRoom(socket.uid, data.roomId);
if (!inRoom) {
throw new Error('[[error:no-privileges]]');
}
await Messaging.setUserNotificationSetting(socket.uid, data.roomId, data.value);
};
require('../promisify')(SocketModules);