* Switch sliding sync support to simplified sliding sync
Experimental PR to test js-sdk with simlified sliding sync.
This does not maintain support for regulaer sliding sync.
* Remove txn_id handling, ensure we always resend when req params change
* Fix some tests
* Fix remaining tests
* Mark TODOs on tests which need to die
* Linting
* Make comments lie less
* void
* Always sent full extension request
* Fix test
* Remove usage of deprecated field
* Hopefully fix DM names
* Refactor how heroes are handled in Room
* Fix how heroes work
* Linting
* Ensure that when SSS omits heroes we don't forget we had heroes
Otherwise when the room next appears the name/avatar reset to
'Empty Room' with no avatar.
* Check the right flag when doing timeline trickling
* Also change when the backpagination token is set
* Remove list ops and server-provided sort positions
SSS doesn't have them.
* Linting
* Add Room.bumpStamp
* Update crypto wasm lib
For new functions
* Add performance logging
* Fix breaking change in crypto wasm v8
* Update crypto wasm for breaking changes
See https://github.com/matrix-org/matrix-rust-sdk-crypto-wasm/releases/tag/v8.0.0
for how this was mapped from the previous API.
* Mark all tracked users as dirty on expired SSS connections
See https://github.com/matrix-org/matrix-rust-sdk/pull/3965 for
more information. Requires `Extension.onRequest` to be `async`.
* add ts extension
* Fix typedoc ref
* Add method to interface
* Don't force membership to invite
The membership was set correctly from the stripped state anyway so
this was redundant and was breaking rooms where we'd knocked.
* Missed merge
* Type import
* Make coverage happier
* More test coverage
* Grammar & formatting
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove markAllTrackedUsersAsDirty from crypto API
Not sure why this was in there, seems like it just needed to be in
crypto sync callbacks, which it already was.
* Remove I from interface
* API doc
* Move Hero definition to room-summary
* make comment more specific
* Move internal details into room.ts
and make the comment a proper tsdoc comment
* Use terser arrow function syntax
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Move comment to where we do the lookup
* Clarify comment
also prettier says hi
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add tsdoc
explaining that the summary event will be modified
* more comment
* Remove unrelated changes
* Add docs & make fields optional
* Type import
* Clarify sync versions
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Make tsdoc comment & add info on when it's used.
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Rephrase comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Prettier
* Only fetch member for hero in legacy sync mode
* Split out a separate method to set SSS room summary
Rather than trying to fudge up an object that looked enough like the
old one that we could pass it in.
* Type import
* Make link work
* Nope, linter treats it as an unused import
* Add link the other way
* Add more detail to doc
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove unnecessary cast
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove length > 0 check
as it wasn't really necessary and may cause heroes not to be cleared?
* Doc params
* Remove unnecessary undefined comparison
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Put the comparison back
as it's necessary to stop typescript complaining
* Fix comment
* Fix comment
---------
Co-authored-by: Kegan Dougal <7190048+kegsay@users.noreply.github.com>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Remove deprecated calls in `webrtc/call.ts`
* Throw error when legacy call was used
* Remove `MatrixClient.initLegacyCrypto` (#4620)
* Remove `MatrixClient.initLegacyCrypto`
* Remove `MatrixClient.initLegacyCrypto` in README.md
* Remove tests using `MatrixClient.initLegacyCrypto`
* Remove legacy crypto support in `sync` api (#4622)
* Remove deprecated `DeviceInfo` in `webrtc/call.ts` (#4654)
* chore(legacy call): Remove `DeviceInfo` usage
* refactor(legacy call): throw `GroupCallUnknownDeviceError` at the end of `initOpponentCrypto`
* Remove deprecated methods and attributes of `MatrixClient` (#4659)
* feat(legacy crypto)!: remove deprecated methods of `MatrixClient`
* test(legacy crypto): update existing tests to not use legacy crypto
- `Embedded.spec.ts`: casting since `encryptAndSendToDevices` is removed from `MatrixClient`.
- `room.spec.ts`: remove deprecated usage of `MatrixClient.crypto`
- `matrix-client.spec.ts` & `matrix-client-methods.spec.ts`: remove calls of deprecated methods of `MatrixClient`
* test(legacy crypto): remove test files using `MatrixClient` deprecated methods
* test(legacy crypto): update existing integ tests to run successfully
* feat(legacy crypto!): remove `ICreateClientOpts.deviceToImport`.
`ICreateClientOpts.deviceToImport` was used in the legacy cryto. The rust crypto doesn't support to import devices in this way.
* feat(legacy crypto!): remove `{get,set}GlobalErrorOnUnknownDevices`
`globalErrorOnUnknownDevices` is not used in the rust-crypto. The API is marked as unstable, we can remove it.
* Remove usage of legacy crypto in `event.ts` (#4666)
* feat(legacy crypto!): remove legacy crypto usage in `event.ts`
* test(legacy crypto): update event.spec.ts to not use legacy crypto types
* Remove legacy crypto export in `matrix.ts` (#4667)
* feat(legacy crypto!): remove legacy crypto export in `matrix.ts`
* test(legacy crypto): update `megolm-backup.spec.ts` to import directly `CryptoApi`
* Remove usage of legacy crypto in integ tests (#4669)
* Clean up legacy stores (#4663)
* feat(legacy crypto!): keep legacy methods used in lib olm migration
The rust cryto needs these legacy stores in order to do the migration from the legacy crypto to the rust crypto. We keep the following methods of the stores:
- Used in `libolm_migration.ts`.
- Needed in the legacy store tests.
- Needed in the rust crypto test migration.
* feat(legacy crypto): extract legacy crypto types in legacy stores
In order to be able to delete the legacy crypto, these stores shouldn't rely on the legacy crypto. We need to extract the used types.
* feat(crypto store): remove `CryptoStore` functions used only by tests
* test(crypto store): use legacy `MemoryStore` type
* Remove deprecated methods of `CryptoBackend` (#4671)
* feat(CryptoBackend)!: remove deprecated methods
* feat(rust-crypto)!: remove deprecated methods of `CryptoBackend`
* test(rust-crypto): remove tests of deprecated methods of `CryptoBackend`
* Remove usage of legacy crypto in `embedded.ts` (#4668)
The interface of `encryptAndSendToDevices` changes because `DeviceInfo` is from the legacy crypto. In fact `encryptAndSendToDevices` only need pairs of userId and deviceId.
* Remove legacy crypto files (#4672)
* fix(legacy store): fix legacy store typing
In https://github.com/matrix-org/matrix-js-sdk/pull/4663, the storeXXX methods were removed of the CryptoStore interface but they are used internally by IndexedDBCryptoStore.
* feat(legacy crypto)!: remove content of `crypto/*` except legacy stores
* test(legacy crypto): remove `spec/unit/crypto/*` except legacy store tests
* refactor: remove unused types
* doc: fix broken link
* doc: remove link tag when typedoc is unable to find the CryptoApi
* Clean up integ test after legacy crypto removal (#4682)
* test(crypto): remove `newBackendOnly` test closure
* test(crypto): fix duplicate test name
* test(crypto): remove `oldBackendOnly` test closure
* test(crypto): remove `rust-sdk` comparison
* test(crypto): remove iteration on `CRYPTO_BACKEND`
* test(crypto): remove old legacy comments and tests
* test(crypto): fix documentations and removed unused expect
* Restore broken link to `CryptoApi` (#4692)
* chore: fix linting and formatting due to merge
* Remove unused crypto type and missing doc (#4696)
* chore(crypto): remove unused types
* doc(crypto): add missing link
* test(call): add test when crypto is enabled
* WIP support for state_after
* Fix sliding sync sdk / embedded tests
* Allow both state & state_after to be undefined
Since it must have allowed state to be undefined previously: the test
had it as such.
* Fix limited sync handling
* Need to use state_after being undefined
if state can be undefined anyway
* Make sliding sync sdk tests pass
* Remove deprecated interfaces & backwards-compat code
* Remove useless assignment
* Use updates unstable prefix
* Clarify docs
* Remove additional semi-backwards compatible overload
* Update unstable prefixes
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix test
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add test for MSC4222 behaviour
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Improve coverage
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Fix tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Tidy
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add comments to explain why things work as they are.
* Fix sync accumulator for state_after sync handling
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Revert "Fix room state being updated with old (now overwritten) state and emitting for those updates. (#4242)"
This reverts commit 957329b21821c0f632de6c04fff53144f7c0e5dd.
* Fix Sync Accumulator toJSON putting start timeline state in state_after field
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Update tests
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Add test case
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
* Iterate
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
---------
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Hugh Nimmo-Smith <hughns@matrix.org>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Co-authored-by: Timo <toger5@hotmail.de>
* Remove the compare function from utils
and change the one use of it to just intantiate a collator and use
it.
This was marked as internal module so this shouldn't be a breaking change.
Of course, react-sdk was using it.
Requires: https://github.com/matrix-org/matrix-react-sdk/pull/12782
* Add simple not-a-perf-test test
* recalculate repeatedly
otherwise we aren't testing anything different
* Use fewer members as it was making the test take a bit too long
* Fetch capabilities in the background
& keep them up to date
* Add missed await
* Replace some more runAllTimers
and round down the wait time for sanity
* Remove double comment
* Typo
* Add a method back that will fetch capabilities if they're not already there
* Add tests
* Catch exception here too
* Add test for room version code
* Fix highlights from threads disappearing on new messages
This changes interface of Room, so this is a BREAKING CHANGE.
Correctly mirrors the logic we use for room notifications for thread
notifications, ie. set only the total notifications count from the
server if it's zero.
I'm not delighted with this since it ends up with function on room
whose contract is to do something frankly, deeply weird and
unintuitive. However, this is the hack we use for room notifications
and it, empirically, works well enough. To do better, we'd need much
more complex logic to overlay notification counts for decrypted messages.
Fixes https://github.com/element-hq/element-web/issues/25523
* Add tests for the special notification behaviour in syncing
* Correctly copy the room logic for reseting notifications
We were always ignoring the highlight count, even for encrypted rooms,
which was broken because we don't do the local calculation for unencrypted
rooms.
* WIP fix for bugs first-thread-reply bugs
* Add re-emitter before we start adding events, as per comment
* Add test for notification bug
* Test for the bug that caused the dot to be the wrong colour
* Add comment
* elaborate
* Fix outdated comment
* Also fix this comment
* Fix another comment
* Fix typo
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Clarify comment
* More comment
* so much comment
also reformat (the bit that's actually added is s/it/this.addEvents/)
* The comments
* Maybe make comment clearer.
* Add comment about potential race
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Introduce Membership TS type
* Adapt the Membership TS type to be an enum
* Add docstrings for KnownMembership and Membership
* Move Membership types into a separate file, exported from types.ts
---------
Co-authored-by: Stanislav Demydiuk <s.demydiuk@gmail.com>
* fix automatic DM avatar with functional members
* update comments
* lint
* add tests for functional members
* keep functional members out of the public API
- remove public API for functional members, reverting most of 0ce2d82, f9b41f6, e65fb24
- remove tests for functional members public API c114bf5
- add shared functional members getter for both room name and avatar fallback generation
* filter functional members from more candidates
- remove from hero(es)
- remove from previous members
* add tests for fallback avatars with functional members
* Add docstring for getFunctionalMembers
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* inline getInvitedAndJoinedFunctionalMemberCount
* update comments for getAvatarFallbackMember
* use correct list of heroes in getAvatarFallbackMember
* remove redundant type annotation
* optimize performance of invitedAndJoinedFunctionalMemberCount
* calculate nonFunctionalMemberCount in one step
instead of iterating redundantly
* clean up functional member tests with review feedback
* lint
* Update src/models/room.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* apply feedback about comments
* non-functional per review, lint
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Ignore receipts pointing at missing or invalid events
* Remove extra whitespace from log message
* Unit tests for ignoring invalid receipts
* Improve comments around getEventReadUpTo
* Re-instate second param to compareEventOrdering in test
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Further improve comments around getEventReadUpTo
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Emit summary update event
* Add documentation
* Update RoomSummary event documentation
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Use sender instead of content.creator field on m.room.create events
* Restore room_version fields in fixtures
* Add test case for undefined sender scenario
* Ensure we don't overinflate the total notification count
By correctly comparing push rules before & after decryption
* DRY the code
* Testsssss
* Update tests
* Ensure non-thread relations to a thread root are actually in both timelines
* Make thread in sendReceipt & sendReadReceipt explicit rather than guessing it
* Apply suggestions from code review
* Fix Room::eventShouldLiveIn to better match Synapse to diverging ideas of notifications
* Update read receipt sending behaviour to align with Synapse
* Fix tests
* Fix thread rel type
* Do not assume that a relation lives in main timeline if we do not know its parent
* For pagination, partition relations with unknown parents into a separate bucket
And only add them to relation map, no timelines
* Make addLiveEvents async and have it fetch parent events of unknown relations to not insert into the wrong timeline
* Fix tests not awaiting addLIveEvents
* Fix handling of thread roots in eventShouldLiveIn
* Fix types
* Fix tests
* Fix import
* Stash thread ID of relations in unsigned to be stashed in sync accumulator
* Persist after processing
* Revert "Persist after processing"
This reverts commit 05ed6409b35f5e9bea3b699d0abcaac3d02588c5.
* Update unsigned field name to match MSC4023
* Persist after processing to store thread id in unsigned sync accumulator
* Add test
* Fix replayEvents getting doubled up due to Thread::addEvents being called in createThread and separately
* Fix test
* Switch to using UnstableValue
* Add comment
* Iterate
* Fix mark as unread button
* Revert to prefer the last event from the main timeline
* Refactor room test
* Fix type
* Improve docs
* Insert events to the end of the timeline
* Improve test doc
* Retry processing potential poll events after decryption
* Point `typedoc` at `matrix.ts`, not `index.ts` (#3239)
This gets rid of the rather pointless "default" module in the generated docs.
* Split up, rename, and move `ISecretStorageKeyInfo` (#3242)
* Move SecretStorageKeyInfo interfaces out to a new module
* Replace usages of ISecretStorageKeyInfo with SecretStorageKeyDescription
* Skip clear text non-poll events
---------
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* first cut poll model
* process incoming poll relations
* allow alt event types in relations model
* allow alt event types in relations model
* remove unneccesary checks on remove relation
* comment
* Revert "allow alt event types in relations model"
This reverts commit e578d84464403d4a15ee8a7cf3ac643f4fb86d69.
* Revert "Revert "allow alt event types in relations model""
This reverts commit 515db7a8bc2df5a1c619a37c86e17ccbe287ba7a.
* basic handling for new poll relations
* tests
* test room.processPollEvents
* join processBeaconEvents and poll events in client
* tidy and set 23 copyrights
* use rooms instance of matrixClient
* tidy
* more copyright
* simplify processPollEvent code
* throw when poll start event has no roomId
* updates for events-sdk move
* more type changes for events-sdk changes
* comment