mirror of
https://github.com/matrix-org/dendrite.git
synced 2025-12-29 01:33:10 -06:00
Fix issue with wrong timestamp
This commit is contained in:
parent
2b0261cd70
commit
86e387d19d
|
|
@ -460,7 +460,7 @@ func (a *UserInternalAPI) QueryPresenceForUser(ctx context.Context, req *api.Que
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
var maxLastSeen int64
|
var maxLastSeenTS int64
|
||||||
// If it's a local user, we can check the devices for possible updated timestamps
|
// If it's a local user, we can check the devices for possible updated timestamps
|
||||||
if domain == a.ServerName {
|
if domain == a.ServerName {
|
||||||
var devs []api.Device
|
var devs []api.Device
|
||||||
|
|
@ -469,8 +469,8 @@ func (a *UserInternalAPI) QueryPresenceForUser(ctx context.Context, req *api.Que
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, dev := range devs {
|
for _, dev := range devs {
|
||||||
if dev.LastSeenTS > maxLastSeen {
|
if dev.LastSeenTS > maxLastSeenTS {
|
||||||
maxLastSeen = dev.LastSeenTS
|
maxLastSeenTS = dev.LastSeenTS
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -483,8 +483,10 @@ func (a *UserInternalAPI) QueryPresenceForUser(ctx context.Context, req *api.Que
|
||||||
res.PresenceStatus = p.Presence
|
res.PresenceStatus = p.Presence
|
||||||
res.StatusMsg = p.StatusMsg
|
res.StatusMsg = p.StatusMsg
|
||||||
res.LastActiveTS = p.LastActiveTS
|
res.LastActiveTS = p.LastActiveTS
|
||||||
if maxLastSeen > p.LastActiveTS.Time().Unix() {
|
|
||||||
res.LastActiveTS = gomatrixserverlib.Timestamp(maxLastSeen)
|
maxLastSeen := gomatrixserverlib.Timestamp(maxLastSeenTS)
|
||||||
|
if maxLastSeen.Time().After(p.LastActiveTS.Time()) {
|
||||||
|
res.LastActiveTS = maxLastSeen
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue