I have a setup using mailhandler and mailcomment to fetch emails. Nodes are created in OG groups and the messaging and notifications modules send emails to group members with node content. Some of the groups are discussions and allow comments. But 2 of them are for announcements, and do not allow comments. They use different node types "discussion" and "announcement." The former is set to allow read/write comments and the latter has comments disabled. The importers for discussion groups sets comments=2 on the discussion nodes. Importers for announcement groups set comment=0.
Each group has a feed importer, i.e. group1@example.com, group2@example.com, .... All comments are fetched by listmaster@example.com. Listmaster is the owner of the groups to ensure that the reply-to address is set properly.
In the mailcomment settings page you can select node types to which comments will be attached. The module then sets a variable identifying those node types.
With the most recent upgrades, moving from mailhandler 6.x.1.x and mailcomment 6.x.1.x to the most recent official versions, a problem has arisen with comments.
If a group member replies to an announcement node, mailcomment is disregarding the fact that the node is set for no comments and the node type is set for no comments. It is creating the comments, attaching them to the nodes, and ultimately emails are sent to subscribers. I see nowhere in the code that mailcomment checks the original node to determine what the comment=X setting is.
Comments
Comment #1
danepowell commentedOkay, a few things...
admin/messaging/mailcommentfor "Mail Comment content types"? If 'announcement' is not selected, then no Mail Comment info ("reply above this line to post a comment") should get added to outgoing announcement notifications. Are you saying that 'announcement' is not selected, and the reply text is still getting inserted?Another spin-off issue might be to make Mail Comment content types default to all content types with comments enabled.
Comment #2
rsbecker commentedThanks for responding so quickly.
I am not using the reply line. It does not seem to be necessary since you added the input filters. Mailcomment and mailhandler do a pretty good job of getting rid of all the garbage.
At first the Announcement node type was selected as one of the mailcomment node types. But I have removed that.
I will post this to the fcp queue.
Comment #3
danepowell commentedSorry, I misspoke- you are right that the "Reply above this line" business only gets added if you check the box for it. What I meant to ask is: is Mail Comment identifier information getting added to outgoing announcements even though announcements are not set as a Mail Comment content type? By 'identifier' I mean a string in the message body like "View original post: www.example.com/mailcomment/redirect/1.2.3.4..." or a string like "1.2.3.4" in the references, in_reply_to, or threading header. If you're not sure, just post a raw copy of the problematic message (including headers). You can obfuscate sensitive information like email addresses if you'd like.
Comment #4
danepowell commentedComment #5
rsbecker commentedThat would not happen because I am using messaging templates to format the outgoing emails. There is a link to the original node and a link to the comment, but they are placed there using tokens. So I cannot answer that question
Comment #6
danepowell commentedHmm... well at any rate, now that you've removed Announcement from the Mail Comment node types as you mentioned in #2, are replies to announcements still getting posted as comments? If so, I'll need a copy of the message to troubleshoot... you can contact me privately if you'd prefer not to post it in a public forum.
Comment #7
rsbecker commentedNow that the caches have been thoroughly cleared it appears that when a node type is not selected in mailcomment the reply-to address of the outgoing emails is not set to listmaster@example.com. It remains the address of the original poster So anyone who replies will by default send the message to the individual, not to the group. That is fine with me.
I will keep watching to make sure this behavior continues.
But I think there should be a check somewhere to make sure that comments are enabled for the node. I can envision a situation where a node type is used in more than one group and in some groups you want to allow comments and in others you don't. The node type would be set to allow comments. But, using mailhandler commands you can set the individual node to comment: 0, 1 or 2 for the group's mailhandler node feed importer. Mailcomment or fcp should respect that choice.
I posted the issue to fcp, so we'll see what they say.
I think this module and mailhandler have gotten much improved recently. It was a little tricky setting them up after the change. But once I figured it out the setup was quite logical. Because the old documentation doesn't really work anymore, I have been thinking of writing new documentation for setting up a system that functions like a listserv using og, messaging, notifications, mailhandler, mailcomment and feeds. But I've been slammed with real work, which isn't drupal development, and I haven't had time.
Thanks for your help.
Comment #8
danepowell commentedOkay, I see what you're saying now- even if comments are enabled by default for a content type, comments may be disabled on particular nodes of that content type. In those cases, Mail Comment should not act on the nodes. I completely agree. I'll add a conditional to prevent this in my next round of commits.
One thing related to this I was thinking of- should there even be a Mail Comment node types settings, or should Mail Comment simply act on any node when comments and notifications for that node are enabled? I can't imagine a situation where an administrator would allow comments and subscriptions on a node, but NOT want users to be able to reply via email...
Comment #9
rsbecker commentedLet me start with your last question.
On the site I have been discussing we have some nodes that are purely announcements of upcoming events, some events put on by the organization, others put on by outsiders that might be of interest to the organization. Some could just be calendar entries. In any case, the purpose is to put out notice, not encourage discussion. So we turned comments off for that node type
In that category we moderate submissions, so they come in through mailhandler as unpublished, and a moderator makes a decision to publish them. If we were to allow comments we would have to moderate those as well. but that complicates the whole system.
The other groups are discussion groups, mostly among members one committee or another. Those don't get emailed to the organization, only to members of the og group (committee members). Discussion is encouraged, and we do not moderate these.
If we have one mailbox for all comments, in this case listmaster@example.com, the mailhandler commands are set to comment: 2, status: 1. So all comments are published and comments can be posted on comments.
To allow comments on the announcements/calendar entries, we would have to set up a second mailbox for those items, i.e. listmaster2@example.com, with comments: 2, status:0. Then someone would have to select comments that should be published.
Perhaps you do not need to select node types that mailcomment will act upon. But it might be easier for site administrators, particularly if they use the "Reply above this line" method, to be able to make that choice. I suspect there are sites that send email notifications on a wide variety of node types, such as image nodes, simplenews newsletters, etc., and they don't want comments on those. So they can set mailcomment not to put the tagline on them.
Comment #10
danepowell commentedI think I see what you are saying- but it doesn't sound like you're describing a scenario where all of the following conditions are true:
1) A node allows comments to be posted
2) A node allows subscriptions / notifications
3) You want users to be able to post comments to the node via the web interface, but NOT via email
The "Mail Comment node types" setting enforces (3). But that just seems unnecessary, doesn't it? If (1) and (2) are true, and users could reply via the web interface, then why shouldn't they be allowed to reply by email? So Mail Comment should probably automatically act on these, without needing explicit administrator approval, right?
(Edit: if it's not clear, I'm trying to make an argument here to eliminate the "Mail Comment node types" setting. This would be nice since it would clean up the UX and make Mail Comment setup easier. But I want to make sure that this isn't going to disrupt any existing workflows.)
Comment #11
rsbecker commentedFor my purposes it is fine to have different node types, one that allows comments and another that doesn't. So, what I need is for mailcomment or fcp to check before adding comments
A. that the node type allows comments
B. that the node to which the comment is to be attached allows comments
Optimally, it would be nice if, when mailcomment determines that the node type does not allow comments it send a response telling the sender why the comment was discarded.
I am not disagreeing with eliminating the selection of node types. I was just playing devil's advocate, saying I can envision scenarios where that selection might be helpful. For my setup it is not necessary, because I don't use the tag line, and with the new mailcomment filters the tagline doesn't seem to be necessary, unless the commenter is not using an email program that puts in "On x date so-and-so wrote:" or some other tag that can be filtered.
Comment #12
danepowell commentedI've committed a fix to both branches- please try the dev version that will roll tonight and let me know if it solves your problem.
http://drupalcode.org/project/mailcomment.git/commit/a2c5185
http://drupalcode.org/project/mailcomment.git/commit/508301e
Comment #13
rsbecker commentedThe changes you made appear to work. When I sent a comment to a discussion node, which allows comments, it was attached and sent to the group. When I sent a comment to an announcement node, which does not allow comments, it was rejected and the site reported "Unable create comment with empty NID."
On the announcement node that came to me as an email, when I clicked reply to sender, the reply-to address remained that of the original sender, not listmaster@example.com. So anyone who tries to reply must change that address. That behavior minimizes the likelihood that anyone will attempt to reply, which is fine with me.
There appear to be a couple of problems that still need fixing.
1. I sent a discussion node, which originally allowed comments. Then I changed the node to disable comments and clicked reply to sender. Mailcomment appears to disregard the change on the node. I repeated this with the node's comment setting as Read only. Same result. I then removed comment: 2 from the listmaster feed importer and got the same result. It appears the module is looking at the node type settings, but not the node settings.
2. When I installed the new dev version I noticed that the Master mailcomment mailbox dropdown is not being populated. This did not change after running update.php or after clearing all caches. In my setup, which uses a distinct mailbox for all comments, that does not appear to break anything. But it might not work for some other setup.
I noticed another issue, but I suspect it has to do with mailhandler, rather than mailcomment. In the feed importer for the discussion group I have selected Do not update existing nodes, and in the feed importer for listmaster I have selected Do not update existing comments. But the discussion group is sending an update of the node every time it attaches a comment.
Thanks for working on this issue.
Comment #14
rsbecker commentedDana
Today the Mailcomment master mailbox dropdown is populated. I don't know what changed since yesterday, other than I installed the latest dev version of mailhandler, which should have no impact on that field.
Comment #15
danepowell commentedComment #16
danepowell commented1) This is a bug with FCP: #1338752: Comments being imported even on nodes with comments disabled Mail Comment only really acts on notifications, it has very little to do with messages being imported.
2) Not sure what happened there, I've been making a lot of changes so maybe something was temporarily broken.
I think you are misunderstanding the meaning of "do not update existing nodes" - this means "don't overwrite an existing node when importing a new message". It has nothing to do with notifications.
Comment #17
rsbecker commentedWhen I originally contacted you about these problems you thought fcp might be the problem. So I posted the same thing to fcp, which is what you linked to. As you saw, I received no response from the folks working on fcp.
Is there a way to set this up so the site does not send an update of the node every time a comment is posted to it? I think that used to be the behavior under 6.x.1.x of mailhandler and mailcomment. As this now works, every time a comment is sent subscribers receive 2 emails, one that is the node, which has not been changed at all, and the second is the new comment.
Thanks for all your help with this.
Comment #18
danepowell commentedYeah, sorry you're not getting any help from andrewlevine (maintainer of FCP). I do have commit access to it, but it's not really my project. You might contact him directly to see if he can help with the issue. It would really be a simple fix, and I could take care of it if absolutely necessary, but I wish he would take care of his own module ;) Alternatively, if you or someone else submitted a patch for it I would review and commit it.
I'm not sure why you are getting duplicate emails - it certainly has nothing to do with Mail Comment. It sounds like a bug with Notifications. I have tested subscribing to a node and posting a comment to that node, and even with notifications of node updates enabled, I still only get one notification email...