Skip to content

Commit

Permalink
feat: refresh avatars from message senders, fixes #134
Browse files Browse the repository at this point in the history
  • Loading branch information
valeriansaliou committed Aug 25, 2024
1 parent a30b0cb commit d2c0334
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/store/tables/inbox.ts
Original file line number Diff line number Diff line change
Expand Up @@ -436,15 +436,21 @@ const $inbox = defineStore("inbox", {
message: CoreMessage,
mode = InboxInsertMode.Insert
): boolean {
// Update sender names contained into message
// Update sender names (contained into message)
this.setName(
room.id,
message.user.jid,
message.user.name,
InboxNameOrigin.Message
);

// Insert message
// Update sender avatar (contained into message)
// Notice: this is a cross-store operation, for convenience.
if (message.user.avatar !== undefined) {
Store.$avatar.refresh(message.user.jid.toString(), message.user.avatar);
}

// Insert actual message
return this.insertMessage(room.id, fromCoreMessage(room, message), mode);
},

Expand Down

0 comments on commit d2c0334

Please sign in to comment.