feat: expose m.fully_read event ID on RoomInfo#6569
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #6569 +/- ##
==========================================
- Coverage 89.95% 89.94% -0.01%
==========================================
Files 382 382
Lines 107797 107914 +117
Branches 107797 107914 +117
==========================================
+ Hits 96964 97066 +102
- Misses 7165 7180 +15
Partials 3668 3668 ☔ View full report in Codecov by Sentry. |
| AnyRoomAccountDataEvent::FullyRead(_) => { | ||
| context | ||
| .room_info_notable_updates | ||
| .entry(room_id.to_owned()) | ||
| .or_default() | ||
| .insert(RoomInfoNotableUpdateReasons::READ_RECEIPT); |
There was a problem hiding this comment.
The fully read marker isn't a read receipt, is it?
There was a problem hiding this comment.
Right. I've added a new flag FULLY_READ, which required switching the field from a u8 to u16
Hywan
left a comment
There was a problem hiding this comment.
Hello,
Thank you for your contribution.
First and foremost, did you read our AI policy? I'm almost certain that this PR has been vibe-coded.
Second, the pull request template asks a couple of questions that you've apparently erased, so I'm copying them here:
<!-- description of the changes in this PR -->
- [ ] I've documented the public API Changes in the appropriate `CHANGELOG.md` files.
- [ ] This PR was made with the help of AI.
<!-- Sign-off, if not part of the commits -->
<!-- See CONTRIBUTING.md if you don't know what this is -->
Signed-off-by: About the code now: please can you add tests for the new feature?
| .room_info_notable_updates | ||
| .entry(room_id.to_owned()) | ||
| .or_default() | ||
| .insert(RoomInfoNotableUpdateReasons::READ_RECEIPT); |
There was a problem hiding this comment.
Please add a test to ensure the notable update reasons is emitted as expected.
There was a problem hiding this comment.
Added a test
|
Thanks for looking into this 🙏
|
|
@stefanceriu @Hywan I can shorten it for you here: This can be fixed in iOS or on the SDK side (optimistic write). Which would you prefer? |
Why is that a concern for this PR? Do we even have UI anywhere that requires this to be fast? As a paralel manually marking rooms as unread/read seems fine even without "local echoes". |
60d7404 to
4fcd2cd
Compare
Agreed, out of scope. Dropping it from the PR description. |
|
Looks good to me now but I'll let Ivan have the final say as he was the original reviewer. |
| ### Features | ||
|
|
||
| - Add `RoomInfo::fully_read_event_id` to expose the user's `m.fully_read` event ID. | ||
| ([#6569](https://github.com/matrix-org/matrix-rust-sdk/pull/6569)) | ||
|
|
There was a problem hiding this comment.
We switched to a towncrier-based setup for changelogs. Sorry for the inconvenience but please move this to the changelog.d folder as a Towncrier fragment.
| - [**breaking**] `RoomInfoNotableUpdateReasons` is now a `u16` to include a `FULLY_READ` flag to notify on changes of the `m.fully_read` marker. | ||
| ([#6569](https://github.com/matrix-org/matrix-rust-sdk/pull/6569)) | ||
|
|
||
| - Add `RoomInfo::fully_read_event_id` and `Room::fully_read_event_id` to expose the user's `m.fully_read` event ID. | ||
| ([#6569](https://github.com/matrix-org/matrix-rust-sdk/pull/6569)) | ||
|
|
There was a problem hiding this comment.
Same for those changelog entries.
4fcd2cd to
d82786c
Compare
|
Seems like the fixup thing is intended while in progress, and will go away when the commits are squashed. The rust tests failed on setup? |
Hywan
left a comment
There was a problem hiding this comment.
Thanks! It looks much better.
Can you rebase all your fixup commits please?
| @@ -0,0 +1 @@ | |||
| - Add `RoomInfo::fully_read_event_id` and `Room::fully_read_event_id` to expose the user's `m.fully_read` event ID. | |||
There was a problem hiding this comment.
| - Add `RoomInfo::fully_read_event_id` and `Room::fully_read_event_id` to expose the user's `m.fully_read` event ID. | |
| Add `RoomInfo::fully_read_event_id` and `Room::fully_read_event_id` to expose the user's `m.fully_read` event ID. |
The format defined in the CONTRIBUTING.md file was incorrect. I've fixed it, sowwy for the inconvenience.
| @@ -0,0 +1 @@ | |||
| - [**breaking**] `RoomInfoNotableUpdateReasons` is now a `u16` to include a `FULLY_READ` flag to notify on changes of the `m.fully_read` marker. | |||
There was a problem hiding this comment.
| - [**breaking**] `RoomInfoNotableUpdateReasons` is now a `u16` to include a `FULLY_READ` flag to notify on changes of the `m.fully_read` marker. | |
| [**breaking**] `RoomInfoNotableUpdateReasons` is now a `u16` to include a `FULLY_READ` flag to notify on changes of the `m.fully_read` marker. |
| /// Ultimately, we want to clearly identify all the notable update reasons, and | ||
| /// remove this one. | ||
| const NONE = 0b1000_0000; | ||
| const NONE = 0b0000_0000_1000_0000; |
There was a problem hiding this comment.
Could be a good idea to use 0b1000_0000_0000_0000 for NONE, but not mandatory. Do it if you find the motivation, but not necessary here.
| ); | ||
| assert!(room_info_notable_update_stream.is_empty()); | ||
|
|
||
| // …Unless the event id changes! |
There was a problem hiding this comment.
Nitpicking:
| // …Unless the event id changes! | |
| // … Unless the event ID changes! |
Add `RoomInfoNotableUpdateReasons::FULLY_READ`, used for when the `m.fully_read` marker for a room changes. Breaking change: the backing bitflag widens from `u8` to `u16` for the new flag to not alter the existing bit positions. Signed-off-by: Daniel Anderson <daniel.anderson@toptal.com>
Persist `m.fully_read` on `BaseRoomInfo` and expose it on `RoomInfo::fully_read_event_id` and `Room::fully_read_event_id`. The `m.fully_read` response processor now stores the event ID on the room info and emits `RoomInfoNotableUpdateReasons::FULLY_READ` Signed-off-by: Daniel Anderson <daniel.anderson@toptal.com>
`m.fully_read` is now available on the FFI `RoomInfo` record Signed-off-by: Daniel Anderson <daniel.anderson@toptal.com>
d82786c to
703da91
Compare
|
Rebased the fixups into the three feature commits, dropped the leading |
stefanceriu
left a comment
There was a problem hiding this comment.
Alrighty, I think this one's good to go now, thank you for taking care of it! 👍
Exposes the m.fully_read event ID on RoomInfo for clients' "jump-to-unread" button
See element-hq/element-x-ios#4766
CHANGELOG.mdfiles.Signed-off-by: Daniel Anderson daniel.anderson@toptal.com