Compare commits
2 commits
f76bb30987
...
8d1ca787fa
Author | SHA1 | Date | |
---|---|---|---|
|
8d1ca787fa | ||
|
15bfc1599b |
|
@ -55,6 +55,15 @@
|
|||
enable_smacks: true,
|
||||
allow_chat_pending_contacts: true,
|
||||
allow_non_roster_messaging: true,
|
||||
|
||||
// Special optimisations to reduce memory usage on KaiOS
|
||||
mam_request_all_pages: false,
|
||||
muc_fetch_members: ['owner'], // no admin or member, to reduce load
|
||||
muc_respect_autojoin: false,
|
||||
archived_messages_page_size: 10,
|
||||
prune_messages_above: 30,
|
||||
|
||||
// BOSH and WebSocket configuration
|
||||
bosh_service_url: $useAdvancedSettings && $boshURL || undefined,
|
||||
websocket_url: $useAdvancedSettings && $wsURL || undefined,
|
||||
}
|
||||
|
|
|
@ -43,14 +43,27 @@
|
|||
}
|
||||
}), 1000)
|
||||
|
||||
let chatboxes = _converse?.chatboxes?.toArray() || []
|
||||
// Helper function to convert chatboxes into
|
||||
// (exceedingly lightweight) object array for
|
||||
// final rendering
|
||||
function chatboxesToArray(chatboxes) {
|
||||
if (!chatboxes) return []
|
||||
|
||||
return _converse.chatboxes.models.map(c => ({
|
||||
id: c.id,
|
||||
title: c.attributes.name || c.attributes.id,
|
||||
lastMessage: c.messages?.last()?.attributes?.body,
|
||||
}))
|
||||
}
|
||||
|
||||
let chatboxes = chatboxesToArray(_converse?.chatboxes)
|
||||
|
||||
_converse.on('chatBoxesFetched', () => {
|
||||
chatboxes = _converse.chatboxes?.toArray() || []
|
||||
chatboxes = chatboxesToArray(_converse.chatboxes)
|
||||
})
|
||||
|
||||
_converse.on('message', () => {
|
||||
chatboxes = _converse.chatboxes?.toArray() || []
|
||||
chatboxes = chatboxesToArray(_converse.chatboxes)
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -61,8 +74,8 @@
|
|||
{:else}
|
||||
{#each chatboxes as convo, index (convo.id)}
|
||||
<ListItem
|
||||
text={convo.attributes.nickname || convo.attributes.id}
|
||||
subtext={convo.messages?.last()?.attributes?.body || undefined}
|
||||
text={convo.title}
|
||||
subtext={convo.lastMessage}
|
||||
tabindex={index}
|
||||
onclick={() => openChat(convo.id)}
|
||||
/>
|
||||
|
|
Loading…
Reference in a new issue