1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00
Commit Graph

707 Commits

Author SHA1 Message Date
Richard van der Hoff
6a6db36088 delintificate 2016-02-16 16:14:45 +00:00
Richard van der Hoff
6f3bdcfbb6 Remember to propagate Room.redaction 2016-02-16 16:03:40 +00:00
Richard van der Hoff
4c6d0a5128 Redactions: only remove the keys that are specced for removal 2016-02-16 16:03:18 +00:00
Richard van der Hoff
5eff278454 Keep redacted events in the timeline
Everything gets confused when we remove events from timelines, so keep
redacted events in there, and mark them as redacted instead.
2016-02-16 12:05:13 +00:00
David Baker
8614632e54 No ES6 in the JS SDK and other lint warnings. 2016-02-10 10:48:03 +00:00
David Baker
c3796c61cd Use a promise for when the connection comes back 2016-02-10 10:40:42 +00:00
David Baker
6224aff882 improve comment as per PR review 2016-02-10 10:09:39 +00:00
David Baker
e506a1b2de Oops: set keepAliveTimer! 2016-02-09 17:39:30 +00:00
David Baker
b40a6d1481 remember bound function as it returns a new reference each time 2016-02-09 17:06:20 +00:00
David Baker
3cfc4f8ba5 Add short delay to treating a 400 as a success to avoid hammering in a loop. 2016-02-09 16:17:52 +00:00
David Baker
4d46251b15 Just use the keepalive logic to recover from lost internet connections.
* This should fix the problem where we could end up with two concurrent syncs
   due to both retrying /sync and hitting /versions. There is now one and only
   one mechanism for connection recovery.
 * Hit /versions a little less often as I think every 2 seconds is a little
   over-aggressive. Also introduce randomness to minimize possibility of
   thundering herds.
 * Add a listener for the 'online' event in case any browser is nice enough
   to ever fire it.
 * Treat a 400 response from /versions as successful since older synapses
   will not support it.
2016-02-09 16:08:14 +00:00
David Baker
977e33f1bd Merge pull request #76 from matrix-org/dbkr/sync_gutwrench_less
Change the sync state tracking slightly to gut-wrench client a bit less
2016-02-08 14:18:59 +00:00
David Baker
daa0e6291e Add docs for STOPPED state and correct js doc 2016-02-08 14:18:15 +00:00
Daniel Wagner-Hall
02196416e4 Use /r0 or /unstable for all requests 2016-02-08 11:15:30 +00:00
Richard van der Hoff
76c79ec299 Check old timelines when looking for echoes of sent messages
After /send completes, we check the room to see if the echo has already come
back via /sync. It's a bit of an edge-case, but we ought to check all
timelines, not just the live one.

Furthermore, we now have a map from eventId to timeline, so we can handle the
case where the echo has *not* yet come back more efficiently than searching
through the whole timeline.
2016-02-05 17:31:46 +00:00
David Baker
fc730d4637 remove unintentional log line 2016-02-05 14:13:14 +00:00
David Baker
41d5917bb6 Change the sync state tracking slightly to gut-wrench client a bit less
Should be functionally identical outside of client and sync.
2016-02-05 14:09:58 +00:00
Richard van der Hoff
f3e5e03009 Give precedence to later Read Receipts
In order to resolve the conflict between local and remote read-receipts, try to
give precedence to the read-receipt which refers to the most recent event.

Also fix the read-receipt synthesis in _addLiveEvents so that it actually works
(drop the spurious MatrixEvent wrapper), and remove the synthesis in
recalculate() (which appears to be redundant).
2016-02-04 15:35:27 +00:00
Richard van der Hoff
1b43e5ed98 Merge pull request #74 from matrix-org/rav/fix_localecho_timeline_bug
Fix a bug which made the timelines get confused about local messages
2016-02-03 15:41:52 +01:00
Richard van der Hoff
8ee1d17ff7 Fix a bug which made the timelines get confused about local messages
Make sure that the timeline index is kept consistent when the id of an event
changes when we receive the remote echo of a message we sent.
2016-02-03 11:56:09 +00:00
Richard van der Hoff
a2185fefc1 Make sure we don't end up calling /messages in a loop if things go weird
If we somehow end up in a situation where calling /messages returns a load
of messages, but none of them are new, then currently we start calling
/messages again and again in a tight loop. This is bad, so fix it.
2016-02-03 11:47:04 +00:00
David Baker
8a77b29d17 Add docs to getRoom noting how you shouldn't assume it will return something because you've got a Room-like event 2016-02-02 16:30:28 +00:00
Richard van der Hoff
0a7efe3e8b Fix undefined variable accesses
fix a merge error in the last commit
2016-01-30 00:44:40 +00:00
Richard van der Hoff
2af947fc1a Stash the old next_batch token for pagination
When we reset the live timeline due to a limited sync, stash next_batch as the
pagination token so that we can work forward to the new live timeline.

(Note that this requires matrix-org/synapse#535)
2016-01-30 00:12:31 +00:00
Richard van der Hoff
1499087098 TimelineWindow: fix canPaginate during load
We should return false rather than throw an exception if someone calls
canPaginate before the timeline finishes loading.
2016-01-30 00:09:12 +00:00
David Baker
3d5e2937e2 docstring 2016-01-29 11:29:14 +00:00
David Baker
bbf3b2637a Re-apply: 5297855ad3
Separate the actual processing of the sync response from the loop doing the requests.
2016-01-29 11:25:01 +00:00
David Baker
04a1c4f1a2 Revert "Separate the actual processing of the sync response from the loop doing the requests."
This reverts commit 5297855ad3.

Accidentally committed to wrong branch
2016-01-29 11:17:12 +00:00
David Baker
5297855ad3 Separate the actual processing of the sync response from the loop doing the requests. 2016-01-29 11:05:32 +00:00
Richard van der Hoff
8db95f42fb Add some unit tests for TimelineWindow. 2016-01-28 16:38:45 +00:00
Richard van der Hoff
b42e5d5fcf Address review comments
Rearrange a couple of things for clarity, and add some comments.
2016-01-28 12:36:12 +00:00
Richard van der Hoff
b1e2090eef TimelineWindow object
A handy thing for tracking a window into a room timeline

Could really do with some unit tests... sorry.
2016-01-27 09:53:15 +00:00
Richard van der Hoff
3c2fad7c8d Merge remote-tracking branch 'origin/develop' into rav/context 2016-01-27 09:49:00 +00:00
Richard van der Hoff
a87cefa035 Replace the boolean args on EventTimeline methods with constants 2016-01-26 22:38:26 +00:00
Richard van der Hoff
a01501b42c Address a number of review comments.
Make sure that room state is copied correctly when resetting the live
timeline.

Also comments and bits.
2016-01-26 18:09:15 +00:00
David Baker
0c3abcccf2 camelCase 2016-01-26 14:11:36 +00:00
Richard van der Hoff
48d1bc3158 Fix incompatibility with peeking.
The peek code needs to make sure it sets the pagination token /after/ adding
the events to the timeline, otherwise it will get reset when the events
are added.
2016-01-26 11:21:49 +00:00
David Baker
15e8784daf Add local echo for read receipts. Fixes https://github.com/vector-im/vector-web/issues/623 2016-01-25 17:49:41 +00:00
Richard van der Hoff
840b8f0bc0 Merge branch 'develop' into rav/context
Conflicts:
	lib/models/room.js
2016-01-25 10:45:22 +00:00
Kegan Dougal
f8ec35691f Interrupt /sync backoff when keep-alive succeeds in order to immediately retry if we were waiting 2016-01-21 18:02:26 +00:00
Kegan Dougal
c5e7df8975 Hit /versions instead of / since it is actually a known endpoint 2016-01-21 17:52:52 +00:00
Kegan Dougal
7bdab05785 Unbreak tests 2016-01-21 17:34:12 +00:00
Kegan Dougal
197144dcda Implement a keep-alive timer for /sync requests
When a /sync request fails, we spin up a keep-alive poll to /_matrix/client/r0
which 400s. We treat any HTTP response code as a success for the purposes of
polling the server. When a successful poll is done, we shoot the current /sync
request in the head immediately (via a hacky abort() on the promise) and retry
the /sync.
2016-01-21 17:17:27 +00:00
Kegan Dougal
ff990914b2 Remove low client-side timeouts hack 2016-01-21 16:12:07 +00:00
David Baker
1f1d743678 Merge remote-tracking branch 'origin/develop' into dbkr/new_unread_count_format 2016-01-21 09:50:20 +00:00
Matthew Hodgson
24655ac60e missing semicolon 2016-01-21 00:02:24 +00:00
Matthew Hodgson
eaf7b03bb1 if we are the only person in a room, call it an 'Empty room' too, given this is how humans see a room if they're the only person in it... 2016-01-20 23:55:09 +00:00
David Baker
a24a9d35c4 Fix PR comments: typos and redundant line 2016-01-20 18:52:32 +00:00
David Baker
b4e4aaff00 Merge branch 'develop' into dbkr/new_unread_count_format 2016-01-20 17:25:54 +00:00
Matthew Hodgson
3a73b54e4a .name defaults to mxid 2016-01-20 17:22:16 +00:00