mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-01-16 18:43:10 -06:00
Make room summary tests pass again
This commit is contained in:
parent
cbfe2c9e63
commit
d892a88dbe
|
|
@ -475,9 +475,15 @@ func (jr JoinResponse) MarshalJSON() ([]byte, error) {
|
||||||
if jr.Timeline != nil && len(jr.Timeline.Events) == 0 {
|
if jr.Timeline != nil && len(jr.Timeline.Events) == 0 {
|
||||||
a.Timeline = nil
|
a.Timeline = nil
|
||||||
}
|
}
|
||||||
if jr.Summary != nil && len(jr.Summary.Heroes) == 0 {
|
if jr.Summary != nil {
|
||||||
|
var nilPtr int
|
||||||
|
joinedEmpty := jr.Summary.JoinedMemberCount == nil || jr.Summary.JoinedMemberCount == &nilPtr
|
||||||
|
invitedEmpty := jr.Summary.InvitedMemberCount == nil || jr.Summary.InvitedMemberCount == &nilPtr
|
||||||
|
if joinedEmpty && invitedEmpty && len(jr.Summary.Heroes) == 0 {
|
||||||
a.Summary = nil
|
a.Summary = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
if jr.UnreadNotifications != nil &&
|
if jr.UnreadNotifications != nil &&
|
||||||
jr.UnreadNotifications.NotificationCount == 0 && jr.UnreadNotifications.HighlightCount == 0 {
|
jr.UnreadNotifications.NotificationCount == 0 && jr.UnreadNotifications.HighlightCount == 0 {
|
||||||
a.UnreadNotifications = nil
|
a.UnreadNotifications = nil
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue