mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-29 12:42:46 +00:00
Don't create fictitious presence entries (#2381)
* Don't create fictitious presence entries for users that don't have any * Update whitelist, since that test probably shouldn't be passing * Fix panics
This commit is contained in:
parent
6c5c6d73d7
commit
66b397b3c6
6 changed files with 33 additions and 19 deletions
|
@ -88,6 +88,11 @@ func (s *PresenceConsumer) Start() error {
|
|||
}
|
||||
return
|
||||
}
|
||||
if presence == nil {
|
||||
presence = &types.PresenceInternal{
|
||||
UserID: userID,
|
||||
}
|
||||
}
|
||||
|
||||
deviceRes := api.QueryDevicesResponse{}
|
||||
if err = s.deviceAPI.QueryDevices(s.ctx, &api.QueryDevicesRequest{UserID: userID}, &deviceRes); err != nil {
|
||||
|
@ -106,7 +111,9 @@ func (s *PresenceConsumer) Start() error {
|
|||
|
||||
m.Header.Set(jetstream.UserID, presence.UserID)
|
||||
m.Header.Set("presence", presence.ClientFields.Presence)
|
||||
m.Header.Set("status_msg", *presence.ClientFields.StatusMsg)
|
||||
if presence.ClientFields.StatusMsg != nil {
|
||||
m.Header.Set("status_msg", *presence.ClientFields.StatusMsg)
|
||||
}
|
||||
m.Header.Set("last_active_ts", strconv.Itoa(int(presence.LastActiveTS)))
|
||||
|
||||
if err = msg.RespondMsg(m); err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue