mirror of
https://github.com/matrix-org/dendrite.git
synced 2026-03-03 17:03:10 -06:00
Use a pointer to UnreadNotifications
This commit is contained in:
parent
175f65407a
commit
78828edd46
|
|
@ -46,9 +46,10 @@ func (p *NotificationDataStreamProvider) IncrementalSync(
|
||||||
if counts == nil {
|
if counts == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
jr.UnreadNotifications = &types.UnreadNotifications{
|
||||||
jr.UnreadNotifications.HighlightCount = counts.UnreadHighlightCount
|
HighlightCount: counts.UnreadHighlightCount,
|
||||||
jr.UnreadNotifications.NotificationCount = counts.UnreadNotificationCount
|
NotificationCount: counts.UnreadNotificationCount,
|
||||||
|
}
|
||||||
req.Response.Rooms.Join[roomID] = jr
|
req.Response.Rooms.Join[roomID] = jr
|
||||||
}
|
}
|
||||||
return to
|
return to
|
||||||
|
|
|
||||||
|
|
@ -398,6 +398,11 @@ func (r *Response) IsEmpty() bool {
|
||||||
len(r.ToDevice.Events) == 0
|
len(r.ToDevice.Events) == 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type UnreadNotifications struct {
|
||||||
|
HighlightCount int `json:"highlight_count"`
|
||||||
|
NotificationCount int `json:"notification_count"`
|
||||||
|
}
|
||||||
|
|
||||||
// JoinResponse represents a /sync response for a room which is under the 'join' or 'peek' key.
|
// JoinResponse represents a /sync response for a room which is under the 'join' or 'peek' key.
|
||||||
type JoinResponse struct {
|
type JoinResponse struct {
|
||||||
Summary struct {
|
Summary struct {
|
||||||
|
|
@ -419,10 +424,7 @@ type JoinResponse struct {
|
||||||
AccountData struct {
|
AccountData struct {
|
||||||
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
Events []gomatrixserverlib.ClientEvent `json:"events"`
|
||||||
} `json:"account_data"`
|
} `json:"account_data"`
|
||||||
UnreadNotifications struct {
|
*UnreadNotifications `json:"unread_notifications,omitempty"`
|
||||||
HighlightCount int `json:"highlight_count"`
|
|
||||||
NotificationCount int `json:"notification_count"`
|
|
||||||
} `json:"unread_notifications"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewJoinResponse creates an empty response with initialised arrays.
|
// NewJoinResponse creates an empty response with initialised arrays.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue