Skip to content

Commit

Permalink
fix some message adding stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
targoninc-alex committed Jun 2, 2024
1 parent 6ab463c commit 48a8e73
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
6 changes: 5 additions & 1 deletion ui/api/Hooks.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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;
}

Expand Down
5 changes: 5 additions & 0 deletions ui/api/Popups.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ export class Popups {
toast("Password updated", "success");
removePopups();
});
}, () => {
removePopups();
}));
}

Expand Down Expand Up @@ -185,6 +187,9 @@ export class Popups {
}
return m;
});
removePopups();
}, () => {
removePopups();
}));
}
}
2 changes: 1 addition & 1 deletion ui/components/pages/chat.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit 48a8e73

Please sign in to comment.