If a node is commented and the node does not belong to group, the wrong message-type is used "commons_notify_node_created_no_groups".

This should be changed to "commons_notify_comment_created_no_groups" and this message type needs to be defined.

commons_notify.module:

/**
 * Implements hook_comment_insert().
 */
function commons_notify_comment_insert($comment) {
  $account = user_load($comment->uid);
  $node = node_load($comment->nid);
  $message_type = 'commons_notify_comment_created';
  $hook = 'comment_insert';
  if (!isset($node->og_group_ref[LANGUAGE_NONE][0]['target_id'])) {
    $message_type = 'commons_notify_node_created_no_groups';
  }
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ezra-g’s picture

Issue tags: +Commons 7.x-3.4 radar

Thanks for this report! Are you able to help fix the problem by filing a patch?.

Adding to the Commons 3.4 radar.

slowflyer’s picture

Version: 7.x-3.3 » 7.x-3.x-dev
FileSize
11.72 KB

Let's try it...

ezra-g’s picture

Status: Active » Needs work

Thanks for the patch, slowflyer!

It appears that your patch contains a range of changes that aren't related to this issue. I think this hunk is the relevant one:

+++ b/profiles/commons/modules/contrib/commons_notify/commons_notify.module
@@ -76,7 +76,7 @@ function commons_notify_comment_insert($comment) {
   }

Marking as "needs work" though I can likely do some functional testing by making that change manually, since it appears like a single-line change.

slowflyer’s picture

Hi Ezra,

yes it's a single line of code in commons_notify.module + creating the new message type, which let the patch after recreating the feature appear really complex.

ezra-g’s picture

Status: Needs work » Needs review

Thanks for that explanation! I misunderstood the nature of the fix - Moving back to "needs review".

slowflyer’s picture

Please don't forget ...

japerry’s picture

Assigned: Unassigned » japerry
japerry’s picture

FileSize
9.57 KB

Pushing a new patch thats compatible with 3.4. Still needs review.

japerry’s picture

Status: Needs review » Fixed

Needed a few more things like target nodes and comments. After I copied from the comments message notify, I tested comments on a non-group node and it tested out good.

Committed! http://drupalcode.org/project/commons.git/commit/93a4924

japerry’s picture

Status: Fixed » Needs work
Issue tags: -commons 7.x-3.5 radar +commons 7.x-3.6 radar

For some reason on Commons 3.5, this is not working again. Code is in there, but I think an .info line is missing. Also, node notifications has an attached comment field, which shouldn't exist.

ezra-g’s picture

ezra-g’s picture

Priority: Normal » Major

Bumping to major given the number of reports we've had of this issue.

japerry’s picture

Status: Needs work » Fixed

Marking as fixed again. I committed the code to the info file here (sorry for the double issue post!)...

There appears to be other issues with email notifications being sent out, but at least this specific issue appears to be fixed in my testing. Feel free to re-open if you're seeing issues again.

http://drupalcode.org/project/commons.git/commit/151d778

ezra-g’s picture

Status: Fixed » Needs review

Looks like there's a lot of code that went into this commit that appears unrelated to this feature and as far as I can tell, didn't appear as a patch. @japerry, was that intentional? If so, can you share your thinking behind those changes?

japerry’s picture

Status: Needs review » Fixed

Per #10, #13 commits code that fixes those issues. It was unintentionally committed while trying to get in #1920824

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.