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

chore(ui): Rewrite a bit TimelineEventHandler::add #3527

Merged
merged 1 commit into from
Jun 10, 2024

Conversation

Hywan
Copy link
Member

@Hywan Hywan commented Jun 10, 2024

This patch renames TimelineEventHandler::add to add_item.

This patch also removes the should_add argument. The add_item is called conditionally everytime. I believe this is much cleaner. Otherwise the method should have been called maybe_add_item with a return type or something that indicates whether the item is added. This patch makes it clear and remove one possible state in add_item.


@Hywan Hywan requested a review from a team as a code owner June 10, 2024 08:14
@Hywan Hywan requested review from andybalaam and bnjbvr and removed request for a team and andybalaam June 10, 2024 08:14
@Hywan Hywan mentioned this pull request Jun 10, 2024
23 tasks
@Hywan Hywan force-pushed the chore-ui-timeline-event-handler-add branch from 08a6033 to 3d81cc4 Compare June 10, 2024 08:22
Copy link

codecov bot commented Jun 10, 2024

Codecov Report

Attention: Patch coverage is 87.09677% with 4 lines in your changes missing coverage. Please review.

Project coverage is 83.77%. Comparing base (e5487da) to head (17befab).
Report is 4 commits behind head on main.

Files Patch % Lines
crates/matrix-sdk-ui/src/timeline/event_handler.rs 87.09% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3527      +/-   ##
==========================================
- Coverage   83.79%   83.77%   -0.02%     
==========================================
  Files         254      254              
  Lines       25736    25743       +7     
==========================================
+ Hits        21565    21566       +1     
- Misses       4171     4177       +6     

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

@Hywan Hywan force-pushed the chore-ui-timeline-event-handler-add branch from 3d81cc4 to 0d6f67e Compare June 10, 2024 08:43
This patch renames `TimelineEventHandler::add` to `add_item`.

This patch also removes the `should_add` argument. The `add_item`
is called conditionally everytime. I believe this is much cleaner.
Otherwise the method should have been called `maybe_add_item` with a
return type or something that indicates whether the item is added. This
patch makes it clear and remove one possible state in `add_item`.
@Hywan Hywan force-pushed the chore-ui-timeline-event-handler-add branch from 0d6f67e to 17befab Compare June 10, 2024 16:18
@Hywan Hywan enabled auto-merge June 10, 2024 16:18
@Hywan Hywan merged commit a2f868d into matrix-org:main Jun 10, 2024
38 checks passed
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