diff --git a/ui/api/Hooks.mjs b/ui/api/Hooks.mjs index 2b2ae23..57bd916 100644 --- a/ui/api/Hooks.mjs +++ b/ui/api/Hooks.mjs @@ -63,6 +63,10 @@ export function addMessage(channel, message) { const ex = store().get('messages').value; setChannel(ex, channel); + + if (ex[channel].find((m) => m.id === message.id)) { + return; + } store().setSignalValue('messages', {...ex, [channel]: [...ex[channel], message]}); const user = Store.get('user'); @@ -105,7 +109,7 @@ export function addChannel(channel) { store().set('channels', signal([])); } - if (store().get('channels').value.includes(channel)) { + if (store().get('channels').value.some((c) => c.id === channel.id)) { return; } diff --git a/ui/api/Popups.mjs b/ui/api/Popups.mjs index e1465ba..29021ea 100644 --- a/ui/api/Popups.mjs +++ b/ui/api/Popups.mjs @@ -130,6 +130,8 @@ export class Popups { toast("Password updated", "success"); removePopups(); }); + }, () => { + removePopups(); })); } @@ -185,6 +187,9 @@ export class Popups { } return m; }); + removePopups(); + }, () => { + removePopups(); })); } } \ No newline at end of file diff --git a/ui/components/pages/chat.mjs b/ui/components/pages/chat.mjs index ec32598..d446a71 100644 --- a/ui/components/pages/chat.mjs +++ b/ui/components/pages/chat.mjs @@ -172,7 +172,7 @@ export class ChatComponent { .children( ifjs(edited, create("span") .classes("message-note") - .text("edited") + .text("edited " + Time.ago(new Date(message.updatedAt).getTime() + offset)) .build()), create("span") .classes("message-timestamp", "text-small")