As explained in the comment. I've added it to the end so this should
be completely backwards compatible (although it would be much nicer
if it were the first arg, probably).
* Stop doing O(n^2) work to find event's home
In certain rooms (e.g. with many state changes hidden via user preferences), the
events array presented to `eventShouldLiveIn` may contain 100s of events. As
part of its various checks, `eventShouldLiveIn` would get an event's associated
ID (reply / relation / redaction parent). It would then use `events.find` to
search the entire (possibly large) `events` array to look for the parent. (This
by itself seems sub-optimal and should probably change to use a map.)
For many events in a room, there is no associated ID. Unfortunately,
`eventShouldLiveIn` did not check whether the associated ID actually exists
before running off to search all of `events`, resulting in O(n^2) work.
This changes `eventShouldLiveIn` to first check that there is an associated ID
before proceeding with its (slow) search. For some rooms, this change
drastically improves performance from ~100% CPU usage to nearly idle.
Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
* Add type to `parentEvent`
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: J. Ryan Stinnett <jryans@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Send one time key count and unused fallback keys for rust-crypto
* Add tests
* Remove useless type in promise return
* Add test for one time key upload
* Fix rust-crypto.spec.ts tests
* Remove unneeded code in test
* Add key upload request test
* Fix tests
* crypto.spec.ts: factor out `expactAliceKeyClaim` utility
* Add a new test for event encryption
... one that actually works on the rust SDK.
* Bump matrix-sdk-crypto-js version
... to pick up recent fixes to race conditions
Putting the new request inside a `finally` block meant we would never actually
transition the promise chain from failure to success. Sticking a no-op `catch`
in the chain makes sure that we can recover from an error.
* Refactor the room key handling method
* Fix the forwarded room key test to use the same user ids.
We have some tests that check if receiving a forwarded room key works.
These claim to use the same user id, but in fact they change the user id
in the last moment before the event is passed into the client.
Let's change this so we're always operating with the same user id.
* Stop requesting room keys from other users
We never accept such room keys, so there isn't a point in requesting
them.
* fixup! Refactor the room key handling method
* Apply suggestions from code review
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* fixup! Refactor the room key handling method
* fixup! Apply suggestions from code review
* fixup! Refactor the room key handling method
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* groupCall: add configuration param to allow no audio and no camera
* groupCall: enable datachannel to do no media group calls
* groupCall: changed call no media property as object property
* groupCall: fix existing unit tests
* groupCall: remove not needed flag
* groupCall: rename property to allow no media calls
* groupCall: mute unmute even without device
* groupCall: switch to promise callbacks
* groupCall: switch to try catch
* test: filter dummy code from coverage
* test: extend media mute tests
* groupCall: move permission check to device handler
* mediaHandler: add error in log statement
* v2 of MSC3903 implementation
This is a deliberate breaking change on an unstable feature.
* Reinstate v1 support to make this a non-breaking change
Deprecates several experimental types
* Remove MSC3903 v1 support
This is a breaking change in code marked unstable/experimental
Revert "Reinstate v1 support to make this a non-breaking change"
This reverts commit 89773458b9.
* v2 of MSC3903 implementation
This is a deliberate breaking change on an unstable feature.
* Test correct protocol version
* Fix up test
* v2 of MSC3903 implementation
This is a deliberate breaking change on an unstable feature.
* Test correct protocol version
* Fix up test
* Reinstate v1 support to make this a non-breaking change
Deprecates several experimental types
* Add comments.
* Implment MSC3873 to handle escaped dots in keys.
* Add some comments about tests.
* Clarify spec behavior.
* Fix typo.
* Don't manually iterate string.
* Clean-up tests.
* Simplify tests.
* Add more tests & fix bug with empty parts.
* Add more edge cases.
* Add a regular expression solution.
This is ~80% slower than the basic split(".").
* Split on a simpler regular expression.
This is ~50% slower than a simple split(".").
* Remove redundant case in regex.
* Enable sticky regex.
* Rollback use of regex.
* Cache values in the PushProcessor.
* Use more each in tests.
* Pre-calculate the key parts instead of caching them.
* Fix typo.
* Switch back to external cache, but clean out obsolete cached values.
* Remove obsolete property.
* Remove more obsolete properties.