This is related to the new feature from #2088441: Don't send messages to the author.
The logic check in message_subscribe_get_subscribers() is incorrect in relation to the text on the UI.
Problem description
The text of the checkbox in the UI indicates that you should check the checkbox in order for message authors to be notified of their own post. However the check in message_subscribe_get_subscribers() is set to skip the user if the checkbox is checked.
The simpletests for this feature also have the logic backwards in that they are setting the notify_own_actions to TRUE when checking for an exclusion and setting to FALSE when checking for inclusion.
Possible Solutions
We can either adjust the text on the UI to say "Do not notify author of their own submissions" or we can alter the logic in the module and the simple tests.
If we reverse the logic (line 217 of message_subscribe.module), then the following lines in the simpletests will also need to be updated to account for the default state being that users are not notified of their own submissions (due to the tests assuming the default is that users get notified of their own actions):
- MessageSubscribeSubscribersTest->testGetSubscribers() Line 256
- MessageSubscribeSubscribersTest->testGetSubscribersExcludeSelf() Line 308
- MessageSubscribeSubscribersTest->testGetSubscribersExcludeSelf() Line 331
- MessageSubscribeSubscribersTest->testEntityAccess() Line 353
- MessageSubscribeSubscribersTest->testEntityAccess() Line 357
I'm happy to submit a patch using either approach (change the UI or change the logic).
Comments
Comment #1
amitaibuYes, let's fix the logic in code, following the logic of the variable name --
message_subscribe_notify_own_actions
Comment #2
shawn_smiley CreditAttribution: shawn_smiley commentedAttached is a patch which resolves the logic issue.
Changes included in this patch:
Comment #4
shawn_smiley CreditAttribution: shawn_smiley commentedUpdated the previous patch to include adjustments to the message_subscribe_email simpletests.
Comment #5
amitaibuThanks, @RoySegall will review it.
Comment #6
RoySegall CreditAttribution: RoySegall commentedI tested the patch and it's working as expected.
Comment #7
RoySegall CreditAttribution: RoySegall commentedCommitted, thanks.
Comment #9
loze CreditAttribution: loze commentedThere seems to still be an error in the logic.
Shouldn't we be checking the uid of the message and not the subscribed entity?
instead of
this makes it work as I would expect, however I may be interpreting the intended behavior wrongly.
I would think that we want the behavior to be: don't send an notification to a user that triggered the generating of that message.
not: don't send a notification to the author of the subscribed entity.
Comment #10
amitaibu@RoySegall, also I've noticed that the property name, unlike the other properties, is with underscores -- so please fix that as-well.
Comment #11
RoySegall CreditAttribution: RoySegall commented@loze - the user of the entity and the user that trigger the message isn't the same one? Even when the admin created node on the behalf of another user the message will create for that user.
Comment #12
amitaibuI think we can rename the property to
notify message owner
, so it will be more clear, and in that case check$message->uid
makes sense?
Comment #13
RoySegall CreditAttribution: RoySegall commentedI added a patch with the renaming.
Comment #15
amitaibuLets get it fixed, so we can roll RC2, and then do a full release...
Comment #16
RoySegall CreditAttribution: RoySegall commentedIt seems that OG is installed during the simple test. Even using module_enable(array('og'))
Comment #17
RoySegall CreditAttribution: RoySegall commentedUpdate: when using drupal_static_reset(); in the top of the function the test passed.
Comment #18
RoySegall CreditAttribution: RoySegall commentedFor some reason the problem with OG solved and i managed to pass the tests on my local machine. Let's see the tests.
Comment #19
amitaibuCommitted, thanks.