Apache Roller
  1. Apache Roller
  2. ROL-1926

Comment notifcation emails being sent before comment approval

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 4.0, 5.0
    • Fix Version/s: None
    • Component/s: Comments
    • Labels:
      None
    • Environment:
      Any 4.0 or 5.0 instance

      Description

      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

        Activity

        David Johnson created issue -
        Hide
        Nicolas Muller added a comment -

        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"); }
        Show
        Nicolas Muller added a comment - 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"); }
        Hide
        David Johnson added a comment -
        Show
        David Johnson added a comment - Thanks for the fix Nicolas! http://svn.apache.org/viewvc?view=revision&revision=r1465236
        David Johnson made changes -
        Field Original Value New Value
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            David Johnson
            Reporter:
            David Johnson
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development