feat(sdk,ui): Unset the unread flag when sending unthreaded receipts#5055
feat(sdk,ui): Unset the unread flag when sending unthreaded receipts#5055Hywan merged 12 commits intomatrix-org:mainfrom
Conversation
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5055 +/- ##
==========================================
+ Coverage 85.83% 85.84% +0.01%
==========================================
Files 325 325
Lines 35924 35954 +30
==========================================
+ Hits 30836 30866 +30
Misses 5088 5088 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Hywan
left a comment
There was a problem hiding this comment.
Thanks for the PR. Apart from the minor feedback, we are good!
| if !receipts.is_empty() { | ||
| self.room().send_multiple_receipts(receipts).await?; | ||
| } else if self.room().is_marked_unread() { | ||
| self.room().set_unread_flag(false).await?; | ||
| } |
There was a problem hiding this comment.
Can we add let room = self.room(); to avoid calling self.room() multiple time please?
| if self.room().is_marked_unread() { | ||
| // Unset the read marker. | ||
| self.room().set_unread_flag(false).await?; |
There was a problem hiding this comment.
Can we add let room = self.room(); to avoid calling self.room() multiple time please?
There was a problem hiding this comment.
With the removal of the condition, there is only one call here now.
| } else if self.room().is_marked_unread() { | ||
| self.room().set_unread_flag(false).await?; |
There was a problem hiding this comment.
Instead of specializing each call site of Room::set_unread_flag(), consider making Room::set_unread_flag a no-op (aka return early without sending the request) if !self.is_marked_unread()?
…Room Updates the unread flag or the room in `Room::send_single_receipt()` and `Room::send_multiple_receipts()` if the room is marked as unread and the receipts are unthreaded. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…imeline Updates the unread flag or the room in `Timeline::send_single_receipt()` and `Timeline::send_multiple_receipts()` if the room is marked as unread and the receipts are unthreaded. Updates it also in `Timeline::mark_as_read()`, even if there is no latest event ID. Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…g already has the wanted value Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
…ry time Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
6ce071d to
380f78d
Compare
|
Rebased on main to solve conflicts. |
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
Signed-off-by: Kévin Commaille <zecakeh@tedomum.fr>
This allows to follow these recommendations from the spec automatically:
Note that there was a function in the bindings doing a similar thing that was removed in #3119, but it doesn't seem that it was necessary to fix the bug that it was trying to fix.