Review comments

This commit is contained in:
Kegan Dougal 2023-04-04 18:04:06 +01:00
parent 43d4638e75
commit d10c3691af

View file

@ -19,7 +19,7 @@ import (
) )
// Filter is used by clients to specify how the server should filter responses to e.g. sync requests // Filter is used by clients to specify how the server should filter responses to e.g. sync requests
// Specified by: https://matrix.org/docs/spec/client_server/r0.5.0.html#filtering // Specified by: https://spec.matrix.org/v1.6/client-server-api/#filtering
type Filter struct { type Filter struct {
EventFields []string `json:"event_fields,omitempty"` EventFields []string `json:"event_fields,omitempty"`
EventFormat string `json:"event_format,omitempty"` EventFormat string `json:"event_format,omitempty"`
@ -58,6 +58,8 @@ type StateFilter struct {
IncludeRedundantMembers bool `json:"include_redundant_members,omitempty"` IncludeRedundantMembers bool `json:"include_redundant_members,omitempty"`
NotRooms *[]string `json:"not_rooms,omitempty"` NotRooms *[]string `json:"not_rooms,omitempty"`
Rooms *[]string `json:"rooms,omitempty"` Rooms *[]string `json:"rooms,omitempty"`
Limit int `json:"limit,omitempty"`
UnreadThreadNotifications bool `json:"unread_thread_notifications,omitempty"`
ContainsURL *bool `json:"contains_url,omitempty"` ContainsURL *bool `json:"contains_url,omitempty"`
} }
@ -72,6 +74,7 @@ type RoomEventFilter struct {
IncludeRedundantMembers bool `json:"include_redundant_members,omitempty"` IncludeRedundantMembers bool `json:"include_redundant_members,omitempty"`
NotRooms *[]string `json:"not_rooms,omitempty"` NotRooms *[]string `json:"not_rooms,omitempty"`
Rooms *[]string `json:"rooms,omitempty"` Rooms *[]string `json:"rooms,omitempty"`
UnreadThreadNotifications bool `json:"unread_thread_notifications,omitempty"`
ContainsURL *bool `json:"contains_url,omitempty"` ContainsURL *bool `json:"contains_url,omitempty"`
} }
@ -107,7 +110,8 @@ func DefaultFilter() Filter {
// provided in the request // provided in the request
func DefaultEventFilter() EventFilter { func DefaultEventFilter() EventFilter {
return EventFilter{ return EventFilter{
Limit: 20, // parity with synapse: https://github.com/matrix-org/synapse/blob/v1.80.0/synapse/api/filtering.py#L336
Limit: 10,
NotSenders: nil, NotSenders: nil,
NotTypes: nil, NotTypes: nil,
Senders: nil, Senders: nil,
@ -135,7 +139,8 @@ func DefaultStateFilter() StateFilter {
// filter is provided in the request // filter is provided in the request
func DefaultRoomEventFilter() RoomEventFilter { func DefaultRoomEventFilter() RoomEventFilter {
return RoomEventFilter{ return RoomEventFilter{
Limit: 20, // parity with synapse: https://github.com/matrix-org/synapse/blob/v1.80.0/synapse/api/filtering.py#L336
Limit: 10,
NotSenders: nil, NotSenders: nil,
NotTypes: nil, NotTypes: nil,
Senders: nil, Senders: nil,