[MM-57067][MM-57006][MM-57328] Acknowledge websocket POSTED events that may result in a notification on the web client (#26604)

* Acknowledge POSTED events that may result in a notification

* Remove temporary metrics

* Add Desktop App support

* Merge'd

* Add some tests

* PR feedback

* Rework window is focused check

* Oops

* Move mentions/followers ACK to posted ACK broadcast hook

---------

Co-authored-by: Mattermost Build <build@mattermost.com>
Этот коммит содержится в:
Devin Binnie
2024-04-11 16:18:14 -04:00
коммит произвёл GitHub
родитель b397f9ed92
Коммит 8589476229
13 изменённых файлов: 255 добавлений и 32 удалений

Просмотреть файл

@@ -3049,3 +3049,16 @@ func TestRemoveNotifications(t *testing.T) {
require.Equal(t, int64(0), thread.UnreadReplies)
})
}
func TestShouldAckWebsocketNotification(t *testing.T) {
t.Run("should return true if channel notify level is ALL", func(t *testing.T) {
assert.True(t, ShouldAckWebsocketNotification(model.ChannelTypeOpen, model.UserNotifyNone, model.ChannelNotifyAll))
})
t.Run("should return true if user notify level is ALL and the channel is unchanged", func(t *testing.T) {
assert.True(t, ShouldAckWebsocketNotification(model.ChannelTypeOpen, model.UserNotifyAll, model.ChannelNotifyDefault))
})
t.Run("should return true if its a group channel, and the level is mention", func(t *testing.T) {
assert.True(t, ShouldAckWebsocketNotification(model.ChannelTypeGroup, model.UserNotifyMention, model.ChannelNotifyDefault))
assert.True(t, ShouldAckWebsocketNotification(model.ChannelTypeGroup, model.UserNotifyNone, model.ChannelNotifyMention))
})
}