mirror of https://github.com/matrix-org/gomatrix
Renamed RoomFilter & Validate err message
Signed-off-by: Thibaut CHARLES cromfr@gmail.com
This commit is contained in:
parent
c7e35f87cc
commit
5e66256b63
10
filter.go
10
filter.go
|
@ -23,11 +23,11 @@ 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"`
|
||||||
Presence FilterPart `json:"presence,omitempty"`
|
Presence FilterPart `json:"presence,omitempty"`
|
||||||
Room FilterRoom `json:"room,omitempty"`
|
Room RoomFilter `json:"room,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
// FilterRoom is used to define filtering rules for room events
|
// RoomFilter is used to define filtering rules for room events
|
||||||
type FilterRoom struct {
|
type RoomFilter struct {
|
||||||
AccountData FilterPart `json:"account_data,omitempty"`
|
AccountData FilterPart `json:"account_data,omitempty"`
|
||||||
Ephemeral FilterPart `json:"ephemeral,omitempty"`
|
Ephemeral FilterPart `json:"ephemeral,omitempty"`
|
||||||
IncludeLeave bool `json:"include_leave,omitempty"`
|
IncludeLeave bool `json:"include_leave,omitempty"`
|
||||||
|
@ -52,7 +52,7 @@ type FilterPart struct {
|
||||||
// Validate checks if the filter contains valid property values
|
// Validate checks if the filter contains valid property values
|
||||||
func (filter *Filter) Validate() error {
|
func (filter *Filter) Validate() error {
|
||||||
if filter.EventFormat != "client" && filter.EventFormat != "federation" {
|
if filter.EventFormat != "client" && filter.EventFormat != "federation" {
|
||||||
return errors.New("Bad event_format value. Must be any of [\"client\", \"federation\"]")
|
return errors.New("Bad event_format value. Must be one of [\"client\", \"federation\"]")
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func DefaultFilter() Filter {
|
||||||
EventFields: nil,
|
EventFields: nil,
|
||||||
EventFormat: "client",
|
EventFormat: "client",
|
||||||
Presence: DefaultFilterPart(),
|
Presence: DefaultFilterPart(),
|
||||||
Room: FilterRoom{
|
Room: RoomFilter{
|
||||||
AccountData: DefaultFilterPart(),
|
AccountData: DefaultFilterPart(),
|
||||||
Ephemeral: DefaultFilterPart(),
|
Ephemeral: DefaultFilterPart(),
|
||||||
IncludeLeave: false,
|
IncludeLeave: false,
|
||||||
|
|
Loading…
Reference in New Issue