mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-15 02:57:51 +01:00
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:
committed by
GitHub
parent
f377650161
commit
61f036ce1d
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user