Commit Graph

42 Commits

Author SHA1 Message Date
David Langley
491f0cd08a
Change license (#13)
* Copyright headers 1

* Licence headers 2

* Copyright Headers 3

* Copyright Headers 4

* Copyright Headers 5

* Copyright Headers 6

* Copyright headers 7

* Add copyright headers for html and config file

* Replace license files and update package.json

* Update with CLA

* lint
2024-09-09 13:57:16 +00:00
David Langley
70665d3ce3
RTE drafts (#12674)
* Add drafts to the RTE and tests

* test drafts in threads

* lint

* Add unit test.

* Fix test failure

* Remove unused import

* Clean up wysiwyg drafts and add test.

* Fix typo

* Add timeout to allow for wasm loading.

---------

Co-authored-by: Florian Duros <florian.duros@ormaz.fr>
2024-08-22 12:54:01 +00:00
David Langley
e6835fe9d2
Clean up editor drafts for unknown rooms (#12850)
* Clean up editor drafts for unknown rooms and add tests.

* lint

* Call cleanUpDraftsIfRequired when we know a live update has completed.

* Fix test for new call site of draft cleaning

* fix test
2024-08-07 08:35:57 +00:00
Michael Telatynski
8285283cc3
Make tests more resilient for React 18 upgrade (#12861)
* Make tests more resilient for React 18 upgrade

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>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Delint

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-08-06 17:22:02 +00:00
Timo
5c26d580d8
Fix widgets not being cleaned up correctly. (#12616)
* Fix widgets not being cleaned up correctly.

Widgets could persist forever because they were still sticky when we end the messaging.
Ending the messaging emits an event to which we connect ui changes that move the widget out of the screen. It does not end up in a pip view however.

So we need to make sure the widget is not persistend anymore when we call `stopMessagingByUid` so that any dom changes that remove the AppTile happen when the widget is not persistend anymore and let it destroy.

This PR also makes the role for `MatrixRTCSessionManager` more strict. We do ONLY use it in `Call.ts` and `CallStore`  so that we dont end up in reaces where we updated the ui based on the session manager but not in sync with the call and callstore changes.

Rename activeCalls to connectedCalls. Active call can also be understood as a call where there are active participants but the user itself is not connected. Especially with the `hasActiveCallSession` field of the useRoomCall hook which is tracking active (not necassarly connected sessions)

* rest of the renaming

* fix test to adapt to reduced session manager event usage.
2024-06-17 11:00:41 +00:00
Hubert Chathi
eed8d1538b
Add more encryption properties to PostHog (#12415)
* report time to decrypt an event if it's slow

* add more stats

* fix some tests

* keep original timestamp, and report non-visible decryption failures

* add statistic for whether the user trusts their own device

* revert local playwright docker changes

* apply changes from review

* also remove logout event handler on logout

* apply changes from review

* make eventDecrypted callback private
2024-05-16 00:25:58 +00:00
Michael Telatynski
580bb5537d
OIDC: pass id_token via id_token_hint on Manage Account interaction (#12499)
* Store id_token rather than just id_token_claims

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Pass id_token via `id_token_hint` on `Manage Account` interaction

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-05-07 11:27:37 +00:00
Travis Ralston
d25d529e86
Extract functions for service worker usage, and add initial MSC3916 playwright test (when supported) (#12414)
* Send user credentials to service worker for MSC3916 authentication

* appease linter

* Add initial test

The test fails, seemingly because the service worker isn't being installed or because the network mock can't reach that far.

* Remove unsafe access token code

* Split out base IDB operations to avoid importing `document` in serviceworkers

* Use safe crypto access for service workers

* Fix tests/unsafe access

* Remove backwards compatibility layer & appease linter

* Add docs

* Fix tests

* Appease the linter

* Iterate tests

* Factor out pickle key handling for service workers

* Enable everything we can about service workers

* Appease the linter

* Add docs

* Rename win32 image to linux in hopes of it just working

* Use actual image

* Apply suggestions from code review

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* Improve documentation

* Document `??` not working

* Try to appease the tests

* Add some notes

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-05-02 22:19:55 +00:00
David Baker
281916fd96
Take the Threads Activity Centre out of labs (#12439)
* Take the TAC out of labs!

Requires https://github.com/matrix-org/matrix-react-sdk/pull/12438
and ideally https://github.com/matrix-org/matrix-react-sdk/pull/12418

* i18n

* Add test method

That's needed now we we don't include threads in the notif count in the tests

* One less labs setting

* Update snapshot

* Disable release announcement

* Unused import

* Fix some screenshots

* Fix all the unread test cases now room unreads don't include threads

* Fix more tests

* Even more test fixes

* Still more test fixes

* Oh goodness, it's more test fixes

* Fix selectors now there are 2 buttons called Threads

* Disable some tests that aren't passing

for reasons that don't appear releated to any of the TAC work, as
per the comment.

* Remove debugging

* Oops, removed too much
2024-04-29 15:30:19 +00:00
Richard van der Hoff
5ed68efa6c
New context for local device verification (#12417)
* New context for local device verification

* Fix up tests

* Use PropsWithChildren
2024-04-16 09:43:27 +00:00
David Baker
59395abb6b
Focus the thread panel when clicking on an item in the TAC (#12410)
* Focus the thread panel when clicking on an item in the TAC

actually the 'close' button in the threads panel as it's the only
interactive element: we can improve this later when we use landmarks
& generally have better a11y.

* Undo minor refactoring

as none of it is test3ed, it's not worth it.

* add unit test

* Add matrixchat tests

* Needs awaits

* ts-ignore

* Fix test (I think...)

* Remove unnecessary value set

* Not how assignments work
2024-04-10 13:13:08 +00:00
Michael Telatynski
7b1e8e3d2f
Update MSC2965 OIDC Discovery implementation (#12245)
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2024-02-23 16:43:14 +00:00
Michael Telatynski
36c07be889
Fix OIDC delegated auth account url check (#12242)
* Fix OIDC delegated auth account url check

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-02-13 09:11:50 +00:00
Valere
cb7fd5118e
SettingsStore: Change feature_rust_crypto to default true (#12203)
* Set default crypto stack to rust

* Update test for default to rust crypto

* Fix labs settings tests

* Fix test not working with rust crypto
2024-02-02 12:20:13 +00:00
Michael Telatynski
4e68b91515
Fix OIDC bugs due to amnesiac stores forgetting OIDC issuer & other data (#12166)
* Fix OIDC bugs due to amnesiac stores forgetting OIDC issuer & other data

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Fix tests

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2024-01-23 13:34:10 +00:00
Richard van der Hoff
db7f0ba69a
Update tests not to mock out an ancient server (#12081)
Some of our tests, which mock a `/versions` response, currently mock the
response of a 2-year-old server. This will soon be incompatible with the
JS-SDK. Update the tests in preparation.
2024-01-05 13:24:00 +00:00
Milton Moura
76b7aa2d33
Keep device language when it has been previosuly set, after a successful delegated authentication flow that clears localStorage (#11902)
* Do not remove the language when clearing local storage

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

* Revised comment on getting the defined language from settings

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

* Explicitly checking for language set at the device level

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

* Add test that checks if device language setting is kept after a successfull delegated authentication flow

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

* Adds test for unhappy path and adjusts to use the SettingsStore instead of going directly to localStorage

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

* Removing unnecessary variable after test refactor

Signed-off-by: Milton Moura <miltonmoura@gmail.com>

---------

Signed-off-by: Milton Moura <miltonmoura@gmail.com>
2023-11-24 15:51:28 +00:00
Michael Weimann
ecc46aeb8c
Update open in other tab message (#11916) 2023-11-22 10:46:11 +00:00
Timo
860764c057
Use new matrixRTC calling (#11792)
* initial

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanup1

Signed-off-by: Timo K <toger5@hotmail.de>

* bring back call timer

Signed-off-by: Timo K <toger5@hotmail.de>

* more cleanup and test removals

Signed-off-by: Timo K <toger5@hotmail.de>

* remove event

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanups and minor fixes

Signed-off-by: Timo K <toger5@hotmail.de>

* add matrixRTC to stubClient

Signed-off-by: Timo K <toger5@hotmail.de>

* update tests (some got removed)
The removal is a consequence of EW now doing less call logic.
More logic is done by the js sdk (MatrixRTCSession)
And therefore in EC itself.

Signed-off-by: Timo K <toger5@hotmail.de>

* cleanups

Signed-off-by: Timo K <toger5@hotmail.de>

* mock the session

Signed-off-by: Timo K <toger5@hotmail.de>

* lint

Signed-off-by: Timo K <toger5@hotmail.de>

* remove GroupCallDuration

Signed-off-by: Timo K <toger5@hotmail.de>

* review and fixing tests

Signed-off-by: Timo K <toger5@hotmail.de>

---------

Signed-off-by: Timo K <toger5@hotmail.de>
2023-10-30 15:14:27 +00:00
Kerry
1d9c24e96e
OIDC: add friendly errors (#11184)
* add delegatedauthentication to validated server config

* dynamic client registration functions

* test OP registration functions

* add stubbed nativeOidc flow setup in Login

* cover more error cases in Login

* tidy

* test dynamic client registration in Login

* comment oidc_static_clients

* register oidc inside Login.getFlows

* strict fixes

* remove unused code

* and imports

* comments

* comments 2

* util functions to get static client id

* check static client ids in login flow

* remove dead code

* OidcRegistrationClientMetadata type

* navigate to oidc authorize url

* exchange code for token

* navigate to oidc authorize url

* navigate to oidc authorize url

* test

* adjust for js-sdk code

* login with oidc native flow: messy version

* tidy

* update test for response_mode query

* tidy up some TODOs

* use new types

* add identityServerUrl to stored params

* unit test completeOidcLogin

* test tokenlogin

* strict

* whitespace

* tidy

* unit test oidc login flow in MatrixChat

* strict

* tidy

* extract success/failure handlers from token login function

* typo

* use for no homeserver error dialog too

* reuse post-token login functions, test

* shuffle testing utils around

* shuffle testing utils around

* i18n

* tidy

* Update src/Lifecycle.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* tidy

* comment

* update tests for id token validation

* move try again responsibility

* prettier

* add friendly error messages for oidc authorization failures

* i18n

* update for new translations, tidy

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2023-10-19 02:46:37 +00:00
Kerry
feb7e9899b
OIDC: persist id token claims (#11691)
* persist idTokenClaims

* tests

* remove unused cde
2023-10-04 05:06:04 +01:00
Will Hunt
677854d318
Fix start_sso / start_cas URLs failing to redirect to a authentication prompt (#11681)
* Show screen before login if using start_sso or start_cas

* Add tests

* Fix lint

* Fix lint

* Add one for CAS

* prettier
2023-10-03 15:19:54 +00:00
Richard van der Hoff
839c0a720c
Lock out the first tab if Element is opened in a second tab. (#11425)
* Implement session lock dialogs

* Bump analytics-events package

* clean up resetJsDomAfterEach

* fix types

* update snapshot

* update i18n strings
2023-08-24 08:28:43 +00:00
Richard van der Hoff
4a5b686aaa
Update MatrixChat-test to restoreAllMocks after each test (#11424)
* Update MatrixChat to  `restoreAllMocks` after each test

This helps keep tests independent.

* more MatrixChat fixes
2023-08-17 19:06:45 +00:00
Richard van der Hoff
523e691136
MatrixChat-test: stop mocking localStorage (#11419)
We have a perfectly good localStorage impl; no need to do a half-arsed mock of
it.
2023-08-16 16:28:46 +00:00
Richard van der Hoff
7a6d81c3b8
Update Jest to more recent release (#11409)
* Update Jest to more recent release

I want to use things like `jest.advanceTimersByTimeAsync`

* more jest updates

* add dep on types/prettier

* fix LegacyRoomHeader-test

* fix MatrixChat-test

* fix RoomView-test

* fix PollHistory-test

* update SidebarUserSettingsTab-test

* fix PipContainer-test

* fix UserOnboardingPage-test

* fix WidgetContextMenu-test.tsx

* Avoid `mockImplementation` for mock `matchMedia` impl

`mockImplementation` is (now) reset by `jest.resetAllMocks` and
`jest.restoreAllMocks`, which we don't really want here.

Fixes `theme-test`

* Move `mediaDevices` mock out of `setupManualMocks`

This doesn't work well in test suites with multiple tests, because the
`mockReturnValue` is reset for subsequent tests.

In any case, having it mocked out automagically is *magical*. Let's make it
opt-in.

* fix FormattingButtons-test.tsx

* fix DeviceListenerTest

* fix RoomTile-test
2023-08-16 10:20:48 +00:00
Michael Telatynski
0842559fb2
Simplify registration with email validation (#11398) 2023-08-15 16:14:53 +01:00
Richard van der Hoff
672ad98ec7
Clean up the MatrixChat initSession code (#11403)
`async` functions are a thing, and they make this much more comprehensible.
2023-08-14 12:52:08 +00:00
Travis Ralston
180fcaa70f
Support Matrix 1.1 (drop legacy r0 versions) (#9819)
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2023-08-14 09:25:13 +01:00
Michael Telatynski
ef385e6028
Switch to importing more things from the main js-sdk export (#11377) 2023-08-10 08:01:14 +00:00
Michael Telatynski
c3574c2050
Switch to importing client from main js-sdk export (#11370) 2023-08-09 07:18:41 +00:00
Kerry
5636a9f7ca
Unit test logout action in MatrixChat (#11303)
* test logout action in MatrixChat

* add restore all mocks
2023-07-28 02:25:18 +00:00
Kerry
0b0d77cbcc
OIDC: Persist details in session storage, create store (#11302)
* utils to persist clientId and issuer after oidc authentication

* add dep oidc-client-ts

* persist issuer and clientId after successful oidc auth

* add OidcClientStore

* comments and tidy

* format
2023-07-20 21:30:19 +00:00
Kerry
7b3d0ad209
OIDC: Log in (#11199)
* add delegatedauthentication to validated server config

* dynamic client registration functions

* test OP registration functions

* add stubbed nativeOidc flow setup in Login

* cover more error cases in Login

* tidy

* test dynamic client registration in Login

* comment oidc_static_clients

* register oidc inside Login.getFlows

* strict fixes

* remove unused code

* and imports

* comments

* comments 2

* util functions to get static client id

* check static client ids in login flow

* remove dead code

* OidcRegistrationClientMetadata type

* navigate to oidc authorize url

* exchange code for token

* navigate to oidc authorize url

* navigate to oidc authorize url

* test

* adjust for js-sdk code

* login with oidc native flow: messy version

* tidy

* update test for response_mode query

* tidy up some TODOs

* use new types

* add identityServerUrl to stored params

* unit test completeOidcLogin

* test tokenlogin

* strict

* whitespace

* tidy

* unit test oidc login flow in MatrixChat

* strict

* tidy

* extract success/failure handlers from token login function

* typo

* use for no homeserver error dialog too

* reuse post-token login functions, test

* shuffle testing utils around

* shuffle testing utils around

* i18n

* tidy

* Update src/Lifecycle.ts

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>

* tidy

* comment

* update tests for id token validation

* move try again responsibility

* prettier

* use more future proof config for static clients

* test util for oidcclientconfigs

* rename type and lint

* correct oidc test util

* store issuer and clientId pre auth navigation

* adjust for js-sdk changes

* update for js-sdk userstate, tidy

* update MatrixChat tests

* update tests

---------

Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
2023-07-11 04:09:18 +00:00
Michael Telatynski
a294ba2ad4
Conform more of the codebase to strictNullChecks + noImplicitAny (#11179) 2023-07-04 14:49:27 +01:00
Kerry
a87362a048
Unit test token login flow in MatrixChat (#11143)
* test tokenlogin

* whitespace

* tidy

* strict
2023-06-27 23:45:11 +00:00
Kerry
79a7b9aedc
Don't setup keys on login when encryption is force disabled (#11125)
* move shouldForceDisableEncryption to /crypto

* dont setup encryption when encryption is force disabled

* shuffle testing functions

* test post login security setup flows

* remove debug

* lint fixes

* strict fixes

* strict fixes p2

---------

Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
2023-06-27 09:42:31 +00:00
Kerry
0eda8c17d5
Unit test post-login security setup flows in MatrixChat (#11126)
* shuffle testing functions

* test post login security setup flows

* remove debug

* strict fixes

* strict fixes p2
2023-06-22 20:57:16 +00:00
Michael Telatynski
ea0e9abc2b
Allow specifying help URLs in config.json (#11070)
* Allow specifying help URLs in config.json

* Fix test
2023-06-14 07:45:19 +00:00
Kerry
ef8719aba7
unit test leave room action handler (#10982) 2023-05-30 22:46:08 +00:00
Kerry
530197bfcd
Move session manager out of beta (#10968)
* remove old device manager

* undo type fix for cypress crypto

* update test case
2023-05-26 01:58:28 +00:00
Kerry
02bf39cc72
Add basic unit test setup for MatrixChat (#10971)
* mock enough things to get to welcome page

* lint

* add simple test for view room settings action

* fussy spacing

* some strict fixes
2023-05-25 02:35:22 +00:00