1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-08-09 10:22:46 +03:00
Commit Graph

5348 Commits

Author SHA1 Message Date
Richard van der Hoff
54297cacd1 Fix race when downloading initial device change list
Fixes a problem if the user initiates a device query before the /changes
response comes back.
2017-02-13 18:33:02 +00:00
Richard van der Hoff
82f5997e61 Fix race condition in device list query
Fix a race where device list queries completing out-of-order could lead to us
thinking that we were more in-sync than we actually were.
2017-02-13 18:33:02 +00:00
David Baker
cd8dfa331a Fix the unban method
Which didn't work because of
https://github.com/matrix-org/synapse/issues/1860
2017-02-13 18:00:28 +00:00
Kegan Dougal
c7fdbd1c64 Persist notification counts and treat them as clobbers 2017-02-10 17:15:17 +00:00
Kegan Dougal
0b9bc2a7a7 Remove old (de)serialize stuff. Inline more things 2017-02-10 16:51:55 +00:00
Kegan Dougal
6949b6666e Revert non-functional changes to other files 2017-02-10 16:13:13 +00:00
Kegan Dougal
a380b6803a Merge branch 'develop' into kegan/indexeddb 2017-02-10 16:11:05 +00:00
Kegan Dougal
6696c712d3 Bug fixes with the accumualtor
- Only take invite_state as there is a Room attached to invite objects
  which then fail to be persisted.
- Store empty string state keys!
2017-02-10 15:19:50 +00:00
Kegan Dougal
0d4833d6e3 Make it all work! 2017-02-10 14:27:56 +00:00
Richard van der Hoff
207bce61ad Spread out device verification work
Avoid a big freeze when we process the results of a device query, by splitting
the work up by user.
2017-02-10 13:37:41 +00:00
Richard van der Hoff
bf2e6a33c2 Minor post-review tweaks 2017-02-10 10:37:46 +00:00
Richard van der Hoff
b66fed9ae9 Clean up/improve e2e logging
In an attempt to make the rageshake logs a bit more useful, try to make the
logging a bit saner. Firstly, make sure we log every decryption failure, and
log it exactly once, rather than in several places. Also record when we receive
megolm keys. Also add some more explicit logging in the sync loop.
2017-02-09 17:36:22 +00:00
Kegan Dougal
6e7b9472be Add a save() method to the store interface
Originally I just piggy-backed off setSyncToken() but this was]
non-obvious that depending on the store it might do writes to the
database. This was exacerbated by the fact that the save needs to
be done at the "right time" (after sync data is accumulated and
after the sync response has been processed) and setSyncToken was
being called too early.

A save() method fixes both these things.
2017-02-09 17:25:40 +00:00
Richard van der Hoff
e13ed6436e Fix decryption of events whose key arrives later
Re-fixes https://github.com/vector-im/riot-web/issues/2273.

And test it this time.
2017-02-09 16:12:43 +00:00
Kegan Dougal
db24690d9b Fix broken tests 2017-02-09 13:37:47 +00:00
Kegan Dougal
3a39fd23c4 Add glue code to hook up the sync accumulator
The user of the SDK is responsible for DIing the main components:

  let store = new IndexedDBStore(
    new IndexedDBStoreBackend(window.indexedDB),
    new SyncAccumulator(),
  });
  await store.startup();
  let client = matrix.createClient({store: store});
2017-02-09 12:49:10 +00:00
Kegan Dougal
ef57b88343 Remember next_batch tokens in the accumulator. Glue it in to SyncApi 2017-02-09 11:05:16 +00:00
Kegan Dougal
1e3fcdc109 Implement getJSON() 2017-02-09 10:50:31 +00:00
Kegan Dougal
606b9718a3 Implement timeline accumulation
Including pruning based on maxTimelineEntries
2017-02-09 10:14:10 +00:00
Kegan Dougal
ab6e30da28 Merge branch 'develop' into kegan/indexeddb 2017-02-09 09:57:36 +00:00
Richard van der Hoff
0baea5c1a6 Invalidate device lists when encryption is enabled in a room
Fixes https://github.com/vector-im/riot-web/issues/2672
2017-02-08 23:23:46 +00:00
Richard van der Hoff
bd07310e15 Remove redundant invalidation of our own device list
89ced198 added some code which flagged our own device list as in need of an
update. However, 8d502743 then added code such that we invalidate *all* members
of e2e rooms on the first initialsync - which should include ourselves. We can
therefore remove the redundant special-case, which mostly serves to simplify
the tests.
2017-02-08 23:04:23 +00:00
Richard van der Hoff
1c1ba58579 Don't force device list download on every message in olm room
we only really hit this in the tests, but it's a bit silly to download the
complete device list on every message.
2017-02-08 18:10:01 +00:00
Kegan Dougal
db20fc7831 Accumulate current room state 2017-02-08 15:08:38 +00:00
David Baker
7b43a34860 Merge pull request #357 from matrix-org/rav/search_no_undefined_keys
searchMessageText: avoid setting keys=undefined
2017-02-08 10:58:44 +00:00
Richard van der Hoff
ffeaf2dec0 searchMessageText: avoid setting keys=undefined
This doesn't make any difference to the JSON, but it upsets `expect`.
2017-02-08 09:20:23 +00:00
Richard van der Hoff
3277820381 realtime-callbacks: pass global as this
We had a test for this, but apparently it wasn't testing it right...
2017-02-08 07:34:30 +00:00
Kegan Dougal
c06ebd1e4a Implement /sync accumulation for everything but room timelines/state 2017-02-06 16:45:25 +00:00
Richard van der Hoff
6ca7661510 Fix some lint 2017-02-06 10:33:50 +00:00
Richard van der Hoff
5fd74109ff Fix device list update
s/flushNewDeviceRequests/refreshOutdatedDeviceLists/ - this got fixed on one PR
and apparenlty I failed to merge the changes correctly
2017-02-03 14:29:50 +00:00
Richard van der Hoff
a3cc8eb1f6 Include DeviceInfo in deviceVerificationChanged events
... to help the UI update itself
2017-02-03 14:27:08 +00:00
Richard van der Hoff
c3a8aeca42 Merge pull request #348 from matrix-org/rav/device_list_stream
Use the device change notifications interface
2017-02-03 12:49:33 +00:00
Richard van der Hoff
eaa95fb1e5 Merge pull request #347 from matrix-org/rav/rewrite_device_query_logic
Rewrite the device key query logic
2017-02-03 12:49:11 +00:00
Kegan Dougal
0e4eebbb39 Add bare bones SyncAccumulator class with comments 2017-02-03 11:42:04 +00:00
Richard van der Hoff
8441589ce6 Merge pull request #336 from matrix-org/matthew/blacklist-unverified
Support for blacklisting unverified devices, both per-room and globally
2017-02-03 10:26:59 +00:00
Matthew Hodgson
b99e1205c4 track errors when events can't send 2017-02-03 00:44:12 +00:00
Richard van der Hoff
8d502743a5 Refresh device list on startup
On initialsync, call the /keys/changes api to see which users have updated
their devices. (On failure, invalidate all of them).
2017-02-03 00:33:56 +00:00
Richard van der Hoff
732a764ec6 Refactor crypto initialsync handling
Pass a store into the Crypto object so that it doesn't need to make assumptions
about the EventEmitter, and use the new metadata on sync events to distinguish
between initialsyncs and normal syncs
2017-02-03 00:33:54 +00:00
Richard van der Hoff
9975786bac Store the token corresponding to the last device update in localstorage
... so that we can, in future, use it when restarting the client.
2017-02-03 00:32:24 +00:00
Richard van der Hoff
89ef4aa6e7 Handle device change notifications from /sync
When we get a notification from /sync that a user has updated their device
list, mark the list outdated, and then fire off a device query.
2017-02-03 00:32:16 +00:00
Richard van der Hoff
7e82ac3620 Merge branch 'develop' into rav/rewrite_device_query_logic 2017-02-03 00:12:46 +00:00
Richard van der Hoff
c3440c506c Address review comments
Update some comments, and s/flushNewDeviceRequests/refreshOutdatedDeviceLists/.
2017-02-03 00:10:13 +00:00
Matthew Hodgson
b6f3fc5466 Merge branch 'develop' into matthew/blacklist-unverified 2017-02-02 22:02:22 +00:00
Richard van der Hoff
6690f59410 Merge pull request #346 from matrix-org/rav/factor_out_devicelist
Factor out device list management
2017-02-02 19:40:27 +00:00
Richard van der Hoff
65e08b9633 Fix copyright 2017-02-02 19:39:40 +00:00
Kegan Dougal
f531b9fb21 Linting 2017-02-02 17:47:35 +00:00
Kegan Dougal
9581e48bcb Load/Store account data events 2017-02-02 17:41:49 +00:00
Kegan Dougal
ad9d58ebc2 Persist User objects. Back out everything else.
We can reasonable persist User and account data objects. Other
objects get into horrible circular loops. We'll rethink how this
is being done.
2017-02-02 17:25:20 +00:00
Kegan Dougal
896fc5a3f0 Periodically update the database
Triggered by /sync responses, rather than timers, but with a minimum
delay time (1m).
2017-02-02 14:54:07 +00:00
Richard van der Hoff
94addb6315 Rewrite the device key query logic
Only permit one query per user at a time.
2017-02-02 13:49:43 +00:00