Two tweaks:
* `httpBackend.flush()` now returns a value, so we can't pass its result
straight into `done()`.
* In one of the megolm tests, we need to wait for the device query to finish
before marking the relevant device as known. One easy way to do this is
actually to try sending the message first - that will block until the device
query completes.
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.
Much of this transformation has been done automatically:
* add expect import to each file
* replace `not.to` with `toNot`
* replace `to[Not]Be{Undefined,Null}` with equivalents
* replace `jasmine.createSpy(...)` with `except.createSpy`, and `andCallFake`
with `andCall`
Also:
* replace `jasmine.createSpyObj` with manual alternatives
* replace `jasmine.Clock` with `lolex`
Remove some we don't care about. Set some other ones we do care
about but don't currently adhere to to warn. Set the max warnings
threshold to the current number of warnings, so we don't introduce
more of them. Fix a bunch of legit lint errors and add exceptions
to various places in the test code that does funny things with
'this'.
If we have shared the session with a device which is subsequently blacklisted,
we need to start a new session for the next message.
Rather than doing this proactively (which would be subject to false-positives
and require slightly awkward tracking of who we had shared the session with),
we check the list of who we have shared the session with on each send, and
start a new session if any of them are blocked.
Fixes https://github.com/vector-im/riot-web/issues/2146.
Two main changes here:
* when we get an m.new_device event for a device we know about, ignore it
* Batch up the m.new_device events received during initialsync and spam out
all the queries at once.
Instead of trying to maintain a list of devices we need to share with, just
check all the devices for all the users on each send.
This should fix https://github.com/vector-im/vector-web/issues/2568, and
generally mean we're less likely to get out of sync.