diff options
| author | Kit La Touche <kit@transneptune.net> | 2024-12-03 13:44:05 -0500 |
|---|---|---|
| committer | Kit La Touche <kit@transneptune.net> | 2024-12-03 13:44:05 -0500 |
| commit | c6fbd21c27277dd76c4dbabf5f1bf24f58142a1a (patch) | |
| tree | 94392c1cafc88e91b14ebbb5a1e39eb86df41bc8 /ui/lib/store/messages.svelte.js | |
| parent | d89d64a1bd71bbb0f545818794f574fc80046c0f (diff) | |
| parent | 4e3ad13aca163e733724b205c250bdb67cc56c29 (diff) | |
Merge branch 'main' into wip/stylize
Diffstat (limited to 'ui/lib/store/messages.svelte.js')
| -rw-r--r-- | ui/lib/store/messages.svelte.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/ui/lib/store/messages.svelte.js b/ui/lib/store/messages.svelte.js index 0ceba54..ba4c895 100644 --- a/ui/lib/store/messages.svelte.js +++ b/ui/lib/store/messages.svelte.js @@ -1,17 +1,18 @@ +import { DateTime } from 'luxon'; import { marked } from 'marked'; import DOMPurify from 'dompurify'; const RUN_COALESCE_MAX_INTERVAL = 10 /* min */ * 60 /* sec */ * 1000; /* ms */ export class Messages { - channels = $state({}); + channels = $state({}); // Mapping<ChannelId, Message> inChannel(channel) { - return this.channels[channel]; + return this.channels[channel] || []; } addMessage(channel, id, { at, sender, body }) { - let parsedAt = new Date(at); + let parsedAt = DateTime.fromISO(at); let renderedBody = DOMPurify.sanitize(marked.parse(body, { breaks: true })); const message = { id, at: parsedAt, body, renderedBody }; |
