Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for MSC2867 - Manually marking rooms as unread #3076

Merged
merged 3 commits into from
Feb 5, 2024

Conversation

stefanceriu
Copy link
Member

Requires ruma/ruma#1721

This PR add support for manually marking rooms as unread through the means of MSC2867 which introduces a new room account data flag.

Rooms now have a new mark_unread(unread: bool) method for setting the flag as well as a is_marked_unread property, which is also exposed on RoomInfo

On the FFI layer the method above is used in conjucture with send_read_receipt to fully mark a room as read, which the client should do from the room list (outside of the timeline)

@stefanceriu stefanceriu requested a review from a team as a code owner January 31, 2024 08:56
@stefanceriu stefanceriu requested review from bnjbvr and removed request for a team January 31, 2024 08:57
bindings/matrix-sdk-ffi/src/room.rs Outdated Show resolved Hide resolved
crates/matrix-sdk-base/src/client.rs Show resolved Hide resolved
crates/matrix-sdk-base/src/client.rs Show resolved Hide resolved
crates/matrix-sdk/src/room/mod.rs Show resolved Hide resolved
crates/matrix-sdk/src/sliding_sync/mod.rs Outdated Show resolved Hide resolved
Copy link

codecov bot commented Jan 31, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (87a07d9) 83.70% compared to head (f3bb7e2) 83.79%.
Report is 8 commits behind head on main.

❗ Current head f3bb7e2 differs from pull request most recent head df61037. Consider uploading reports for the commit df61037 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3076      +/-   ##
==========================================
+ Coverage   83.70%   83.79%   +0.08%     
==========================================
  Files         224      224              
  Lines       23478    23496      +18     
==========================================
+ Hits        19653    19688      +35     
+ Misses       3825     3808      -17     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@stefanceriu stefanceriu force-pushed the stefan/mark_unread branch 4 times, most recently from 45fc293 to 606fa62 Compare January 31, 2024 16:10
@stefanceriu
Copy link
Member Author

What am I doing wrong with enabling that unstable-msc2867 flag? If I do it on the workspace the CI fails on indexeddb and wasm but now that I moved it to matrix-sdk it fails on rust-tls 🤔

@bnjbvr bnjbvr removed their request for review February 1, 2024 08:57
@Hywan
Copy link
Member

Hywan commented Feb 1, 2024

This PR is related to #3037

@Hywan
Copy link
Member

Hywan commented Feb 1, 2024

What am I doing wrong with enabling that unstable-msc2867 flag? If I do it on the workspace the CI fails on indexeddb and wasm but now that I moved it to matrix-sdk it fails on rust-tls 🤔

Please, update the feature flag on Ruma, and start again. It's probably a timeout from indexeddb.

@stefanceriu
Copy link
Member Author

update the feature flag on Ruma

I don't understand what that means, move it back to the workspace cargo file?

@@ -17,12 +17,12 @@ use matrix_sdk_common::timeout::timeout;
use mime::Mime;
#[cfg(feature = "e2e-encryption")]
use ruma::events::{
room::encrypted::OriginalSyncRoomEncryptedEvent, AnySyncMessageLikeEvent, AnySyncTimelineEvent,
SyncMessageLikeEvent,
marked_unread::MarkedUnreadEventContent, room::encrypted::OriginalSyncRoomEncryptedEvent,
Copy link
Member

Choose a reason for hiding this comment

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

The CI is reporting an error here: MarkedUnreadEventContent is imported only when the feature e2e-encryption is enabled. We want it even if it's disabled.

Copy link
Member

Choose a reason for hiding this comment

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

I've pushed bb3f7ed to solve it.

// known to the store. If neither of
// those are true then the room is `unknown` and we cannot
// process its account data
if let AnyRoomAccountDataEvent::MarkedUnread(e) = event {
Copy link
Member

Choose a reason for hiding this comment

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

AnyRoomAccountDataEvent::MarkedUnread exists if and only if the ruma/unstable-msc2867 feature is enabled in the crates/matrix-sdk-base/Cargo.toml file.

Copy link
Member

Choose a reason for hiding this comment

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

I've pushed bb3f7ed to solve it.

stefanceriu and others added 3 commits February 5, 2024 11:59
- also fixes how room account data is processed and adds tests for both when rooms and extensions are present or just extensions
@Hywan Hywan merged commit 8975e6a into main Feb 5, 2024
31 of 32 checks passed
@Hywan Hywan deleted the stefan/mark_unread branch February 5, 2024 11:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants