* 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
Этот коммит содержится в:
Devin Binnie
2024-04-23 17:31:17 -04:00
коммит произвёл GitHub
родитель 29fbcdfc2a
Коммит 9cf5a4bccb
9 изменённых файлов: 72 добавлений и 15 удалений

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

@@ -82,12 +82,11 @@ func usePostedAckHook(message *model.WebSocketEvent, postedUserId string, channe
}
func (h *postedAckBroadcastHook) Process(msg *platform.HookedWebSocketEvent, webConn *platform.WebConn, args map[string]any) error {
// Add if we have mentions or followers
// This works since we currently do have an order for broadcast hooks, but this probably should be reworked going forward
if msg.Get("followers") != nil || msg.Get("mentions") != nil {
msg.Add("should_ack", true)
incrementWebsocketCounter(webConn)
return nil
// Don't ACK mobile app websocket events at this time, we may revisit this when we can add this to mobile app
if session := webConn.GetSession(); session != nil {
if session.IsMobile() {
return nil
}
}
postedUserId, err := getTypedArg[string](args, "posted_user_id")
@@ -100,6 +99,14 @@ func (h *postedAckBroadcastHook) Process(msg *platform.HookedWebSocketEvent, web
return nil
}
// Add if we have mentions or followers
// This works since we currently do have an order for broadcast hooks, but this probably should be reworked going forward
if msg.Get("followers") != nil || msg.Get("mentions") != nil {
msg.Add("should_ack", true)
incrementWebsocketCounter(webConn)
return nil
}
channelType, err := getTypedArg[model.ChannelType](args, "channel_type")
if err != nil {
return errors.Wrap(err, "Invalid channel_type value passed to postedAckBroadcastHook")