fix: if there is no hr create one

happens if its the only chat or if its the last one in the list
This commit is contained in:
Barış Soner Uşaklı
2026-02-03 14:14:08 -05:00
parent e7101330d0
commit f249699d0b

View File

@@ -670,9 +670,11 @@ define('forum/chats', [
function moveChatAndHrToTop(roomEl) {
const hr = roomEl.next('hr');
components.get('chat/recent').prepend(roomEl);
if (hr.length) {
roomEl.after(hr);
const recentChats = components.get('chat/recent');
const chatCount = recentChats.find('[data-roomid]').length;
recentChats.prepend(roomEl);
if (hr.length || chatCount > 1) {
roomEl.after(hr.length ? hr : `<hr class="my-1">`);
}
}