Node.js based forum software built for the modern web
fix: don't splice the viewer's own chat room into another user's room list (#14781)
palmoni586827de30405
diff --git a/public/src/client/chats.js b/public/src/client/chats.jsindex d480c3cb44..51977b6a18 100644--- a/public/src/client/chats.js+++ b/public/src/client/chats.js@@ -790,7 +790,10 @@ define('forum/chats', [roomEl.find('[component="chat/room/teaser"]').html(html[0].outerHTML);roomEl.find('.timeago').timeago();moveChatAndHrToTop(roomEl);- } else {+ } else if (String(ajaxify.data.uid) === String(app.user.uid)) {+ // The room isn't on screen, so it has to be fetched -- but `GET /chats`+ // returns the *viewer's* rooms, which have no business being spliced+ // into a list that is showing another user's rooms.const { rooms } = await api.get(`/chats`, { start: 0, perPage: 2 });const room = rooms.find(r => parseInt(r.roomId, 10) === parseInt(roomId, 10));if (room) {