[ 
https://issues.apache.org/jira/browse/ROL-1926?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13594663#comment-13594663
 ] 

Nicolas Muller commented on ROL-1926:
-------------------------------------

Hello,

We met this problem in production : Comment notifcation emails being sent 
before comment approval https://issues.apache.org/jira/browse/ROL-1926

The solution is to test into MailUtil.java if the current comment is approved. 
The method sendEmailNotification  is called if an user posts a comment or when 
the admin validate a comment waiting for.

In this method, we must add this line "if (commentObject.getApproved())"  to 
test if the current comment is right. 
Else as the previous bug explains, others subscribers will be received an email 
for non approval comments.

Thanks a lot for your reading :-)
Best regards, 

// If we are to notify subscribers, then...
             if (notifySubscribers) {
                    log.debug("Sending notification email to all subscribers");

                    // Get all the subscribers to this comment thread
                    List comments = entry.getComments(true, true);
                    for (Iterator it = comments.iterator(); it.hasNext();) {
                           WeblogEntryComment comment = (WeblogEntryComment) 
it.next();
                           if (!StringUtils.isEmpty(comment.getEmail())) {
                                  // If user has commented twice,
                                  // count the most recent notify setting
                                  if (commentObject.getApproved()) {      
                                        if (comment.getNotify().booleanValue()) 
{
                                               // only add those with valid 
email
                                               if 
(comment.getEmail().matches(EMAIL_ADDR_REGEXP)) {
                                                      log.info("Add to 
subscribers list : " + comment.getEmail());
                                                      
subscribers.add(comment.getEmail());
                                               }
                                        } else {
                                               // remove user who doesn't want 
to be notified
                                               log.info("Remove from 
subscribers list : " + comment.getEmail());
                                               
subscribers.remove(comment.getEmail());
                                        }
                                  }
                           }      
                    }
             } else {
                    log.debug("Sending notification email only to weblog 
owner");
             }

                
> Comment notifcation emails being sent before comment approval
> -------------------------------------------------------------
>
>                 Key: ROL-1926
>                 URL: https://issues.apache.org/jira/browse/ROL-1926
>             Project: Roller
>          Issue Type: Bug
>          Components: Comments
>    Affects Versions: 4.0, 5.0
>         Environment: Any 4.0 or 5.0 instance
>            Reporter: David Johnson
>            Assignee: David Johnson
>
> I'm noticing that if I subscribe to be notified of new comments for an
> entry, I am getting emails even before they are approved.
> I'm running Roller 4.0.1 on Oracle DB and WLS11g.
> Comment authentication is required globally. "Require comment moderation for
> all weblogs" is checked in server admin area
> Steps taken:
> 1. Create a comment on entry page and provide email and check "Notify me by
> email of new comments."
> 2. As an admin, go into the blog comment area. Ensure that it is Pending.
> See also email message: http://markmail.org/message/wvkzsd2lej33aw7d

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira

Reply via email to