Leaving a room does not clear the notification counts the server last sent
for it, and nothing on our side clears them either, so a room sitting in
the historical list kept a badge that could never be got rid of: there is
no way to read a room you are not in.
The unread state of such a room is now nothing at all. Our own member
event is what decides it rather than getMyMembership(), which answers
"leave" both for a room we have left and for one we have not heard about
yet — blanking a badge that is merely late would be a worse bug than the
one being fixed here.
It goes below the invite and knock checks, which are leaves of a sort and
have their own answers, so a pending invite and a refused knock still show
what they showed before.
Tests: a left room with a count of 42 now reports nothing.
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Avoid destroying a still-valid session when the OS keychain is temporarily unreadable
SafeStorageWriter.get() previously caught a decrypt failure and returned undefined,
indistinguishable from "no secret stored". When the OS keychain is briefly locked or
its ACL is invalidated by an app re-sign/update, an existing valid pickle key read as
absent, so the renderer fell back to the default key and createPickleKey then overwrote
the still-valid ciphertext - turning a transient hiccup into permanent session and
encryption-key loss.
Distinguish absent from present-but-undecryptable with a typed SafeStorageDecryptionError,
and never overwrite an existing undecryptable secret, so the session recovers on a later
launch once the keychain is readable again.
* Fail closed when a stored secret cannot be read, and defer the basic_text migration instead of poisoning skipped secrets
- isSecretUndecryptable now treats any error reading an existing secret as
undecryptable, so an unexpected storage-layer error can never re-enable the
destructive pickle-key overwrite.
- migrateBasicTextToPlaintext decrypts all secrets before writing anything: if
any secret cannot be decrypted the migration is aborted and the app sticks
with the basic_text backend (safeStorageBackendOverride) instead of recording
the store as plaintext while a secret is still ciphertext - which would make
the next launch re-encrypt that ciphertext as though it were the secret,
silently corrupting it and defeating the overwrite guard.
* Fix the safeStorage tests so they run under CI
store.ts reads getConfig().brand when it raises a degraded-mode dialog, and the real
config module only populates itself in loadConfig(), which these tests never call.
Stubbing it lets the tests reach the dialog they are actually about instead of dying
on an undefined brand.
The ElectronStore fake also carried a constructor whose only job was to swallow the
options object. oxlint's no-useless-constructor is an error here, and it was the one
genuine failure on this branch, so the fake now leans on the implicit default
constructor - which ignores its arguments just as happily.
* Improve EventTile Playwright coverage
* oxfmt
* Fix thread previews for unencrypted replies
* Add search thread preview coverage
* Restore view model fix
* Split the failing test into two
* Fix failing test
* Changed from css class assertion to screenshot validation
* Updated screenshot
* Restore the read marker fade by using a valid CSS easing function
* Drop postcss-easings
The read marker was the last thing that could have used a named easing, and
its style now lives in shared-components, which vite builds without the
plugin. Nothing in the tree names an easing any more, so the plugin, its type
shim and the dependency all go.
Every sound played through a BackgroundAudio shares the one audio context,
which is suspended rather than closed when a sound ends so that it can be
reused. The handler suspended it whenever any source finished, so a sound
that started while an earlier one was still going was cut off part way
through. Suspending is not stopping either: the cut-off buffer stayed
where it was and picked up again the next time anything was played, which
is how a notification for one room ends up sounding in another.
The context is now suspended only once nothing this instance started is
still running, and each source is disconnected as it ends. A looping sound
holds the count up until it is stopped, and stopping it ends it, so the
context is still suspended as soon as everything is quiet.
Tests: the context is suspended when a lone sound ends, and left running
while a second sound outlasts the first.
* Add Sentry frame rewriting for Element Desktop integration
This change introduces the Sentry `rewriteFramesIntegration` to normalize stack frames for crashes occurring in Element Desktop. It ensures that stack traces from the custom `vector://vector/webapp` origin are grouped and symbolicated correctly, aligning them with the web app's release. This enhancement improves error tracking and debugging for users on the desktop platform.
* Refactor Sentry test file for improved readability and consistency
This update enhances the formatting of the `sentry-test.ts` file by aligning code for better readability. Changes include consistent indentation and spacing in mock function definitions and test cases. These adjustments aim to improve code maintainability and clarity without altering functionality.
* Add copyright notice and SPDX license to Sentry test file
This update introduces a copyright notice and SPDX license declaration at the top of the `sentry-test.ts` file. The addition clarifies the ownership and licensing terms for the file, ensuring compliance with legal requirements and improving documentation for future reference.
* Update copyright notice in Sentry test file
This commit updates the copyright notice in the `sentry-test.ts` file to reflect the new ownership under PrinceXDev. The change ensures that the file's legal attribution is accurate and up-to-date.
* Refactor Sentry test file for improved code consistency
This commit streamlines the formatting in the `sentry-test.ts` file by consolidating mock function definitions and enhancing the readability of the test cases. The changes include removing unnecessary line breaks and ensuring consistent spacing, which contributes to better maintainability without altering the functionality of the tests.
HTMLAnchorElement.href is the resolved, serialised URL, so editing a message
containing [a](http://example.com) put [a](http://example.com/) in the composer
and re-wrapped a plain autolinked URL as a markdown link. Read the href
attribute instead so the composer shows what the author wrote.
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
Opening a search result aborts the search, which rejects whatever request
is still in flight. The rejection lands in the same handler as a real
failure, so the user was shown a "Search failed: signal is aborted without
reason" dialog for doing nothing more than clicking a result.
There is a guard for this already, but it only covers the case where the
component has come apart first: `aborted` is set by the unmount cleanup,
and the rejection often arrives before React gets that far. An AbortError
is now recognised for what it is and dropped, whichever way round the two
happen to land.
Nothing else changes: a rejection from any other cause still reaches the
error dialog, since that is a failure nobody asked for.
Tests: a search rejected with an AbortError no longer reports an error,
and one rejected with anything else still does.
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
A rate limited invite was retried on a hard coded five second delay with no
bound, so the client kept hammering a server which had already refused, and
ignored the retry_after_ms it asked us to wait.
The delay now comes from the server, capped so a very long backoff cannot leave
the invite dialog hanging, and each address gives up after a few attempts with
an error rather than looping.
Cancelling an in-flight invite is a separate concern and is not addressed here.
Fixes https://github.com/element-hq/element-web/issues/30427
Co-authored-by: David Baker <dbkr@users.noreply.github.com>
* Add shared timeline overlay buttons and view contract
The TimelineOverlayButtons presentational component (unread bar, jump-to-bottom)
plus the shared TimelineView VM contract (types) and its i18n strings. Consumed
by the TimelineView virtualizer in a follow-up commit.
* Add shared TimelineView component (TanStack Virtual)
Headless TanStack-Virtual timeline driven from RoomTimelineViewModel: anchorTo:"end"
viewport stability across prepends/trims, cold-load cover, jump-to via scrollToOffset,
and visible-state reporting via the virtualizer's onChange. Adds the @tanstack/react-virtual
dependency and the virtual-core isValidAnchorItem patch (runtime + types).
* Use Compound spacing tokens in timeline overlay and clarify comments
- Use Compound spacing tokens for overlay margins/insets instead of raw px
- Drop the stale Virtuoso reference from the overlay CSS comment
- Note the real-world duration of COLD_CAP_FRAMES
- Describe each load phase in plain English
* Remove jargon and explain/expand things in simple terms.
* Use time rather than a frame count and improve description.
* Define the shared EventTile shell contract
* Create a functional shared shell skeleton
* Implement the thread rendering branch
* Implement notification and threads-list branches
* Implement file and default timeline branches
* Add shared stories and complete shell tests
* Adding state flags, stories and styling
* Correct DOM order for IRC branch
* Refine EventTileView Storybook shell and fixtures
* Fix the room story for modern layout
* Fix Bubble layout
* Fix IRC layout
* Fix ThreadsList and Thread
* Fix File and Notification
* Cleanup of stories and styling
* Fix lint errors
* Added baseline screenshots
* Rename to avoid knip errors
* Avoid the knip error
* Fix test fail on click
* Use separate div wrappers for slots instead of relying on cloning components.
* Renamed names for slot classes
* Changed to conditional state classes
* Change layout and shape variants to classes
* Clean up and reorder for better readability
* Fix Sonar issues
* Fix Sonar issues
Electron's save dialog offers only "All Files" unless it is handed filters,
so someone who replaced "photo.jpg" with "photo" got a file with no extension
at all and no way to open it. The browser does not do this: it offers the
file's own type, and puts the extension back when the name arrives without
one.
The download now names its type before the dialog goes up, and the "Save
image as..." context menu passes the same filters. A file with no extension
to preserve is left alone rather than being given a meaningless filter, and
"All Files" stays on the list so anyone who really wants an extensionless
name can still pick it.
Tests: a download with an extension gets filters, one without does not, and
the context menu path is covered as well.
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Update the pinned message banner when a pinned message is edited
The pinned events are fetched from a memo keyed on the pinned event ids, and editing a
pinned message leaves those ids untouched. Nothing invalidated the memo, so the banner
and the pinned messages card went on rendering the original text while the timeline
showed the edit.
Edits landing on a pinned event now invalidate it. An edit to any other event is
ignored, so an active room does not refetch the pinned set on every message.
* Address review: apply pinned edits in place instead of refetching
The counter that forced the memo to recompute was never read by the memo, so the
dependency array had to carry a variable that meant nothing to the computation.
The edit event is already in hand when the timeline fires, so holding onto it
rather than a tally gives the memo something it can actually consume.
Applying that edit to the fetched copy also removes a round-trip: the pinned set
was being fetched again purely to pick up content the client already had. It has
to run in an effect rather than in the memo because replacing an event notifies
whatever is rendering it, and that must not happen during a render.
The tests now assert the content the hook hands back rather than the number of
fetches, which is what the banner actually shows.
* Keep a copy of the audio buffer so the WAV fallback can run
decodeAudioData detaches the buffer it is given, so the catch block handed an
already detached buffer to decodeOgg and it threw "Cannot perform Construct on
a detached ArrayBuffer" before it could re-encode. The fallback could never
run and the user saw an error instead of their voice message.
Fixes https://github.com/element-hq/element-web/issues/24904
* Assert the fallback buffer is usable instead of constructing a view for its side effect
---------
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
dark-custom imported highlight.js's atom-one-light palette while every other
dark theme imports atom-one-dark, so syntax-highlighted code blocks rendered
dark grey on the theme's dark background. The neighbouring import on the next
line already pulls in the dark GitHub markdown stylesheet.
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
canInvite was only recomputed on third party invite state events, so granting or
revoking the power to invite left the member list header button in its previous
enabled or disabled state until the list was reopened.
Recompute it on RoomStateEvent.Update as well, which also covers the space join
rule branch in canInviteTo(), matching RoomSummaryCardViewModel.
Co-authored-by: Michael Telatynski <7t3chguy@gmail.com>
* Tell the user when registration is being rate limited
* Disable the submit button while registration is rate limited
The warning now sits with the button it is disabling, below the server picker,
rather than above it, so it reads as the reason you cannot continue.
The rate limit message moves out of errorText into its own state field to get
there, which also leaves the position of every other registration error alone.
When the server tells us how long to wait, we ask again ourselves once that
time is up, so the form comes back without the user having to guess when a
reload is worth it.
* Set the rate limit warning to medium weight
Scoped to the registration rate limit warning so the other auth errors keep
the bold they have always had.
* Exploration of a virtuoso-powered emoji picker
moved to shared components
Fable generated
* fix pnpm lock
* format & fix some lint issues
* wrong import
* fix lint warning
* Fix off-by-one
and remove manual overflow adjustment: let's leave the default unless
it turns out to be necessary. Emoji should not take that long to load.
* Convert to functional component
* WIP: change to one big virtuoso scroller
* Change to use virtuoso's own onRangeChanged
and santitise category data and how it's passed around
* Convert Tabs to functional component
and put the focusing behaviour back with it just keeping track of
refs by itself.
* Absorb two line config file into main component
* Actually add the config to the main file
* Convert emoji to functional
Also make selected always defined and use useCallback.
* QuickReactions to functional component
* Non-default exports & doc
* Search to functional component
* Well it seems to work just fine now
* Use ref prop
* fix lockfile AGAIN
* lint
* Remove default export
* Remove some mx_ classnames and fix the inputRef
to make the arrow keys in the search box work (well, work as much as
they ever did).
* Remove last of the mx_ id / classnames
(except the one in the test)
* Use useMemo to memoize
* No need to export props interface (I think?)
and fix comment now we don't do the mutation stuff anymore
* Fix test
* Fix axe violations & add screenshots
* Avoid comparing dom snapshots in test
* Allow more before or after, just compare order of the ones present in both.
* Switch existing usages to new emoji picker
and kill the old one with fire
* Unused stuff
* Remove i18n strings
* Fix some tests
* Update screenshots
* Fix test
by removing the last of the weird memoized-but-mutated data structure
* Experimental custom status
* Screenshot
* snapshots
* Update button label and fix test
* Move the string somewhere more sensible than 'a11y'
* i18n lint
* Give the emojis IDs so aria-activedescendant works
* Fix more tests
* Add a small wrapper emoji picker component
This lets us easily memoize the recent emojis when the emoji picker is opened.
Also it saves a bit of boilerplate.
* Remove old emojipicker css
* Typos
Co-authored-by: David Langley <davidl@element.io>
* Use compound constants
* Rethemendex
* Test for custom status
* Use catalog version for emojibase
* Add comments
* More comments
* Fix comment
* More comments
* more comments (and make them uniform)
* More comments
* Fix pnpm lock again
* Another comment
* Add option to hide quick reactions (and preview) bar
* Fix test
to use emoji not in the quick reactions bar
* Apply button types to new version
* Add comment
* Disable screenshot
as per comment
* Fix hover / background / border styles
* Screenshot
* Don't use the reactions row because it's gone now
* Fix spacing in user status dropdown
Updates to renderItem based Dropdown, allowing the item in the dropdown
to be customised.
Requires https://github.com/element-hq/compound-web/pull/538 (and
will be required to update to the version of compound it gets
released in).
* Update to new compound
* snapshots
* Fix tests
---------
Co-authored-by: Will Hunt <2072976+Half-Shot@users.noreply.github.com>
Co-authored-by: David Langley <davidl@element.io>
* Show & clear your own on-a-call status
The user menu / settings now reflects your own on-a-call status
and pressing the 'clear' button will clear both m.status and m.call,
whichever are set.
* Update function name
* Fix tests
And make the clear status function simpler by just throwing if either fails.
* Fix more tests
Confirming a completion produces two model updates for one keystroke: the
completion replaces the range and closes the autocomplete, and then the wrapper
closes it again. The model reported that second close like any other change, and
since it carries no input type and no diff the history manager treats it as bulk
input and always pushes, leaving two identical states on the undo stack.
The model now ignores a close which has nothing to replace and arrives once the
autocomplete is already gone. Dismissing with escape, and the fallback close when
there was no selection to confirm, both happen while it is still open and are
unaffected.
Tests: a single undo restores the typed text after a completion, and the
redundant close causes no further render.
Both notification settings tabs stored a keyword under a push rule whose id
was the keyword itself. Homeservers reserve the rule ids beginning with a
dot for the rules they define, and Synapse refuses to create any other, so
saving a keyword such as "...push complete" failed outright and the whole
save was reported as an error.
The rule id is an internal name that the user never sees — both tabs list
keywords by the rule's pattern — so it is the id that gives way. It now
drops the leading dots while the pattern keeps the keyword exactly as it
was typed, which is what is matched against messages. Two keywords can
want the same id that way, so a number is appended when one is taken,
which also keeps "banana" from overwriting the rule for ".banana".
Tests: the shared reconciler and the older tab both store a dotted keyword
under an accepted id, and two keywords differing only by a leading dot get
an id each.
* Exploration of a virtuoso-powered emoji picker
moved to shared components
Fable generated
* fix pnpm lock
* format & fix some lint issues
* wrong import
* fix lint warning
* Fix off-by-one
and remove manual overflow adjustment: let's leave the default unless
it turns out to be necessary. Emoji should not take that long to load.
* Convert to functional component
* WIP: change to one big virtuoso scroller
* Change to use virtuoso's own onRangeChanged
and santitise category data and how it's passed around
* Convert Tabs to functional component
and put the focusing behaviour back with it just keeping track of
refs by itself.
* Absorb two line config file into main component
* Actually add the config to the main file
* Convert emoji to functional
Also make selected always defined and use useCallback.
* QuickReactions to functional component
* Non-default exports & doc
* Search to functional component
* Well it seems to work just fine now
* Use ref prop
* fix lockfile AGAIN
* lint
* Remove default export
* Remove some mx_ classnames and fix the inputRef
to make the arrow keys in the search box work (well, work as much as
they ever did).
* Remove last of the mx_ id / classnames
(except the one in the test)
* Use useMemo to memoize
* No need to export props interface (I think?)
and fix comment now we don't do the mutation stuff anymore
* Fix test
* Fix axe violations & add screenshots
* Avoid comparing dom snapshots in test
* Allow more before or after, just compare order of the ones present in both.
* Switch existing usages to new emoji picker
and kill the old one with fire
* Unused stuff
* Remove i18n strings
* Fix some tests
* Update screenshots
* Fix test
by removing the last of the weird memoized-but-mutated data structure
* Experimental custom status
* Screenshot
* snapshots
* Update button label and fix test
* Move the string somewhere more sensible than 'a11y'
* i18n lint
* Give the emojis IDs so aria-activedescendant works
* Fix more tests
* Add a small wrapper emoji picker component
This lets us easily memoize the recent emojis when the emoji picker is opened.
Also it saves a bit of boilerplate.
* Remove old emojipicker css
* Typos
Co-authored-by: David Langley <davidl@element.io>
* Use compound constants
* Rethemendex
* Test for custom status
* Use catalog version for emojibase
* Add comments
* More comments
* Fix comment
* More comments
* more comments (and make them uniform)
* More comments
* Fix pnpm lock again
* Another comment
* Add option to hide quick reactions (and preview) bar
* Fix test
to use emoji not in the quick reactions bar
* Apply button types to new version
* Add comment
* Disable screenshot
as per comment
* Fix hover / background / border styles
* Screenshot
* Don't use the reactions row because it's gone now
* Trim overly verbose comment
---------
Co-authored-by: Will Hunt <2072976+Half-Shot@users.noreply.github.com>
Co-authored-by: David Langley <davidl@element.io>
The preview shown for a room you have not joined — the one carrying the
join and ask-to-join buttons — has 4px corners, where the room preview
card it stands in place of, the panel form of the same bar, and the
surfaces beside it all have 8px. Sitting among them it reads as sharp,
which is what was reported.
Nothing else in the rule changes, and the panel form already had the right
value, so the two forms of the bar now agree with each other as well.
Co-authored-by: David Baker <dbkr@users.noreply.github.com>