Андрей (andy) wrote in changelog,
Андрей
andy
changelog

[livejournal] r16161: LJSV-917 (ESN refactoring, part 1 // mes...

Committer: ailyin
LJSV-917 (ESN refactoring, part 1 // message arrives in the mail): if the following conditions are met:

- the entry author enabled "don't email" in the entry properties
- the entry author commented on their own entry
- someone else responded to the author's comment
- no specific tracks were set

the author used a notification about that "someone else's" comment, and they weren't supposed to. fix it.

also, add some comments to clarify what the code does, because it's complicated.

U   trunk/cgi-bin/LJ/Event/JournalNewComment.pm
Modified: trunk/cgi-bin/LJ/Event/JournalNewComment.pm
===================================================================
--- trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2010-01-28 09:51:03 UTC (rev 16160)
+++ trunk/cgi-bin/LJ/Event/JournalNewComment.pm	2010-01-28 10:13:41 UTC (rev 16161)
@@ -683,7 +683,11 @@
     my $email_ntypeid = LJ::NotificationMethod::Email->ntypeid;
 
     # own comments are deliberately sent to email only
-    if ($comment_author->prop('opt_getselfemail') && $acquire_sub_slot->()) {
+    if (
+        $comment_author->prop('opt_getselfemail') &&
+        $comment_author->get_cap('getselfemail') &&
+        $acquire_sub_slot->()
+    ) {
         push @subs, LJ::Subscription->new_from_row({
             'etypeid' => LJ::Event::JournalNewComment->etypeid,
             'userid'  => $comment_author->id,
@@ -691,9 +695,20 @@
         });
     }
 
+    # send a notification to the author of the "parent" comment, if they
+    # want to get it
     if (
         $parent_comment &&
-        !LJ::u_equals($comment_author, $parent_comment_author)
+
+        # if they are responding to themselves and wish to get that, we've
+        # already handled it above
+        !LJ::u_equals($comment_author, $parent_comment_author) &&
+
+        # if parent_comment_author is also the author of the container entry,
+        # we should respect their choice to not get this comment, as set
+        # in the entry properties
+        (!LJ::u_equals($parent_comment_author, $entry_poster) ||
+        !$entry->prop('opt_noemail'))
     ) {
         my @subs2 = LJ::Subscription->find($parent_comment_author,
             'event' => 'CommentReply',
@@ -713,8 +728,13 @@
         }
     }
 
+    # send a notification to the author of the entry, if they
+    # want to get it
     if (
+        # if they are responding to themselves and wish to get that, we've
+        # already handled it above
         !LJ::u_equals($comment_author, $entry_author) &&
+
         !$entry->prop('opt_noemail')
     ) {
         if (!LJ::u_equals($entry_author, $entry_journal)) {
@@ -740,6 +760,7 @@
 
     return @subs unless ($limit || !$original_limit);
 
+    # handle tracks as usual
     push @subs, $self->SUPER::subscriptions(
         cluster => $cid,
         limit   => $limit

Tags: andy, livejournal, pm
Subscribe

  • Post a new comment

    Error

    Anonymous comments are disabled in this journal

    default userpic

    Your reply will be screened

    Your IP address will be recorded 

  • 0 comments