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

timeline: refactor reaction handling #3761

Merged
merged 11 commits into from
Jul 25, 2024
Merged

timeline: refactor reaction handling #3761

merged 11 commits into from
Jul 25, 2024

Conversation

bnjbvr
Copy link
Member

@bnjbvr bnjbvr commented Jul 25, 2024

This moves fields around, renames stuff, and changes the way we store reactions:

  • instead of relying on the Reactions::map and storing reactions in EventTimelineItem as two sources of truth, reactions are only stored in EventTimelineItem now. There's still the need to map from a reaction txn-id | event-id to the thing it's reacting to (e.g. when redacting a reaction), so map has been adapted for that usage.
  • pending reactions now store all the content they need, without the need for an indirection with the above Reactions::map.
  • reactions are now keyed by annotation key then by sender id, instead of annotation key then txn id | event id. This has the benefit of making it impossible to have two reactions from the same sender. I'm wondering if that could cause issue with local vs remote reactions from the current user, so will ask for further testing.

This should be reviewable commit by commit.

@bnjbvr bnjbvr requested a review from a team as a code owner July 25, 2024 08:42
@bnjbvr bnjbvr requested review from stefanceriu and removed request for a team July 25, 2024 08:42
Copy link

codecov bot commented Jul 25, 2024

Codecov Report

Attention: Patch coverage is 81.51261% with 22 lines in your changes missing coverage. Please review.

Project coverage is 84.08%. Comparing base (2eb6930) to head (d234324).
Report is 1 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk-ui/src/timeline/event_handler.rs 77.27% 15 Missing ⚠️
crates/matrix-sdk-ui/src/timeline/inner/mod.rs 65.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3761      +/-   ##
==========================================
- Coverage   84.08%   84.08%   -0.01%     
==========================================
  Files         260      259       -1     
  Lines       27031    26993      -38     
==========================================
- Hits        22730    22697      -33     
+ Misses       4301     4296       -5     

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

@bnjbvr bnjbvr force-pushed the bnjbvr/refactor-reactions branch from 8a8a581 to d234324 Compare July 25, 2024 12:34
Copy link
Member

@stefanceriu stefanceriu left a comment

Choose a reason for hiding this comment

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

Code looks great to me (as much as i can tell) and it also works great, tested it on EX iOS.
Lovely cleanup! 👌

@bnjbvr bnjbvr merged commit 02a929c into main Jul 25, 2024
40 checks passed
@bnjbvr bnjbvr deleted the bnjbvr/refactor-reactions branch July 25, 2024 13:13
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.

2 participants