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

Enable system-wide object autosubscribe #2612

Merged
merged 10 commits into from
Feb 18, 2025
Merged

Conversation

gnunicorn
Copy link
Contributor

@gnunicorn gnunicorn commented Feb 17, 2025

With the now default-on "autosubscribe" feature, we subscribe the user to all objects they created or interacted with to receive notifications for (unless they "unring" the bell on the object).

This means, that next to the bookmark, all objects now have the 🔔 button indicating whether the user is subscribed to updates from this object and allowing them to toggle that.

Upon creation, edit, comment and attachment, we auto-subscribe the user if they have set the notification setting for that (which is on by default). See it in action:

Autosubscribe upon creation:

object-creation-autosub.mp4

Autosubscribe for pins:

autosub-on-pin.mp4

Autosubscribe for rsvp:

autosubscribe-on-rsvp.mp4

Autosubscribe on edit:

autosubscribe-on-edit.mp4

And for task creation:

subscribes to the task as well as its list:

tasks.mp4

on comments too

autosubscribe-in-comment.mp4

@gnunicorn gnunicorn added the f-push-notifications Problem with the push notifications feature label Feb 17, 2025
Copy link

codecov bot commented Feb 17, 2025

Codecov Report

Attention: Patch coverage is 20.76923% with 103 lines in your changes missing coverage. Please review.

Project coverage is 33.29%. Comparing base (986516f) to head (ff6de28).
Report is 13 commits behind head on main.

Files with missing lines Patch % Lines
...ib/features/tasks/pages/task_item_detail_page.dart 24.13% 22 Missing ⚠️
.../features/comments/widgets/add_comment_widget.dart 0.00% 9 Missing ⚠️
...b/features/tasks/pages/task_list_details_page.dart 30.76% 9 Missing ⚠️
...atures/notifications/pages/notifications_page.dart 0.00% 8 Missing ⚠️
...pp/lib/features/pins/actions/edit_pin_actions.dart 0.00% 7 Missing ⚠️
.../lib/features/events/pages/event_details_page.dart 20.00% 4 Missing ⚠️
app/lib/features/events/utils/events_utils.dart 0.00% 4 Missing ⚠️
.../lib/features/pins/actions/pin_update_actions.dart 0.00% 4 Missing ⚠️
...pp/lib/features/tasks/actions/update_tasklist.dart 0.00% 4 Missing ⚠️
.../lib/features/comments/actions/submit_comment.dart 0.00% 3 Missing ⚠️
... and 16 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2612      +/-   ##
==========================================
+ Coverage   33.22%   33.29%   +0.07%     
==========================================
  Files         742      742              
  Lines       48097    48154      +57     
==========================================
+ Hits        15978    16032      +54     
- Misses      32119    32122       +3     
Flag Coverage Δ
integration-test 43.56% <0.00%> (+0.02%) ⬆️
unittest 23.93% <21.77%> (+0.09%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

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


@override
Future<NotificationSettings> build() async {
ref.onDispose(() => _poller?.cancel());
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this PR revealed a bug in this notifier which lead to it only updating once. The reason was that we need to re-subscribe after each time when we create a new settings object as the old one gets dropped. the new code does that: triggering reset will always subscribe to the new one and add a listener to call reset again.

@@ -388,6 +387,10 @@ impl AttachmentsManager {
self.room.room_id().to_string()
}

pub fn object_id_str(&self) -> String {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

the managers for comments and attachments didn't give us a way to subscribe to the parent object, so I added these helpers from the rust side.

@@ -21,11 +19,6 @@ Future<bool> autosubscribe({
required L10n lang,
SubscriptionSubType? subType,
}) async {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

not a labs anymore

Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

@kumarpalsinh25 kumarpalsinh25 left a comment

Choose a reason for hiding this comment

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

Get set ready for Acter Buzz!! 🔔

Changes look good to me.

Note:

  • Need to resolve few lint errors and unit test before merge.

@@ -21,11 +19,6 @@ Future<bool> autosubscribe({
required L10n lang,
SubscriptionSubType? subType,
}) async {
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

@gnunicorn gnunicorn enabled auto-merge February 18, 2025 14:06
@gnunicorn gnunicorn merged commit e3eee03 into main Feb 18, 2025
22 of 23 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
f-push-notifications Problem with the push notifications feature
Projects
Status: Recently Done
Development

Successfully merging this pull request may close these issues.

2 participants