[dw-free] Allow members to subscribe to all comments in a community
[commit: http://hg.dwscoalition.org/dw-free/rev/3cdffb065206]
http://bugs.dwscoalition.org/show_bug.cgi?id=2593
Refactor the logic for checking into its own function, for cleaner code.
Patch by
ninetydegrees.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=2593
Refactor the logic for checking into its own function, for cleaner code.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/User.pm
- htdocs/manage/subscriptions/comments.bml
- htdocs/manage/subscriptions/entry.bml
- htdocs/manage/subscriptions/user.bml
-------------------------------------------------------------------------------- diff -r 62f3ab932ab8 -r 3cdffb065206 cgi-bin/LJ/User.pm --- a/cgi-bin/LJ/User.pm Mon May 24 21:46:06 2010 -0700 +++ b/cgi-bin/LJ/User.pm Tue May 25 12:58:53 2010 +0800 @@ -1903,6 +1903,12 @@ sub can_show_onlinestatus { return 0; } +sub can_track_all_community_comments { + my ( $remote, $journal ) = @_; + return 1 if $journal->is_community && ( LJ::can_manage_other( $remote, $journal ) + || $journal->is_paid && $remote->member_of( $journal ) ); +} + sub can_track_defriending { return $_[0]->get_cap( 'track_defriended' ) ? 1 : 0; } diff -r 62f3ab932ab8 -r 3cdffb065206 htdocs/manage/subscriptions/comments.bml --- a/htdocs/manage/subscriptions/comments.bml Mon May 24 21:46:06 2010 -0700 +++ b/htdocs/manage/subscriptions/comments.bml Tue May 25 12:58:53 2010 +0800 @@ -85,14 +85,15 @@ body<= flags => LJ::Subscription::TRACKING, ); - # only administrators of a community should be given the option to track all comments on another journal + # only administrators of a community and members of a paid community + # should be given the option to track all comments on another journal push @pending, LJ::Subscription::Pending->new( $remote, event => "JournalNewComment", journal => $journal, flags => LJ::Subscription::TRACKING, - ) if $journal->is_community && ( LJ::can_manage_other( $remote, $journal ) || $journal->is_paid && $remote->member_of( $journal ) ); + ) if $remote->can_track_all_community_comments ( $journal ); my $categories = [ { diff -r 62f3ab932ab8 -r 3cdffb065206 htdocs/manage/subscriptions/entry.bml --- a/htdocs/manage/subscriptions/entry.bml Mon May 24 21:46:06 2010 -0700 +++ b/htdocs/manage/subscriptions/entry.bml Tue May 25 12:58:53 2010 +0800 @@ -62,14 +62,15 @@ body<= ], }]; - # only administrators of a community should be given the option to track all comments on another journal + # only administrators of a community and members of a paid community + # should be given the option to track all comments on another journal push @{@$categories[0]->{Track}}, LJ::Subscription::Pending->new( $remote, event => "JournalNewComment", journal => $journal, flags => LJ::Subscription::TRACKING, - ) if $journal->is_community && ( LJ::can_manage_other( $remote, $journal ) || $journal->is_paid && $remote->member_of( $journal ) ); + ) if $remote->can_track_all_community_comments ( $journal ); push @{@$categories[0]->{Track}}, LJ::Subscription::Pending->new( diff -r 62f3ab932ab8 -r 3cdffb065206 htdocs/manage/subscriptions/user.bml --- a/htdocs/manage/subscriptions/user.bml Mon May 24 21:46:06 2010 -0700 +++ b/htdocs/manage/subscriptions/user.bml Tue May 25 12:58:53 2010 +0800 @@ -70,14 +70,15 @@ body<= ); } - # only administrators of a community should be given the option to track all comments on another journal + # only administrators of a community and members of a paid community + # should be given the option to track all comments on another journal push @{@$categories[0]->{""}}, LJ::Subscription::Pending->new( $remote, event => "JournalNewComment", journal => $journal, flags => LJ::Subscription::TRACKING, - ) if $journal->is_community && ( LJ::can_manage_other( $remote, $journal ) || $journal->is_paid && $remote->member_of( $journal ) ); + ) if $remote->can_track_all_community_comments ( $journal ); push @{@$categories[0]->{""}}, LJ::Subscription::Pending->new( --------------------------------------------------------------------------------