mirror of
https://github.com/matrix-org/sliding-sync.git
synced 2025-03-10 13:37:11 +00:00
Merge pull request #292 from matrix-org/s7evink/nopresencesync
Filter out presence events from /sync requests
This commit is contained in:
commit
6ad321d86c
@ -126,6 +126,8 @@ func (v *HTTPClient) createSyncURL(since string, isFirst, toDeviceOnly bool) str
|
||||
}
|
||||
filter := map[string]interface{}{
|
||||
"room": room,
|
||||
// filter out all presence events (remove this once/if the proxy handles presence)
|
||||
"presence": map[string]interface{}{"not_types": []string{"*"}},
|
||||
}
|
||||
filterJSON, _ := json.Marshal(filter)
|
||||
qps += "&filter=" + url.QueryEscape(string(filterJSON))
|
||||
|
@ -21,49 +21,49 @@ func TestSyncURL(t *testing.T) {
|
||||
since: "",
|
||||
isFirst: false,
|
||||
toDeviceOnly: false,
|
||||
wantURL: wantBaseURL + `?timeout=30000&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"timeline":{"limit":1}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=30000&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"timeline":{"limit":1}}}`),
|
||||
},
|
||||
{
|
||||
since: "",
|
||||
isFirst: true,
|
||||
toDeviceOnly: false,
|
||||
wantURL: wantBaseURL + `?timeout=0&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"timeline":{"limit":1}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=0&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"timeline":{"limit":1}}}`),
|
||||
},
|
||||
{
|
||||
since: "",
|
||||
isFirst: false,
|
||||
toDeviceOnly: true,
|
||||
wantURL: wantBaseURL + `?timeout=30000&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"rooms":[],"timeline":{"limit":1}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=30000&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"rooms":[],"timeline":{"limit":1}}}`),
|
||||
},
|
||||
{
|
||||
since: "",
|
||||
isFirst: true,
|
||||
toDeviceOnly: true,
|
||||
wantURL: wantBaseURL + `?timeout=0&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"rooms":[],"timeline":{"limit":1}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=0&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"rooms":[],"timeline":{"limit":1}}}`),
|
||||
},
|
||||
{
|
||||
since: "112233",
|
||||
isFirst: false,
|
||||
toDeviceOnly: false,
|
||||
wantURL: wantBaseURL + `?timeout=30000&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"timeline":{"limit":50}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=30000&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"timeline":{"limit":50}}}`),
|
||||
},
|
||||
{
|
||||
since: "112233",
|
||||
isFirst: true,
|
||||
toDeviceOnly: false,
|
||||
wantURL: wantBaseURL + `?timeout=0&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"timeline":{"limit":50}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=0&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"timeline":{"limit":50}}}`),
|
||||
},
|
||||
{
|
||||
since: "112233",
|
||||
isFirst: false,
|
||||
toDeviceOnly: true,
|
||||
wantURL: wantBaseURL + `?timeout=30000&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"rooms":[],"timeline":{"limit":50}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=30000&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"rooms":[],"timeline":{"limit":50}}}`),
|
||||
},
|
||||
{
|
||||
since: "112233",
|
||||
isFirst: true,
|
||||
toDeviceOnly: true,
|
||||
wantURL: wantBaseURL + `?timeout=0&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"room":{"rooms":[],"timeline":{"limit":50}}}`),
|
||||
wantURL: wantBaseURL + `?timeout=0&since=112233&set_presence=offline&filter=` + url.QueryEscape(`{"presence":{"not_types":["*"]},"room":{"rooms":[],"timeline":{"limit":50}}}`),
|
||||
},
|
||||
}
|
||||
for i, tc := range testCases {
|
||||
|
Loading…
x
Reference in New Issue
Block a user