mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2010-01-08 11:41 pm

[dw-free] Poll section in inbox

[commit: http://hg.dwscoalition.org/dw-free/rev/158ae7b4a767]

http://bugs.dwscoalition.org/show_bug.cgi?id=2187

Add poll vote section to inbox, so you can easily see all of the
notifications that are for votes in your polls.

Patch by [personal profile] afuna.

Files modified:
  • bin/upgrading/en.dat
  • cgi-bin/LJ/NotificationInbox.pm
  • cgi-bin/LJ/Widget/InboxFolderNav.pm
  • htdocs/js/esn_inbox.js
  • htdocs/tools/endpoints/esn_inbox.bml
--------------------------------------------------------------------------------
diff -r 5663ae2d8b2b -r 158ae7b4a767 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat	Fri Jan 08 23:39:21 2010 +0000
+++ b/bin/upgrading/en.dat	Fri Jan 08 23:41:34 2010 +0000
@@ -1981,6 +1981,8 @@ inbox.menu.encircled=New People
 
 inbox.menu.new_message.btn=New Message
 
+inbox.menu.poll_votes=Poll Votes
+
 inbox.menu.sent=Sent
 
 inbox.message=Message
diff -r 5663ae2d8b2b -r 158ae7b4a767 cgi-bin/LJ/NotificationInbox.pm
--- a/cgi-bin/LJ/NotificationInbox.pm	Fri Jan 08 23:39:21 2010 +0000
+++ b/cgi-bin/LJ/NotificationInbox.pm	Fri Jan 08 23:41:34 2010 +0000
@@ -162,6 +162,10 @@ sub entrycomment_items {
     my @events = entrycomment_event_list();
 
     return $self->subset_items(@events);
+}
+
+sub pollvote_items {
+    return $_[0]->subset_items( 'PollVote' );
 }
 
 # return a subset of notificationitems
@@ -566,6 +570,8 @@ sub delete_all {
         my $itemid = $args{itemid} + 0;
         return unless $itemid;
         @items = $self->singleentry_items( $itemid );
+    } elsif ( $view eq 'pollvote' ) {
+        @items = $self->pollvote_items;
     }
 
     @items = grep { !$self->is_bookmark($_->qid) } @items
@@ -612,6 +618,8 @@ sub mark_all_read {
         my $itemid = $args{itemid} + 0;
         return unless $itemid;
         @items = $self->singleentry_items( $itemid );
+    } elsif ( $view eq 'pollvote' ) {
+        @items = $self->pollvote_items;
     }
 
     # Mark read
@@ -687,6 +695,11 @@ sub entrycomment_event_count {
     return $self->subset_unread_count(entrycomment_event_list());
 }
 
+sub pollvote_event_count {
+    my $self = shift;
+    return $self->subset_unread_count( 'PollVote' );
+}
+
 sub usermsg_recvd_event_count {
     my $self = shift;
     my @events = ('UserMessageRecvd' );
diff -r 5663ae2d8b2b -r 158ae7b4a767 cgi-bin/LJ/Widget/InboxFolderNav.pm
--- a/cgi-bin/LJ/Widget/InboxFolderNav.pm	Fri Jan 08 23:39:21 2010 +0000
+++ b/cgi-bin/LJ/Widget/InboxFolderNav.pm	Fri Jan 08 23:41:34 2010 +0000
@@ -88,6 +88,7 @@ sub render_body {
     $body .= $subfolder_link->( "birthday", "inbox.menu.birthdays", "subsubs" );
     $body .= $subfolder_link->( "encircled", "inbox.menu.encircled", "subsubs" );
     $body .= $subfolder_link->( "entrycomment", "inbox.menu.entries_and_comments", "subs", $unread_html->( $inbox->entrycomment_event_count ) );
+    $body .= $subfolder_link->( "pollvote", "inbox.menu.poll_votes", "subs", $unread_html->( $inbox->pollvote_event_count ) );
     $body .= qq{<span class="subs">---</span>\n};
     $body .= $subfolder_link->( "bookmark", "inbox.menu.bookmarks", "subs", "", 
         qq{<img src="$LJ::IMGPREFIX/flag_on.gif" width="12" height="14" border="0" />} );
diff -r 5663ae2d8b2b -r 158ae7b4a767 htdocs/js/esn_inbox.js
--- a/htdocs/js/esn_inbox.js	Fri Jan 08 23:39:21 2010 +0000
+++ b/htdocs/js/esn_inbox.js	Fri Jan 08 23:41:34 2010 +0000
@@ -306,6 +306,7 @@ ESN_Inbox.finishedUpdate = function (inf
     var usermsg_sent_count = 0;
     var friend_count = 0;
     var entrycomment_count = 0;
+    var pollvote_count = 0;
     var inbox_count  = info.items.length;
 
     info.items.forEach(function (item) {
@@ -355,6 +356,7 @@ ESN_Inbox.finishedUpdate = function (inf
     ESN_Inbox.refresh_count("esn_folder_usermsg_recvd", info.unread_usermsg_recvd);
     ESN_Inbox.refresh_count("esn_folder_circle", info.unread_friend);
     ESN_Inbox.refresh_count("esn_folder_entrycomment", info.unread_entrycomment);
+    ESN_Inbox.refresh_count("esn_folder_pollvote", info.unread_pollvote);
     ESN_Inbox.refresh_count("esn_folder_usermsg_sent", info.unread_usermsg_sent);
 
     if ( LiveJournal.gotInboxUpdate )
diff -r 5663ae2d8b2b -r 158ae7b4a767 htdocs/tools/endpoints/esn_inbox.bml
--- a/htdocs/tools/endpoints/esn_inbox.bml	Fri Jan 08 23:39:21 2010 +0000
+++ b/htdocs/tools/endpoints/esn_inbox.bml	Fri Jan 08 23:41:34 2010 +0000
@@ -112,6 +112,7 @@
         unread_usermsg_recvd => $inbox->usermsg_recvd_event_count,
         unread_friend => $inbox->circle_event_count,
         unread_entrycomment => $inbox->entrycomment_event_count,
+        unread_pollvote => $inbox->pollvote_event_count,
         unread_usermsg_sent => $inbox->usermsg_sent_event_count,
         %ret,
     });
--------------------------------------------------------------------------------