Commit graph

24 commits

Author SHA1 Message Date
Alex Chen 801c6646f6
Apply suggestions from code review
Co-Authored-By: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2019-07-12 22:28:36 +08:00
Alex Chen 24b3e1a217
Apply suggestions from code review
Co-Authored-By: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
2019-07-12 22:26:35 +08:00
Cnly 4a323f15a1 Merge 'upstream/master' into syncapi-typing-notifications-635
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-07-12 20:51:43 +08:00
Cnly 4e84c2f2e9 Docs and code cleanup
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-07-12 20:47:13 +08:00
Andrew Morgan 33a1392541
Encode URLs properly (#728)
We were escaping the URL before performing any pattern matching on it.
This meant that if you sent data that URLdecoded to a "/", it would count as
a "/" in the URL, potentially causing a 404. This was causing some flaky tests
with some randomly-generated query parameters.

Now, we keep URLs encoded while doing the pattern matching, and only afterwards
do we URL decode each query parameter individually before passing them to their
respective handler functions.

github.com/gorilla/mux was also updated to v1.7.3 to fix a bug with URL encoding and subrouters.
2019-07-03 16:38:50 +01:00
Cnly 530ed11ecc Refine docs
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-28 01:32:23 +08:00
Cnly 19f1a6fe0d Remove users from typing list when typing status times out
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 16:11:29 +08:00
Cnly d79a6a21c7 Userstreams should store and use complete pos, not pos update ("pos delta")
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 05:10:31 +08:00
Cnly 274db2fbaf Fix zero value of currPos may be used in OnIncomingSyncRequest
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 05:00:48 +08:00
Cnly 6fd1c21207 Fix docs for SyncPosition.WithUpdates
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 04:48:14 +08:00
Cnly aeceacd917 Make Notifier.CurrentPosition() respect stream lock
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 04:33:45 +08:00
Cnly 74fd292403 Fix latest sync pos used as since pos in requestpool.go
Previously, currPos, obtained using notifier.CurrentPosition(), is passed
to GetNotifyChannel. Since this is already the latest position on the
server, the client won't get updates until (1) a even newer event arrives at
the server, or (2) the /sync request times out.

(2) above is possible because when it times out, notifier calculates
currentSyncForUser based on syncReq, which contains the correct since pos
token that the client sent the server.

Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-27 04:02:43 +08:00
Cnly 2a9dab21f8 Fix sync position with partial info used as complete one in syncserver and notifier
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 22:56:58 +08:00
Cnly 55219aa746 Better logging in typing event consumer
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 22:48:19 +08:00
Cnly d3ee72c59b Typing event consumer now supplies real, not bogus position to notifier
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 22:46:12 +08:00
Cnly ad4f69a81c Remove room ID from m.typing client events
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 22:38:30 +08:00
Cnly badd360fe6 Add a simple test for EDU-only updates in notifier_test.go
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 18:00:50 +08:00
Cnly 18c59e68cd Fix more linting issues and docs
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 17:46:08 +08:00
Cnly e6870279ed Fix syncapi/sync/notifier_test.go
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-26 17:45:25 +08:00
Cnly e742b7d9b5 Add warning for OnNewEvent when no user to wake up
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-25 22:53:07 +08:00
Cnly 55a4e6061a Fix linting
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-25 22:22:03 +08:00
Cnly b896fdc537 Add typing notifications to /sync responses - fixes #635
Signed-off-by: Alex Chen <minecnly@gmail.com>
2019-06-25 15:28:52 +08:00
Andrew Morgan bc382bba46
Fix pipeline, emoji and syntax (#713)
Fixes #697

Switched to golangci-lint, fixes issues with buildkite and does some linting fixes to appease the new linters.
2019-06-19 14:05:03 +01:00
ruben 74827428bd use go module for dependencies (#594) 2019-05-21 21:56:55 +01:00