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
Comments
Comment #2
cbeem commentedComment #3
cbeem commentedI 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
Comment #4
cbeem commentedMore 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
Comment #5
cbeem commentedI 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
Comment #6
gisleNotify 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.
Comment #7
cbeem commentedThanks :)
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 :)
Comment #9
gisleWould like some feedback on the commit made on July 10 2021 fixed the issue.
Comment #10
gisleNo feedback on this commit. I am moving to "Fixed". Please create a new issue if you think that this bug persists.