mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Always add UnreadNotifications
to joined room reponses (#2793)
Fixes a minor bug, where we failed to add `UnreadNotifications` to the join response, if it wasn't in `GetUserUnreadNotificationCountsForRooms`.
This commit is contained in:
parent
fb44e33909
commit
a8bc558a60
3 changed files with 10 additions and 5 deletions
|
@ -492,9 +492,11 @@ func (jr JoinResponse) MarshalJSON() ([]byte, error) {
|
|||
}
|
||||
|
||||
}
|
||||
if jr.UnreadNotifications != nil &&
|
||||
jr.UnreadNotifications.NotificationCount == 0 && jr.UnreadNotifications.HighlightCount == 0 {
|
||||
a.UnreadNotifications = nil
|
||||
if jr.UnreadNotifications != nil {
|
||||
// if everything else is nil, also remove UnreadNotifications
|
||||
if a.State == nil && a.Ephemeral == nil && a.AccountData == nil && a.Timeline == nil && a.Summary == nil {
|
||||
a.UnreadNotifications = nil
|
||||
}
|
||||
}
|
||||
return json.Marshal(a)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue