* Add tests for unread notification facilities
Add some tests to guarantee some consistency in `useUnreadNotifications` and
`RoomNotificationState`.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Add RoomNotifs#determineUnreadState
Intended as a singular replacement for the divergent implementations before.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Unify room unread state determination
Have both the class-based facility and the hook use the new unified logic in
`RoomNotifs#determineUnreadState`.
Addresses https://github.com/vector-im/element-web/issues/24229
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
---------
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* noImplicitAny fixes for MessageDiffUtils
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Add tests for MessageDiffUtils
Adds mostly snapshot tests for MessageDiffUtils to guarantee consistent
behavior.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Strict mode fixes for MessageDiffUtils
Gets `MessageDiffUtils` to pass under `tsc --strict`.
Fixes https://github.com/vector-im/element-web/issues/23665 - no longer errors,
though it still isn't correct.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Remove obsolete DiffDOM workaround
Workaround is no longer necessary as of DiffDOM 4.2.1
See https://github.com/fiduswriter/diffDOM/issues/90
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
---------
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Strict typechecking fixes for Base/Member/Avatar
Update the core avatar files to pass `--strict --noImplicitAny` typechecks.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Add tests for Base/Member/Avatar
More thoroughly test the core avatar files. Not necessarily the most thorough,
but an improvement.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Extract TextAvatar from BaseAvatar
Extracted the fallback/textual avatar into its own component.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Use standard HTML for non-image avatars
Firefox users with `resistFingerprinting` enabled were seeing random noise
for rooms and users without avatars. There's no real reason to use data
URLs to present flat colors.
This converts non-image avatars to inline blocks with background colors.
See https://github.com/vector-im/element-web/issues/23936
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Have pills use solid backgrounds rather than colored images
Similar to room and member avatars, pills now use colored pseudo-elements
rather than background images.
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
---------
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* Support token authenticated registration
https://spec.matrix.org/v1.2/client-server-api/#token-authenticated-registration
Signed-off-by: Callum Brown <callum@calcuode.com>
* Backwards compatibility with unstable auth type
Some server installs are not updated to use the stable version
of the registration token authentication type, so also handle
the unstable version defined in MSC3231.
Signed-off-by: Callum Brown <callum@calcuode.com>
* Make LOGIN_TYPE public and readonly
Co-authored-by: Travis Ralston <travpc@gmail.com>
* Remove line related to skinning
Signed-off-by: Callum Brown <callum@calcuode.com>
* Change empty string to null
Signed-off-by: Callum Brown <callum@calcuode.com>
* Use "public"s for new code style
Signed-off-by: Callum Brown <callum@calcuode.com>
* Change input to AccessibleButton
Signed-off-by: Callum Brown <callum@calcuode.com>
* Add more detail regarding source of token
Signed-off-by: Callum Brown <callum@calcuode.com>
* Fix lint error
The text and button type will be the same every time
for registration tokens, unlike (possibly) for SSO.
Signed-off-by: Callum Brown <callum@calcuode.com>
* Change null back to ""
Due to the following warning when attempting to test:
> Warning: `value` prop on `input` should not be null.
> Consider using an empty string to clear the component or
> `undefined` for uncontrolled components.
Signed-off-by: Callum Brown <callum@calcuode.com>
* Disable submit button when no token entered
Signed-off-by: Callum Brown <callum@calcuode.com>
* Add test for registration tokens
Adapted from test/components/views/dialogs/InteractiveAuthDialog-test.tsx
Signed-off-by: Callum Brown <callum@calcuode.com>
* Fix linting errors
Signed-off-by: Callum Brown <callum@calcuode.com>
* Fix test for registration tokens
Signed-off-by: Callum Brown <callum@calcuode.com>
Signed-off-by: Callum Brown <callum@calcuode.com>
Co-authored-by: Travis Ralston <travpc@gmail.com>
Co-authored-by: Andy Balaam <andy.balaam@matrix.org>
* Applies small changes to code block display in timeline
* Makes the composer code block look like the timeline display, but without line numbers
* Adds a button to allow code blocks to be implemented
* Adds tests for the new button
* Fix viewing source of redacted events
Clicking 'View Source' in the context menu of a redacted event causes an error,
and the user gets no visible result.
This fixes <ViewSource /> to indicate that the source is unavailable when a
message has been redacted. The original source remains available.
<SyntaxHighlight /> requires a non-null string for its `content` prop, and, in
the case of redacted events, <ViewSource /> was passing `undefined`. This is
ultimately because redacting an event causes `MatrixEvent.clearEvent` to be
`undefined`, which <ViewSource /> wasn't checking.
Fixes https://github.com/vector-im/element-web/issues/24165
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Use correct highlight.js call
Previous call signature was deprecated.
See https://github.com/highlightjs/highlight.js/issues/2277
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
Signed-off-by: Clark Fischer <clark.fischer@gmail.com>
* Use js-sdk imports for poll event types instead of events-sdk
* Attempt to appease some tsc --strict errors
* Manually create poll response in cypress test
* adds buttons to toggle bulleted and numbered lists on and off
* adds icons for those buttons
* css changes to timeline display
* adds tests for the new buttons, refactors existing tests
* Fix issue where thread dropdown would not correctly
* Write additional test for both issues
- Thread dropdown should be shown if there is any thread, even if not participated
- Thread list correctly updates after every change of the dropdown immediately
* Factor out `MessageEvent.from()` usage
The class/function is disappearing from the events-sdk, at least in this form.
* Manually create contents for events used by cypress
The utility function is out of range of the calling code at runtime, for some reason.
* Run prettier
* Maybe this will fix the build
* prune client infromation events from old devices
* test client data pruning
* remove debug
* strict
* Update src/components/views/settings/devices/useOwnDevices.ts
Co-authored-by: Michael Weimann <michaelw@matrix.org>
* improvements from review
Co-authored-by: Michael Weimann <michaelw@matrix.org>
If something goes wrong with the widget, there's no way we can continue the call, so this acts as a safeguard against stuck calls in cases where the widget crashes or disconnects weirdly.
* allows switching between modes that retains formatting
* updates rich text composer dependency to 0.13.0 (@matrix-org/matrix-wysiwyg)
* improves handling of enter keypresses when ctrlEnterTosend setting is true in plain text editor
* changes the message event content when using the new editor
* adds tests for the changes to the plain text editor
* Remove unnecessary PipContainer component
* Redesign the picture-in-picture window
* Add a hover effect to the controls
* Clarify that WidgetPip has call-specific behavior
* Prevent unnecessary m.direct updates
Signed-off-by: Michael Weimann <michaelw@matrix.org>
* Replace object with Map
* Clean up comment; simplify code
* Fix rte flaky test (#9811)
* Snap in PiP widget when content changed (#9797)
* Check modified at the end of setDMRoom
* Revert "Snap in PiP widget when content changed (#9797)"
This reverts commit be1e5753677bdf84b3657994dc5ad20d250038bd.
* Revert "Fix rte flaky test (#9811)"
This reverts commit 20d9eb3924c5ebc63f03cb61b172035725e3474d.
* Update src/Rooms.ts
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Signed-off-by: Michael Weimann <michaelw@matrix.org>
Co-authored-by: Florian Duros <florianduros@element.io>
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Fix blank timeline when thread root is UTD
* add test for pre join uisi checks and thread roots
* ts strict fix
* Update to timeline panel test
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Fixes to TimelinePanel-test
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
This PR adds an option to `config.json` which will make the js-sdk use the rust crypto sdk, instead of the libolm implementation.
To use it, you need to add something like this to `config.json`:
```
"features": {
"feature_rust_crypto": true
},
```
We don't (yet) have any way to migrate a device between implementations, so the setting that was in use when you log in is persisted to the device; it is *visible* via the labs section but cannot currently be changed.
This is part of https://github.com/vector-im/element-web/issues/21972, and enables the functionality added to the js-sdk in https://github.com/matrix-org/matrix-js-sdk/pull/2969.
* Improve decryption error UI by consolidating error messages and providing instructions when possible
* Fix TS strict errors
* Rename .scss to .pcss
* Avoid accessing clipboard, Cypress doesn't like it
* Display DecryptionFailureBar alongside other AuxPanel bars
* Add comments
* Add small margin off-screen for visible decryption failures
* Fix some more TS strict errors
* Add unit tests for DecryptionFailureBar
* Add button to resend key requests manually
* Remove references to matrix-js-sdk crypto internals
* Add hysteresis to visible decryption failures
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add comment
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Don't create empty div if we're not showing resend requests button
* cancel updateSessions on unmount
* Update unit tests
* Fix lint and implicit any
* Simplify visible event bounds checking
* Adjust cypress test descriptions
* Add percy snapshots
* Update src/components/structures/TimelinePanel.tsx
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Add comments on TimelinePanel IState
* comment
* Add names to percy snapshots
* Show Resend Key Requests button when there are sessions that haven't already been requested via this bar
* We no longer request keys from senders
* update i18n
* update expected text in cypress test
* don't download keys ourselves, update device info in response to updates from client
* fix ts strict errors
* visibledecryptionfailures undefined handling
* Fix implicitAny errors
Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
Because this encodes font settings into widget URLs at the time that the client first loads a call, this has the consequence that users may need to restart their client to see font setting changes take effect in Element Call. For users who rely on these settings for accessibility, it's a lot better than nothing, though.