fix: backend logic fixes for #12853

This commit is contained in:
Julian Lam
2024-10-16 15:22:49 -04:00
parent 5c43108480
commit b472c58946
2 changed files with 2 additions and 3 deletions

View File

@@ -344,14 +344,14 @@ define('forum/chats/messages', [
return;
}
api.del(`/chats/${roomId}/messages/${messageId}`, {}).then(() => {
api.del(`/chats/${roomId}/messages/${encodeURIComponent(messageId)}`, {}).then(() => {
components.get('chat/message', messageId).toggleClass('deleted', true);
}).catch(alerts.error);
});
};
messages.restore = function (messageId, roomId) {
api.post(`/chats/${roomId}/messages/${messageId}`, {}).then(() => {
api.post(`/chats/${roomId}/messages/${encodeURIComponent(messageId)}`, {}).then(() => {
components.get('chat/message', messageId).toggleClass('deleted', false);
}).catch(alerts.error);
};

View File

@@ -152,7 +152,6 @@ Assert.message = helpers.try(async (req, res, next) => {
}
if (
!isFinite(req.params.mid) ||
!(await messaging.messageExists(req.params.mid)) ||
!(await messaging.canViewMessage(req.params.mid, roomId || req.params.roomId, req.uid))
) {