aboutsummaryrefslogtreecommitdiff
path: root/syncapi/sync/request.go
diff options
context:
space:
mode:
authorNeil Alexander <neilalexander@users.noreply.github.com>2020-12-18 11:11:21 +0000
committerGitHub <noreply@github.com>2020-12-18 11:11:21 +0000
commit50963b724b12f4f8155ac00a677afe38d0bd69d8 (patch)
tree11a9ff7d4dca995b770e5cd3ad512c4ba3d1a98c /syncapi/sync/request.go
parenta518e2971ab034cf4b97f39423e835452ca97540 (diff)
More sane next batch handling, typing notification tweaks, give invites their own stream position, device list fix (#1641)
* Update sync responses * Fix positions, add ApplyUpdates * Fix MarshalText as non-pointer, PrevBatch is optional * Increment by number of read receipts * Merge branch 'master' into neilalexander/devicelist * Tweak typing * Include keyserver position tweak * Fix typing next position in all cases * Tweaks * Fix typo * Tweaks, restore StreamingToken.MarshalText which somehow went missing? * Rely on positions from notifier rather than manually advancing them * Revert "Rely on positions from notifier rather than manually advancing them" This reverts commit 53112a62cc3bfd9989acab518e69eeb27938117a. * Give invites their own position, fix other things * Fix test * Fix invites maybe * Un-whitelist tests that look to be genuinely wrong * Use real receipt positions * Ensure send-to-device uses real positions too
Diffstat (limited to 'syncapi/sync/request.go')
-rw-r--r--syncapi/sync/request.go12
1 files changed, 4 insertions, 8 deletions
diff --git a/syncapi/sync/request.go b/syncapi/sync/request.go
index d5cf143d..f2f2894b 100644
--- a/syncapi/sync/request.go
+++ b/syncapi/sync/request.go
@@ -46,7 +46,7 @@ type syncRequest struct {
device userapi.Device
limit int
timeout time.Duration
- since *types.StreamingToken // nil means that no since token was supplied
+ since types.StreamingToken // nil means that no since token was supplied
wantFullState bool
log *log.Entry
}
@@ -55,17 +55,13 @@ func newSyncRequest(req *http.Request, device userapi.Device, syncDB storage.Dat
timeout := getTimeout(req.URL.Query().Get("timeout"))
fullState := req.URL.Query().Get("full_state")
wantFullState := fullState != "" && fullState != "false"
- var since *types.StreamingToken
- sinceStr := req.URL.Query().Get("since")
+ since, sinceStr := types.StreamingToken{}, req.URL.Query().Get("since")
if sinceStr != "" {
- tok, err := types.NewStreamTokenFromString(sinceStr)
+ var err error
+ since, err = types.NewStreamTokenFromString(sinceStr)
if err != nil {
return nil, err
}
- since = &tok
- }
- if since == nil {
- since = &types.StreamingToken{}
}
timelineLimit := DefaultTimelineLimit
// TODO: read from stored filters too