[dw-free] new inbox filter: community membership requests
[commit: http://hg.dwscoalition.org/dw-free/rev/34f7157d6bc5]
http://bugs.dwscoalition.org/show_bug.cgi?id=3644
Allow to filter inbox to community membership requests only.
Patch by
ninetydegrees.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=3644
Allow to filter inbox to community membership requests only.
Patch by
Files modified:
- bin/upgrading/en.dat
- cgi-bin/LJ/NotificationInbox.pm
- cgi-bin/LJ/Widget/InboxFolderNav.pm
--------------------------------------------------------------------------------
diff -r 70b2250cb3c8 -r 34f7157d6bc5 bin/upgrading/en.dat
--- a/bin/upgrading/en.dat Tue Jan 10 15:16:21 2012 +0800
+++ b/bin/upgrading/en.dat Tue Jan 10 16:39:11 2012 +0800
@@ -1819,6 +1819,8 @@
inbox.menu.circle_updates=Circle Updates
+inbox.menu.community_membership=Community Membership
+
inbox.menu.encircled=New People
inbox.menu.entries_and_comments=Entries and Comments
diff -r 70b2250cb3c8 -r 34f7157d6bc5 cgi-bin/LJ/NotificationInbox.pm
--- a/cgi-bin/LJ/NotificationInbox.pm Tue Jan 10 15:16:21 2012 +0800
+++ b/cgi-bin/LJ/NotificationInbox.pm Tue Jan 10 16:39:11 2012 +0800
@@ -168,6 +168,15 @@
return $_[0]->subset_items( 'PollVote' );
}
+sub communitymembership_items {
+ my $self = shift;
+
+ my @community_events = communitymembership_event_list();
+
+ my %community_events = map { "LJ::Event::" . $_ => 1 } @community_events;
+ return grep { $community_events{$_->event->class} } $self->items;
+}
+
# return a subset of notificationitems
sub subset_items {
my ($self, @subset) = @_;
@@ -585,6 +594,8 @@
@items = $self->singleentry_items( $itemid );
} elsif ( $view eq 'pollvote' ) {
@items = $self->pollvote_items;
+ } elsif ( $view eq 'communitymembership' ) {
+ @items = $self->communitymembership_items;
} elsif ( $view eq 'unread' ) {
@items = $self->unread_items;
}
@@ -635,6 +646,8 @@
@items = $self->singleentry_items( $itemid );
} elsif ( $view eq 'pollvote' ) {
@items = $self->pollvote_items;
+ } elsif ( $view eq 'communitymembership' ) {
+ @items = $self->communitymembership_items;
} elsif ( $view eq 'unread' ) {
@items = $self->unread_items;
}
@@ -729,6 +742,11 @@
return $self->subset_unread_count(@events);
}
+sub communitymembership_event_count {
+ my $self = shift;
+ return $self->subset_unread_count(communitymembership_event_list());
+}
+
# Methods that return Arrays of Event categories
sub friend_event_list {
my @events = qw(
@@ -760,4 +778,9 @@
return @events;
}
+sub communitymembership_event_list {
+ my @events = ( 'CommunityJoinApprove', 'CommunityJoinReject', 'CommunityJoinRequest' );
+ return @events;
+}
+
1;
diff -r 70b2250cb3c8 -r 34f7157d6bc5 cgi-bin/LJ/Widget/InboxFolderNav.pm
--- a/cgi-bin/LJ/Widget/InboxFolderNav.pm Tue Jan 10 15:16:21 2012 +0800
+++ b/cgi-bin/LJ/Widget/InboxFolderNav.pm Tue Jan 10 16:39:11 2012 +0800
@@ -90,6 +90,7 @@
$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 .= $subfolder_link->( "communitymembership", "inbox.menu.community_membership", "subs", $unread_html->( $inbox->communitymembership_event_count ) );
$body .= qq{<span class="subs">---</span>\n};
$body .= $subfolder_link->( "unread", "inbox.menu.unread", "subs", $unread_all_html );
$body .= $subfolder_link->( "bookmark", "inbox.menu.bookmarks", "subs", "", LJ::img( 'flag', '' ) );
--------------------------------------------------------------------------------
