Notification metrics fixes (#26854)
* Ensure your own posts are never ACKed * Don't ACK mobile websocket notifications * Add counter for the unsupported Desktop Apps * Count only push messages when checking for acks * Fix generated * Add tests, fix comment * Fix help string * Check for nil session
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
29fbcdfc2a
Коммит
9cf5a4bccb
@@ -90,6 +90,7 @@ func TestPostedAckHook_Process(t *testing.T) {
|
||||
UserId: userID,
|
||||
Platform: &platform.PlatformService{},
|
||||
}
|
||||
webConn.SetSession(&model.Session{})
|
||||
|
||||
t.Run("should ack if user is in the list of users to notify", func(t *testing.T) {
|
||||
msg := platform.MakeHookedWebSocketEvent(model.NewWebSocketEvent(model.WebsocketEventPosted, "", "", "", nil, ""))
|
||||
@@ -138,6 +139,23 @@ func TestPostedAckHook_Process(t *testing.T) {
|
||||
|
||||
assert.True(t, msg.Event().GetData()["should_ack"].(bool))
|
||||
})
|
||||
|
||||
t.Run("should not ack for mobile app", func(t *testing.T) {
|
||||
mobileWebConn := &platform.WebConn{
|
||||
UserId: userID,
|
||||
Platform: &platform.PlatformService{},
|
||||
}
|
||||
mobileWebConn.SetSession(&model.Session{Props: map[string]string{"isMobile": "true"}})
|
||||
msg := platform.MakeHookedWebSocketEvent(model.NewWebSocketEvent(model.WebsocketEventPosted, "", "", "", nil, ""))
|
||||
|
||||
hook.Process(msg, mobileWebConn, map[string]any{
|
||||
"posted_user_id": model.NewId(),
|
||||
"channel_type": model.ChannelTypeDirect,
|
||||
"users": []string{},
|
||||
})
|
||||
|
||||
assert.Nil(t, msg.Event().GetData()["should_ack"])
|
||||
})
|
||||
}
|
||||
|
||||
func TestAddMentionsAndAddFollowersHooks(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user