Problem/Motivation

I have set up a taxonomy with comments on the taxonomy term.

e.g. taxonomy term tid 977

Notify is sending emails for any comments added under this term to link to a node id nid 977, which has nothing to do with the taxonomy term. As a result, some very strange emails are arriving!

Notify is regarding /term/977 as /node/977

Thx

Steps to reproduce

Proposed resolution

Check the entity type associated with the comment. Do not send the notification if it is not a node.

Remaining tasks

User interface changes

API changes

Data model changes

CommentFileSizeAuthor
#5 tid-nid conflicts.png63.73 KBcbeem

Comments

CBEEM created an issue. See original summary.

cbeem’s picture

Issue summary: View changes
cbeem’s picture

I have temporarily solved this in my case.

notify.module line 296:

$all = NodeType::loadMultiple();
$ntype = [];
+ $list = array("article", "event", "pinboard", "song_lyrics", "life");
foreach ($all as $type => $object) {
+ if (in_array($type, $list)) {
$ntype[] = $type;
+ }
}

This change ensures that comments attached to nodes/types that are not in the array are not sent out (the array is just a list of my default choices).

Comments attached to taxonomy terms are not sent out with the above settings.

This does not in general address the issue of comments being sent out for restricted content, but al least in my case it prevents the node/term mix up.

Thx

cbeem’s picture

More likely it is just coincidence that with everything I have tested so far that the limiting array does not contain nids that are the same as the term tids. At some point, this will fail.

It would be great to have a permanent fix for this nid/tid issue.

Thx

cbeem’s picture

StatusFileSize
new63.73 KB

I am lucky so far, limiting to the 5 content types in $list in #3 does not yet produce conflicts:

SELECT * FROM `taxonomy_term_data` INNER JOIN `node` ON taxonomy_term_data.tid = node.nid WHERE node.type IN("article", "event", "pinboard", "song_lyrics", "life")

The only taxonomy vocabulary producing conflicts is "life" where tid = nid for the content type "article".

I do not yet have any commenting enabled for the "life" taxonomy, so as yet no conflicts.

But with Drupal 8/9, everything is an entity which can have fields etc, so it is only a matter of time until this becomes an issue for anybody adding comment fields to any entity other than "node", in my case, taxonomy terms.

I'm not sure how to proceed with this.

Thx

gisle’s picture

Issue summary: View changes

Notify is not supposed to handle anything except the node content type. It cannot even be configured to send out notifications about new taxonomy terms, etc.

This assumption breaks for comments that is attached to entities that are not nodes (in your case taxonomies).

The way I propose to fix this is: Check the entity type associated with the comment. Do not send the notification if it is not a node.

I think this is a rare use case, so it will not be prioritized until the community comes up with a working patch.

cbeem’s picture

Thanks :)

I like the module, it seems to be working well. It's great for me because the previous developer of the site relied heavily on notify. Good job getting it going from the D7 module, I know it's a lot of work.

I have large hierarchical taxonomies on the site, as entities with fields they appear to the end user just like any other node. It is definitely a superior way to control hierarchies rather than applying some sort of hierarchy structure to nodes.

I look forward to a fix for this issue at some stage.

Thanks again :)

  • gisle authored 4ef5d33 on 2.0.x
    Issue #3221819 by gisle: First stab at purging non-node comments
    
gisle’s picture

Status: Active » Needs review

Would like some feedback on the commit made on July 10 2021 fixed the issue.

gisle’s picture

Status: Needs review » Fixed

No feedback on this commit. I am moving to "Fixed". Please create a new issue if you think that this bug persists.

Status: Fixed » Closed (fixed)

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