Blocked users get notifications when subscribed.

Created on 28 March 2023, over 1 year ago
Updated 19 April 2023, over 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.

    • jurgenhaas committed 3249917e on 2.2.x
      Issue #3350920 by s_castro: Blocked users get notifications when...
  • 🇩🇪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
    • jurgenhaas committed 3e74fa1c on 2.2.x
      Issue #3350920 by s_castro, jurgenhaas: Blocked users get notifications...
  • Issue was unassigned.
  • Status changed to Needs review over 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 over 1 year ago
  • Automatically closed - issue fixed for 2 weeks with no activity.

Production build 0.71.5 2024