-
-
Notifications
You must be signed in to change notification settings - Fork 7.9k
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
Fix issues around soft deactivation and push notifications #10397
Comments
@zulipbot claim |
Fixes part of zulip#10397. It was discovered that soft-deactivated users don't get mobile push notifications for messages on private streams that they have configured to send push notifications. Reason: `handle_push_notification` calls `access_message`, and that logic assumes that a user who is a recipient of a message has an associated UserMessage row. Those UserMessage rows are created lazily for soft-deactivated users, so they might not exist (yet) until the user comes back. Solution: Removing stream_push_user_ids and stream_email_user_ids from long_term_idle_user_ids ensures that a UserMessage row is created in `create_user_messages`.
Fixes part of zulip#10397. It was discovered that soft-deactivated users don't get mobile push notifications for messages on private streams that they have configured to send push notifications. Reason: `handle_push_notification` calls `access_message`, and that logic assumes that a user who is a recipient of a message has an associated UserMessage row. Those UserMessage rows are created lazily for soft-deactivated users, so they might not exist (yet) until the user comes back. Solution: Ensure that userMessage row is created for stream_push_user_ids and stream_email_user_ids in create_user_messages.
Hello @shubham-padia, you claimed this issue to work on it, but this issue and any referenced pull requests haven't been updated for 10 days. Are you still working on this issue? If so, please update this issue by leaving a comment on this issue to let me know that you're still working on it. Otherwise, I'll automatically remove you from this issue in 4 days. If you've decided to work on something else, simply comment Thank you for your valuable contributions to Zulip! |
Fixes the urgent part of #10397. It was discovered that soft-deactivated users don't get mobile push notifications for messages on private streams that they have configured to send push notifications. Reason: `handle_push_notification` calls `access_message`, and that logic assumes that a user who is a recipient of a message has an associated UserMessage row. Those UserMessage rows are created lazily for soft-deactivated users, so they might not exist (yet) until the user comes back. Solution: Ensure that userMessage row is created for stream_push_user_ids and stream_email_user_ids in create_user_messages.
I merged #10491, which covers the urgent/proximal issue here. I'm leaving the remaining issue open for us to think about whether we also want to modify |
Fixes the urgent part of zulip#10397. It was discovered that soft-deactivated users don't get mobile push notifications for messages on private streams that they have configured to send push notifications. Reason: `handle_push_notification` calls `access_message`, and that logic assumes that a user who is a recipient of a message has an associated UserMessage row. Those UserMessage rows are created lazily for soft-deactivated users, so they might not exist (yet) until the user comes back. Solution: Ensure that userMessage row is created for stream_push_user_ids and stream_email_user_ids in create_user_messages.
Today I discovered that soft-deactivated users don't get mobile push notifications for messages on private streams that they have configured to send push notifications. This is pretty poor, since the whole purpose of this feature is to help these users learn about things happening in that stream. (I think email notifications may still work).
Here's the problem:
handle_push_notification
callsaccess_message
, and that logic assumes that a user who is a recipient of a message has an associated UserMessage rowThe outcome is
access_message
throwing an exception inhandle_push_notification
. There are 2 ways one could imagine fixing this:(1) Ensuring
do_send_messages
creates aUserMessage
row when a user has configured a stream to send mobile push notifications or emails, so that our notifications code can always assume a UserMessage row is present. This should completely cover the notifications use case where this originally came up, since the whole soft-deactivation model is that it's always OK forUserMessage
rows to have been created before soft-reactivation.(2) Changing
access_message
to do something fancy for soft-deactivated users, effectively calling a function wrappingfilter_by_subscription_history
to create just that oneUserMessage
row on-demand if appropriate. This would ensure that all of our API endpoints grant the user access to the message. We might need to also do something similar invalidate_attachment_request
; I'm not sure.I think we definitely want to do (1), because that helps simplify the understanding required for our notifications code. It is possible we also want to do (2); but let's hold off on thinking about that until we've implemented (1); I think for performance reasons, (1) is worth doing regardless of whether we also do (2).
For (1), I think it would suffice to change this block in
get_recipient_info
to excludestream_push_user_ids
andstream_email_user_ids
from the list.See https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html#soft-deactivation for background.
@showell @adnrs96 FYI.
The text was updated successfully, but these errors were encountered: