Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Check each thread for unread messages. #9723

Merged
merged 12 commits into from
Dec 12, 2022

Conversation

clokep
Copy link
Member

@clokep clokep commented Dec 7, 2022

This is an attempt to fix (partially) element-hq/element-web#23907, instead of checking only the main timeline's events for unread messages we also check each thread timeline for unread messages.

I've been unable to successfully also propagate this information to the thread icon or the threads list, but this is still an improvement to show that you've had a reply in a room.

See element-hq/element-web#23907 for steps to reproduce.

Checklist

  • Tests written for new code (and old code if feasible)
  • Linter and other CI checks pass
  • Sign-off given on the changes (see CONTRIBUTING.md)

Here's what your changelog entry will look like:

🐛 Bug Fixes

  • Check each thread for unread messages. (#9723).

@clokep clokep added the T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems label Dec 7, 2022
// https://github.com/vector-im/element-web/issues/3363
if (room.timeline.length && room.timeline[room.timeline.length - 1].getSender() === myUserId) {
return false;
for (const timeline of [room, ...room.getThreads()]) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe room.getThreads() is sorted by order of thread discovery in the client side.

room.threadsTimelineSets[0].getLiveTimeline().getEvents() is an array of root events sorted by thread last activity (last item is the newest).
We might want to use that to increase our chances to bail early

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need the actual Thread objects though (as they implement ReadReceipt), is there a way to get those ordered by activity?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you can call getThread() on a root event to get the Thread instance

Copy link
Member Author

@clokep clokep Dec 8, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will threadTimelineSets always have a single element in it? Or what is a "timeline set"?

The following is giving undefined errors on all tests weirdly:

Suggested change
for (const timeline of [room, ...room.getThreads()]) {
for (const timeline of [
room, ...room.threadsTimelineSets[0].getLiveTimeline().getEvents().map((ev) => ev.getThread()),
]) {

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We create different timelines when there's a gappy sync or if you follow a link to an event way in the past, and each of those timelines have their own pagination tokens.

Maybe the threads timeline sets are created asynchronously. I'll have a look into the code!

@clokep
Copy link
Member Author

clokep commented Dec 9, 2022

@gsouquet I think this is ready for another look? CI is a bit red, but not quite sure why.

Copy link
Contributor

@germain-gg germain-gg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That looks great to me 👏

CI seems to be failing on one flaky e2e test and has gone a bit crazy with the TS strict checks.
You should merge/rebase develop and that will get rid of most of those failures, becasue after glancing at the CI output, it looks like the failures are unrelated to your changes

src/Unread.ts Outdated Show resolved Hide resolved
src/Unread.ts Outdated Show resolved Hide resolved
Co-authored-by: Germain <[email protected]>
@clokep clokep marked this pull request as ready for review December 12, 2022 13:38
@clokep clokep requested a review from a team as a code owner December 12, 2022 13:38
@germain-gg germain-gg merged commit 9de5654 into matrix-org:develop Dec 12, 2022
@clokep clokep deleted the unread-threads branch December 12, 2022 14:40
@clokep
Copy link
Member Author

clokep commented Dec 12, 2022

Thanks for the review! 🎉

germain-gg added a commit that referenced this pull request Dec 13, 2022
t3chguy pushed a commit that referenced this pull request Dec 13, 2022
* Revert "Check each thread for unread messages. (#9723)"

This reverts commit 9de5654.

* ts strict
clokep added a commit to clokep/matrix-react-sdk that referenced this pull request Dec 14, 2022
clokep added a commit to clokep/matrix-react-sdk that referenced this pull request Dec 15, 2022
su-ex added a commit to SchildiChat/element-desktop that referenced this pull request Jan 15, 2023
* This allows the update server to be entirely static, such as a CDN or object store, as defined at https ([\element-hq#461](element-hq#461)).
* Enable threads by default ([\#9736](matrix-org/matrix-react-sdk#9736)). Fixes element-hq/element-web#19270 element-hq/element-web#21910 and element-hq/element-web#23946.
* Add inline code formatting to rich text editor ([\#9720](matrix-org/matrix-react-sdk#9720)).
* Add emoji handling for plain text mode of the new rich text editor ([\#9727](matrix-org/matrix-react-sdk#9727)).
* Overlay virtual room call events into main timeline ([\#9626](matrix-org/matrix-react-sdk#9626)). Fixes element-hq/element-web#22929.
* Adds a new section under "Room Settings" > "Roles & Permissions" which adds the possibility to multiselect users from this room and grant them more permissions. ([\#9596](matrix-org/matrix-react-sdk#9596)). Contributed by @GoodGuyMarco.
* Add emoji handling for rich text mode ([\#9661](matrix-org/matrix-react-sdk#9661)).
* Add setting to hide bold notifications ([\#9705](matrix-org/matrix-react-sdk#9705)).
* Further password reset flow enhancements ([\#9662](matrix-org/matrix-react-sdk#9662)).
* Snooze the bulk unverified sessions reminder on dismiss ([\#9706](matrix-org/matrix-react-sdk#9706)).
* Honor advanced audio processing settings when recording voice messages ([\#9610](matrix-org/matrix-react-sdk#9610)). Contributed by @MrAnno.
* Improve the visual balance of bubble layout ([\#9704](matrix-org/matrix-react-sdk#9704)).
* Add config setting to disable bulk unverified sessions nag ([\#9657](matrix-org/matrix-react-sdk#9657)).
* Only display bulk unverified sessions nag when current sessions is verified ([\#9656](matrix-org/matrix-react-sdk#9656)).
* Separate labs and betas more clearly ([\#8969](matrix-org/matrix-react-sdk#8969)). Fixes element-hq/element-web#22706.
* Show user an error if we fail to create a DM for verification. ([\#9624](matrix-org/matrix-react-sdk#9624)).
* Prevent unnecessary m.direct updates ([\#9805](matrix-org/matrix-react-sdk#9805)). Fixes element-hq/element-web#24059.
* Fix checkForPreJoinUISI for thread roots ([\#9803](matrix-org/matrix-react-sdk#9803)). Fixes element-hq/element-web#24054.
* Load RTE components only when RTE labs is enabled ([\#9804](matrix-org/matrix-react-sdk#9804)).
* Fix issue where thread panel did not update correctly ([\#9746](matrix-org/matrix-react-sdk#9746)). Fixes element-hq/element-web#23971.
* Remove async call to get virtual room from room load ([\#9743](matrix-org/matrix-react-sdk#9743)). Fixes element-hq/element-web#23968.
* Check each thread for unread messages. ([\#9723](matrix-org/matrix-react-sdk#9723)).
* Device manage - handle sessions that don't support encryption ([\#9717](matrix-org/matrix-react-sdk#9717)). Fixes element-hq/element-web#23722.
* Fix hover state for formatting buttons (Rich text editor) (fix element-hq/element-web/issues/23832) ([\#9715](matrix-org/matrix-react-sdk#9715)).
* Don't allow group calls to be unterminated ([\#9710](matrix-org/matrix-react-sdk#9710)).
* Fix replies to emotes not showing as inline ([\#9707](matrix-org/matrix-react-sdk#9707)). Fixes element-hq/element-web#23903.
* Update copy of 'Change layout' button to match Element Call ([\#9703](matrix-org/matrix-react-sdk#9703)).
* Fix call splitbrains when switching between rooms ([\#9692](matrix-org/matrix-react-sdk#9692)).
* bugfix: fix an issue where the Notifier would incorrectly fire for non-timeline events ([\#9664](matrix-org/matrix-react-sdk#9664)). Fixes element-hq/element-web#17263.
* Fix power selector being wrongly disabled for admins themselves ([\#9681](matrix-org/matrix-react-sdk#9681)). Fixes element-hq/element-web#23882.
* Show day counts in call durations ([\#9641](matrix-org/matrix-react-sdk#9641)).
su-ex added a commit to SchildiChat/element-web that referenced this pull request Jan 15, 2023
* Add inline code formatting to rich text editor ([\element-hq#9720](matrix-org/matrix-react-sdk#9720)).
* Add emoji handling for plain text mode of the new rich text editor ([\element-hq#9727](matrix-org/matrix-react-sdk#9727)).
* Overlay virtual room call events into main timeline ([\element-hq#9626](matrix-org/matrix-react-sdk#9626)). Fixes element-hq#22929.
* Adds a new section under "Room Settings" > "Roles & Permissions" which adds the possibility to multiselect users from this room and grant them more permissions. ([\element-hq#9596](matrix-org/matrix-react-sdk#9596)). Contributed by @GoodGuyMarco.
* Add emoji handling for rich text mode ([\element-hq#9661](matrix-org/matrix-react-sdk#9661)).
* Add setting to hide bold notifications ([\element-hq#9705](matrix-org/matrix-react-sdk#9705)).
* Further password reset flow enhancements ([\element-hq#9662](matrix-org/matrix-react-sdk#9662)).
* Snooze the bulk unverified sessions reminder on dismiss ([\element-hq#9706](matrix-org/matrix-react-sdk#9706)).
* Honor advanced audio processing settings when recording voice messages ([\element-hq#9610](matrix-org/matrix-react-sdk#9610)). Contributed by @MrAnno.
* Improve the visual balance of bubble layout ([\element-hq#9704](matrix-org/matrix-react-sdk#9704)).
* Add config setting to disable bulk unverified sessions nag ([\element-hq#9657](matrix-org/matrix-react-sdk#9657)).
* Only display bulk unverified sessions nag when current sessions is verified ([\element-hq#9656](matrix-org/matrix-react-sdk#9656)).
* Separate labs and betas more clearly ([\element-hq#8969](matrix-org/matrix-react-sdk#8969)). Fixes element-hq#22706.
* Show user an error if we fail to create a DM for verification. ([\element-hq#9624](matrix-org/matrix-react-sdk#9624)).
* Prevent unnecessary m.direct updates ([\element-hq#9805](matrix-org/matrix-react-sdk#9805)). Fixes element-hq#24059.
* Fix checkForPreJoinUISI for thread roots ([\element-hq#9803](matrix-org/matrix-react-sdk#9803)). Fixes element-hq#24054.
* Load RTE components only when RTE labs is enabled ([\element-hq#9804](matrix-org/matrix-react-sdk#9804)).
* Fix issue where thread panel did not update correctly ([\element-hq#9746](matrix-org/matrix-react-sdk#9746)). Fixes element-hq#23971.
* Remove async call to get virtual room from room load ([\element-hq#9743](matrix-org/matrix-react-sdk#9743)). Fixes element-hq#23968.
* Check each thread for unread messages. ([\element-hq#9723](matrix-org/matrix-react-sdk#9723)).
* Device manage - handle sessions that don't support encryption ([\element-hq#9717](matrix-org/matrix-react-sdk#9717)). Fixes element-hq#23722.
* Fix hover state for formatting buttons (Rich text editor) (fix element-hq/issues/23832) ([\element-hq#9715](matrix-org/matrix-react-sdk#9715)).
* Don't allow group calls to be unterminated ([\element-hq#9710](matrix-org/matrix-react-sdk#9710)).
* Fix replies to emotes not showing as inline ([\element-hq#9707](matrix-org/matrix-react-sdk#9707)). Fixes element-hq#23903.
* Update copy of 'Change layout' button to match Element Call ([\element-hq#9703](matrix-org/matrix-react-sdk#9703)).
* Fix call splitbrains when switching between rooms ([\element-hq#9692](matrix-org/matrix-react-sdk#9692)).
* bugfix: fix an issue where the Notifier would incorrectly fire for non-timeline events ([\element-hq#9664](matrix-org/matrix-react-sdk#9664)). Fixes element-hq#17263.
* Fix power selector being wrongly disabled for admins themselves ([\element-hq#9681](matrix-org/matrix-react-sdk#9681)). Fixes element-hq#23882.
* Show day counts in call durations ([\element-hq#9641](matrix-org/matrix-react-sdk#9641)).
su-ex added a commit to SchildiChat/matrix-react-sdk that referenced this pull request Jan 15, 2023
* Prevent unnecessary m.direct updates ([\matrix-org#9805](matrix-org#9805)). Fixes element-hq/element-web#24059.
* Fix checkForPreJoinUISI for thread roots ([\matrix-org#9803](matrix-org#9803)). Fixes element-hq/element-web#24054.
* Add inline code formatting to rich text editor ([\matrix-org#9720](matrix-org#9720)).
* Add emoji handling for plain text mode of the new rich text editor ([\matrix-org#9727](matrix-org#9727)).
* Overlay virtual room call events into main timeline ([\matrix-org#9626](matrix-org#9626)). Fixes element-hq/element-web#22929.
* Adds a new section under "Room Settings" > "Roles & Permissions" which adds the possibility to multiselect users from this room and grant them more permissions. ([\matrix-org#9596](matrix-org#9596)). Contributed by @GoodGuyMarco.
* Add emoji handling for rich text mode ([\matrix-org#9661](matrix-org#9661)).
* Add setting to hide bold notifications ([\matrix-org#9705](matrix-org#9705)).
* Further password reset flow enhancements ([\matrix-org#9662](matrix-org#9662)).
* Snooze the bulk unverified sessions reminder on dismiss ([\matrix-org#9706](matrix-org#9706)).
* Honor advanced audio processing settings when recording voice messages ([\matrix-org#9610](matrix-org#9610)). Contributed by @MrAnno.
* Improve the visual balance of bubble layout ([\matrix-org#9704](matrix-org#9704)).
* Add config setting to disable bulk unverified sessions nag ([\matrix-org#9657](matrix-org#9657)).
* Only display bulk unverified sessions nag when current sessions is verified ([\matrix-org#9656](matrix-org#9656)).
* Separate labs and betas more clearly ([\matrix-org#8969](matrix-org#8969)). Fixes element-hq/element-web#22706.
* Show user an error if we fail to create a DM for verification. ([\matrix-org#9624](matrix-org#9624)).
* Fix issue where thread panel did not update correctly ([\matrix-org#9746](matrix-org#9746)). Fixes element-hq/element-web#23971.
* Remove async call to get virtual room from room load ([\matrix-org#9743](matrix-org#9743)). Fixes element-hq/element-web#23968.
* Check each thread for unread messages. ([\matrix-org#9723](matrix-org#9723)).
* Device manage - handle sessions that don't support encryption ([\matrix-org#9717](matrix-org#9717)). Fixes element-hq/element-web#23722.
* Fix hover state for formatting buttons (Rich text editor) (fix element-hq/element-web/issues/23832) ([\matrix-org#9715](matrix-org#9715)).
* Don't allow group calls to be unterminated ([\matrix-org#9710](matrix-org#9710)).
* Fix replies to emotes not showing as inline ([\matrix-org#9707](matrix-org#9707)). Fixes element-hq/element-web#23903.
* Update copy of 'Change layout' button to match Element Call ([\matrix-org#9703](matrix-org#9703)).
* Fix call splitbrains when switching between rooms ([\matrix-org#9692](matrix-org#9692)).
* bugfix: fix an issue where the Notifier would incorrectly fire for non-timeline events ([\matrix-org#9664](matrix-org#9664)). Fixes element-hq/element-web#17263.
* Fix power selector being wrongly disabled for admins themselves ([\matrix-org#9681](matrix-org#9681)). Fixes element-hq/element-web#23882.
* Show day counts in call durations ([\matrix-org#9641](matrix-org#9641)).
netbsd-srcmastr pushed a commit to NetBSD/pkgsrc that referenced this pull request Jan 18, 2023
Changes in [1.11.17](https://github.com/vector-im/element-web/releases/tag/v1.11.17) (2022-12-21)
=================================================================================================

## ✨ Features
 * Add inline code formatting to rich text editor ([\#9720](matrix-org/matrix-react-sdk#9720)).
 * Add emoji handling for plain text mode of the new rich text editor ([\#9727](matrix-org/matrix-react-sdk#9727)).
 * Overlay virtual room call events into main timeline ([\#9626](matrix-org/matrix-react-sdk#9626)). Fixes #22929.
 * Adds a new section under "Room Settings" > "Roles & Permissions" which adds the possibility to multiselect users from this room and grant them more permissions. ([\#9596](matrix-org/matrix-react-sdk#9596)). Contributed by @GoodGuyMarco.
 * Add emoji handling for rich text mode ([\#9661](matrix-org/matrix-react-sdk#9661)).
 * Add setting to hide bold notifications ([\#9705](matrix-org/matrix-react-sdk#9705)).
 * Further password reset flow enhancements ([\#9662](matrix-org/matrix-react-sdk#9662)).
 * Snooze the bulk unverified sessions reminder on dismiss ([\#9706](matrix-org/matrix-react-sdk#9706)).
 * Honor advanced audio processing settings when recording voice messages ([\#9610](matrix-org/matrix-react-sdk#9610)). Contributed by @MrAnno.
 * Improve the visual balance of bubble layout ([\#9704](matrix-org/matrix-react-sdk#9704)).
 * Add config setting to disable bulk unverified sessions nag ([\#9657](matrix-org/matrix-react-sdk#9657)).
 * Only display bulk unverified sessions nag when current sessions is verified ([\#9656](matrix-org/matrix-react-sdk#9656)).
 * Separate labs and betas more clearly ([\#8969](matrix-org/matrix-react-sdk#8969)). Fixes #22706.
 * Show user an error if we fail to create a DM for verification. ([\#9624](matrix-org/matrix-react-sdk#9624)).

## 🐛 Bug Fixes
 * Prevent unnecessary m.direct updates ([\#9805](matrix-org/matrix-react-sdk#9805)). Fixes #24059.
 * Fix checkForPreJoinUISI for thread roots ([\#9803](matrix-org/matrix-react-sdk#9803)). Fixes #24054.
 * Load RTE components only when RTE labs is enabled ([\#9804](matrix-org/matrix-react-sdk#9804)).
 * Fix issue where thread panel did not update correctly ([\#9746](matrix-org/matrix-react-sdk#9746)). Fixes #23971.
 * Remove async call to get virtual room from room load ([\#9743](matrix-org/matrix-react-sdk#9743)). Fixes #23968.
 * Check each thread for unread messages. ([\#9723](matrix-org/matrix-react-sdk#9723)).
 * Device manage - handle sessions that don't support encryption ([\#9717](matrix-org/matrix-react-sdk#9717)). Fixes #23722.
 * Fix hover state for formatting buttons (Rich text editor) (fix element-hq/element-web/issues/23832) ([\#9715](matrix-org/matrix-react-sdk#9715)).
 * Don't allow group calls to be unterminated ([\#9710](matrix-org/matrix-react-sdk#9710)).
 * Fix replies to emotes not showing as inline ([\#9707](matrix-org/matrix-react-sdk#9707)). Fixes #23903.
 * Update copy of 'Change layout' button to match Element Call ([\#9703](matrix-org/matrix-react-sdk#9703)).
 * Fix call splitbrains when switching between rooms ([\#9692](matrix-org/matrix-react-sdk#9692)).
 * bugfix: fix an issue where the Notifier would incorrectly fire for non-timeline events ([\#9664](matrix-org/matrix-react-sdk#9664)). Fixes #17263.
 * Fix power selector being wrongly disabled for admins themselves ([\#9681](matrix-org/matrix-react-sdk#9681)). Fixes #23882.
 * Show day counts in call durations ([\#9641](matrix-org/matrix-react-sdk#9641)).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T-Defect Bugs, crashes, hangs, vulnerabilities, or other reported problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants