Users subscribed to another user also getting notifications when comments are added to a post created by the user subscribed to

Created on 10 April 2013, about 11 years ago
Updated 6 January 2024, 6 months ago

Problem/Motivation

Scenario:
User A created Post 1 and is subscribed to his own post
User B is subscrbed to User A
User B is not subscribed to Post 1
User C commented on Post 1
System notifies User A (correct) and User B (not correct)

The reason I think notifying User B is not correct is because User B is only subscribed to User A and not to the post that User A created (Post 1).

"Subscribed" in this context means the email flag is on.

Proposed resolution

In function message_subscribe_get_basic_context(), particularly the code below,

// Default context for comments.
if ($entity_type == 'comment') {
  $context['node'][$entity->nid] = $entity->nid;
  $context['user'][$entity->uid] = $entity->uid;
}

... adds the entity the comment belongs to, subsequently also adding the 1) creator of the entity (correct), 2) subscribers of the entity (correct), as well as 3) the followers of the author of the entity (not correct).

I can't think of a "graceful" way to recode this at the moment.

Using hook_message_subscribe_get_subscribers_alter
It's possible to remove unnecessary UIDs (users that were included because they were subscribers of the author of the entity) by traversing the UIDs passed to the hook and doing some DB queries.

✨ Feature request
Status

Closed: outdated

Component

Code

Created by

πŸ‡΅πŸ‡­Philippines angheloko

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

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024