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.
Comments
Comment #1
amitaibuYou could also build the context yourself and skip the message_subscribe_get_basic_context(), however it would be nice to "fix" the problem by filtering according to your definition above
Patches are welcome :)
Comment #2
angheloko commentedHi Amitaibu,
You are correct. Your suggestion is actually easier. These kinds of developer flexibility is just what makes these kinds of modules superb!
Thanks!
Comment #2.0
angheloko commentedRemoved unnecessary details.
Comment #3
bluegeek9 commented