mirror of
https://github.com/Blah-IM/blahrs.git
synced 2025-07-02 12:35:33 +00:00
refactor(webapi): hoist RoomMetadata
to blah_types
and rename last_chat
to last_item
This commit is contained in:
parent
c0ec429c24
commit
74c6fa6f6a
5 changed files with 40 additions and 33 deletions
|
@ -269,11 +269,11 @@ async function loadRoomList(autoJoin) {
|
|||
const resp = await fetch(`${serverUrl}/room?filter=${filter}`, await genAuthHeader())
|
||||
const json = await resp.json()
|
||||
if (resp.status !== 200) throw new Error(`status ${resp.status}: ${json.error.message}`);
|
||||
for (const { rid, title, attrs, last_chat, last_seen_cid } of json.rooms) {
|
||||
for (const { rid, title, attrs, last_item, last_seen_cid } of json.rooms) {
|
||||
const el = document.createElement('option');
|
||||
el.value = rid;
|
||||
el.innerText = `${title} (rid=${rid}, attrs=${attrs})`;
|
||||
if (last_chat !== undefined && last_chat.cid !== last_seen_cid) {
|
||||
if (last_item !== undefined && last_item.cid !== last_seen_cid) {
|
||||
el.innerText += ' (unread)';
|
||||
}
|
||||
targetEl.appendChild(el);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue