Make room summary tests pass again

This commit is contained in:
Till Faelligen 2022-10-02 13:11:52 +02:00
parent cbfe2c9e63
commit d892a88dbe
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E

View file

@ -475,8 +475,14 @@ func (jr JoinResponse) MarshalJSON() ([]byte, error) {
if jr.Timeline != nil && len(jr.Timeline.Events) == 0 {
a.Timeline = nil
}
if jr.Summary != nil && len(jr.Summary.Heroes) == 0 {
a.Summary = nil
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
}
}
if jr.UnreadNotifications != nil &&
jr.UnreadNotifications.NotificationCount == 0 && jr.UnreadNotifications.HighlightCount == 0 {