|
|
@@ -200,6 +200,11 @@ func (m *Model) onTypingStart(event *gateway.TypingStartEvent) {
|
|
|
m.addTyper(event.UserID)
|
|
|
}
|
|
|
|
|
|
+// onMessageReactionAdd handles the gateway event for a new reaction on a message.
|
|
|
+// Unlike other event handlers that use setMessage/deleteMessage, this handler mutates
|
|
|
+// msg.Reactions in-place via a pointer into the messages slice, then manually invalidates
|
|
|
+// the itemByID cache entry and calls invalidateRows() to trigger a re-render.
|
|
|
+// This avoids a full message replacement for a small incremental change.
|
|
|
func (m *Model) onMessageReactionAdd(event *gateway.MessageReactionAddEvent) {
|
|
|
selected := m.SelectedChannel()
|
|
|
if selected == nil || selected.ID != event.ChannelID {
|
|
|
@@ -239,6 +244,10 @@ func (m *Model) onMessageReactionAdd(event *gateway.MessageReactionAddEvent) {
|
|
|
m.messagesList.invalidateRows()
|
|
|
}
|
|
|
|
|
|
+// onMessageReactionRemove handles the gateway event for a removed reaction.
|
|
|
+// Like onMessageReactionAdd, it mutates msg.Reactions in-place via a pointer into
|
|
|
+// the messages slice and manually invalidates the itemByID cache + calls invalidateRows(),
|
|
|
+// rather than using the setMessage path used by other event handlers.
|
|
|
func (m *Model) onMessageReactionRemove(event *gateway.MessageReactionRemoveEvent) {
|
|
|
selected := m.SelectedChannel()
|
|
|
if selected == nil || selected.ID != event.ChannelID {
|