Blocked users get notifications when subscribed.

Created on 28 March 2023, about 1 year ago
Updated 19 April 2023, about 1 year ago

Problem/Motivation

When a user is subscribed to an event (in our case the user is subscribed to the comments of a forum post) and their account is blocked, the user still gets notifications when a new comment is published.

I know there is a recipient selection plugin to notify all the active users, but that does not seem to affect the subscribers.
Is there any other configuration I can set to only send notifications to active subscribers?

Steps to reproduce

  1. Enable the DANSE and DANSE Content modules.
  2. Configure a content type to create events on comments.
  3. Allow authenticated users to subscribe to the events.
  4. As an authenticated user, subscribe to a node of the content type set for events.
  5. Block the subscribed user account.
  6. As another user, comment on the node the first user subscribes.
  7. Run the cron
  8. Check the event on the DANSE dashboard, and search for the blocked user in the list.

Proposed resolution

I notice the function getSubscribers() of PluginBase.php gets all the subscribed users and does not check if the user is active. A possible solution could be to only send notifications to active users and add a validation to the function.

✨ Feature request
Status

Fixed

Version

2.2

Component

Code

Created by

πŸ‡¨πŸ‡΄Colombia s_castro

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @s_castro
  • πŸ‡¨πŸ‡΄Colombia s_castro

    This is the patch implementing the proposed solution. It worked for me.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    This is great, thanks a lot @s_castro for reporting and fixing this. I've just merged your patch.

    This triggered some thoughts also related to blocked users:

    • Should we delete subscriptions for users that get blocked or deleted?
    • Should we delete notifications for users that get blocked or deleted? Or should we at least mark them as delivered?
  • πŸ‡¨πŸ‡΄Colombia s_castro

    Answering your questions with my opinion:

    Should we delete subscriptions for users that get blocked or deleted?
    The subscriptions should be deactivated when the user gets blocked (and reactivated again if the account is reactivated). When the user gets deleted the subscriptions should be deleted as well.

    Should we delete notifications for users that get blocked or deleted? Or should we at least mark them as delivered?
    I think marking them as delivered is okay as long as the subscriptions are blocked or removed and new notifications are not created.

  • Assigned to jurgenhaas
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen
  • Issue was unassigned.
  • Status changed to Needs review about 1 year ago
  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Here is what's now implemented:

    • Prevent new subscription notifications for blocked users (done in patch from #2)
    • Prevent new notifications for deleted or blocked users
    • If a user gets blocked, all undelivered notifications for that user get marked as delivered
    • If a user gets deleted, all notifications for that user get deleted

    Subscription settings for each user are stored in user data. Therefore, they remain intact while a user is blocked and will be still present when the user gets re-activated. When a user gets deleted, their user data also gets deleted; hence the subscription settings will be deleted too.

    Please have a look and set to RTBC when all is ok.

  • πŸ‡©πŸ‡ͺGermany jurgenhaas Gottmadingen

    Marking as fixed as I'm publishing a new version and need to include this. Should there be any issue still, please open a new issue then.

  • Status changed to Fixed about 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.69.0 2024