refactor(socket.io): deprecate SocketModules.chats.hasPrivateChat in favour of api.users.getPrivateRoomId

This commit is contained in:
Julian Lam
2023-11-13 16:10:40 -05:00
parent a4133500fe
commit 0d3c94e6bb
7 changed files with 52 additions and 2 deletions

View File

@@ -71,10 +71,15 @@ SocketModules.chats.getRecentChats = async function (socket, data) {
};
SocketModules.chats.hasPrivateChat = async function (socket, uid) {
sockets.warnDeprecated(socket, 'GET /api/v3/users/:uid/chat');
if (socket.uid <= 0 || uid <= 0) {
throw new Error('[[error:invalid-data]]');
}
return await Messaging.hasPrivateChat(socket.uid, uid);
// despite the `has` prefix, this method actually did return the roomId.
const { roomId } = await api.users.getPrivateRoomId(socket, { uid });
return roomId;
};
SocketModules.chats.getIP = async function (socket, mid) {