mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-11-15 18:26:15 +01:00
refactor(socket.io): deprecate SocketModules.chats.setNotificationSetting in favour of api.chats.watch
This commit is contained in:
@@ -198,6 +198,15 @@ chatsAPI.mark = async (caller, data) => {
|
||||
messaging.pushUnreadCount(caller.uid);
|
||||
};
|
||||
|
||||
chatsAPI.watch = async (caller, { roomId, state }) => {
|
||||
const inRoom = await messaging.isUserInRoom(caller.uid, roomId);
|
||||
if (!inRoom) {
|
||||
throw new Error('[[error:no-privileges]]');
|
||||
}
|
||||
|
||||
await messaging.setUserNotificationSetting(caller.uid, roomId, state);
|
||||
};
|
||||
|
||||
chatsAPI.users = async (caller, data) => {
|
||||
const start = data.hasOwnProperty('start') ? data.start : 0;
|
||||
const stop = start + 39;
|
||||
|
||||
Reference in New Issue
Block a user