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 the two yellow lines 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 J

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");

             }

 

----------------------------------

Nicolas MULLER

+33(4) 95 04 32 48

 <mailto:[email protected]%0d> [email protected]

nouvelle MARQUE

13 rue Sénac de Meilhan

13001 Marseille

 <http://www.nouvelle-marque.com/> http://www.nouvelle-marque.com

 

 

 

 

Reply via email to