Author: snoopdave
Date: Mon Aug 19 12:23:08 2013
New Revision: 1515382

URL: http://svn.apache.org/r1515382
Log:
Don't send email notifications when comment not approved

Modified:
    
roller/branches/roller_5.0/weblogger-business/src/main/java/org/apache/roller/weblogger/util/MailUtil.java

Modified: 
roller/branches/roller_5.0/weblogger-business/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
URL: 
http://svn.apache.org/viewvc/roller/branches/roller_5.0/weblogger-business/src/main/java/org/apache/roller/weblogger/util/MailUtil.java?rev=1515382&r1=1515381&r2=1515382&view=diff
==============================================================================
--- 
roller/branches/roller_5.0/weblogger-business/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
 (original)
+++ 
roller/branches/roller_5.0/weblogger-business/src/main/java/org/apache/roller/weblogger/util/MailUtil.java
 Mon Aug 19 12:23:08 2013
@@ -294,31 +294,35 @@ public class MailUtil {
         // build list of email addresses to send notification to
         Set subscribers = new TreeSet();
         
-        // 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 (comment.getNotify().booleanValue()) {
-                        // only add those with valid email
-                        if (comment.getEmail().matches(EMAIL_ADDR_REGEXP)) {
-                            subscribers.add(comment.getEmail());
-                        }
-                    } else {
-                        // remove user who doesn't want to be notified
-                        subscribers.remove(comment.getEmail());
-                    }
-                }
-            }
-        } else {
-            log.debug("Sending notification email only to weblog owner");
-        }
+               // 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");
+               }
         
         // Form array of commenter addrs
         String[] commenterAddrs = (String[])subscribers.toArray(new String[0]);


Reply via email to