Skip to content

Commit

Permalink
Fix invalid hash for messages with a user
Browse files Browse the repository at this point in the history
Only generating the hash for a message in the `ChatMessage` constructor
doesn't consider the fact that a message's user is often set in a child
class' contructor. A message's hash is derived from the user's ID, so
its hash also needs to be regenerated in this circumstance.
  • Loading branch information
11k committed Nov 24, 2024
1 parent 5c29865 commit 946aa82
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
2 changes: 2 additions & 0 deletions assets/chat/js/messages/ChatBroadcastMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ export default class ChatBroadcastMessage extends ChatEventMessage {
super(message, timestamp);
this.type = MessageTypes.BROADCAST;
this.user = user;

this.generateMessageHash();
}

buildUserTemplate(chat = null) {
Expand Down
2 changes: 2 additions & 0 deletions assets/chat/js/messages/ChatDonationMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ export default class ChatDonationMessage extends ChatEventMessage {
this.type = MessageTypes.DONATION;
this.amount = amount;
this.expirationTimestamp = expirationTimestamp;

this.generateMessageHash();
}

html(chat = null) {
Expand Down
2 changes: 2 additions & 0 deletions assets/chat/js/messages/ChatUserMessage.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ export default class ChatUserMessage extends ChatMessage {
this.title = '';
this.slashme = false;
this.mentioned = [];

this.generateMessageHash();
}

html(chat = null) {
Expand Down

0 comments on commit 946aa82

Please sign in to comment.