Add 'show only notifications for this entry' link and options.  Also, 
this was bug #3, woah.

        Patch by afuna. 

diffs (87 lines):

diff -r c8a5ddc28716 -r 43de6d4f95fb cgi-bin/LJ/Event/JournalNewComment.pm
--- a/cgi-bin/LJ/Event/JournalNewComment.pm     Tue Oct 20 20:35:15 2009 -0500
+++ b/cgi-bin/LJ/Event/JournalNewComment.pm     Wed Oct 21 17:15:15 2009 +0000
@@ -263,11 +263,14 @@ sub as_html {
     my $subject = $comment->subject_text ? ' "' . $comment->subject_text . '"' 
: '';
 
     my $poster = $comment->poster ? "by $pu" : '';
+    my $ret;
     if ($comment->is_edited) {
-        return "Edited <a href=\"$url\">comment</a> $subject $poster on 
$in_text in $ju.";
+        $ret = "Edited <a href=\"$url\">comment</a> $subject $poster on 
$in_text in $ju.";
     } else {
-        return "New <a href=\"$url\">comment</a> $subject $poster on $in_text 
in $ju.";
+        $ret ="New <a href=\"$url\">comment</a> $subject $poster on $in_text 
in $ju.";
     }
+
+    $ret .= ' <span class="filterlink_singleentry">(<a 
href="/inbox/?view=singleentry&itemid=' . $entry->ditemid . '">filter to this 
entry</a>)</span>';
 }
 
 sub as_html_actions {
diff -r c8a5ddc28716 -r 43de6d4f95fb cgi-bin/LJ/NotificationInbox.pm
--- a/cgi-bin/LJ/NotificationInbox.pm   Tue Oct 20 20:35:15 2009 -0500
+++ b/cgi-bin/LJ/NotificationInbox.pm   Wed Oct 21 17:15:15 2009 +0000
@@ -157,6 +157,11 @@ sub subset_items {
 
      my %subset_events = map { "LJ::Event::" . $_ => 1 } @subset;
      return grep { $subset_events{$_->event->class} } $self->items;
+}
+
+sub singleentry_items {
+    my ( $self, $itemid ) = @_;
+    return grep { $_->event->class eq "LJ::Event::JournalNewComment" && 
$_->event->comment->entry->ditemid == $itemid } $self->items;
 }
 
 # return flagged notifications
@@ -544,6 +549,8 @@ sub delete_all {
         @items = $self->bookmark_items;
     } elsif ( $view eq 'usermsg_sent' ) {
         @items = $self->usermsg_sent_items;
+    } elsif ( $view eq 'singleentry' ) {
+        @items = $self->singleentry_items;
     }
 
     @items = grep { !$self->is_bookmark($_->qid) } @items
@@ -586,6 +593,8 @@ sub mark_all_read {
         @items = $self->bookmark_items;
     } elsif ( $view eq 'usermsg_sent' ) {
         @items = $self->usermsg_sent_items;
+    } elsif ( $view eq 'singleentry' ) {
+        @items = $self->singleentry_items;
     }
 
     # Mark read
diff -r c8a5ddc28716 -r 43de6d4f95fb htdocs/inbox/index.bml
--- a/htdocs/inbox/index.bml    Tue Oct 20 20:35:15 2009 -0500
+++ b/htdocs/inbox/index.bml    Wed Oct 21 17:15:15 2009 +0000
@@ -56,12 +56,15 @@ body<=
 
     # Bolds the selected View/Folder
     my $selected_folder = $view || 'all';
+    $selected_folder = "entrycomment" if $selected_folder eq "singleentry";
+
     $selected_folder = qq(
         <style>#esn_folder_$selected_folder {
         font-weight: bold;
         background-color: #ffd8d8;
         border: 1px solid #bbb;
-        }</style>
+        } 
+        .filterlink_$view {display: none;}</style>
         );
     $head = $selected_folder;
 
@@ -142,7 +145,12 @@ body<=
     # Filter by view if specified
     my @all_items;
     if ($view) {
-        @all_items = eval "\$inbox->${view}_items";
+        if ( $view eq "singleentry" ) {
+            my $itemid = int( $POST{itemid} || $GET{itemid} );
+            @all_items = eval "\$inbox->${view}_items( $itemid )";
+        } else {
+            @all_items = eval "\$inbox->${view}_items";
+        }
     } else {
         @all_items = $inbox->all_items;
     }
_______________________________________________
dw-changelog mailing list
[email protected]
http://lists.dwscoalition.org/mailman/listinfo/dw-changelog

Reply via email to