wisest owl (wisest_owl) wrote in changelog,
wisest owl
wisest_owl
changelog

[livejournal] r18258: LJSUP-7871. Add function for manually fo...

Committer: gprochaev
LJSUP-7871. Add function for manually forcing a community owner poll

U   trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm
U   trunk/cgi-bin/communitylib.pl
Modified: trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm	2011-02-10 08:50:56 UTC (rev 18257)
+++ trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm	2011-02-10 09:47:56 UTC (rev 18258)
@@ -62,12 +62,16 @@
         $u && $u->is_visible && !$u->is_expunged && $u->can_manage($c) ? 1 : 0;
     } @maintainers;
 
+    return $self->error("Can't create poll. No maintainers given or they are not maintainers.")
+        unless @maintainers;
+
     my $log = '';
     my $poll_id = LJ::create_supermaintainer_election_poll (
-            comm_id     => $c->userid, 
-            maint_list  => \@maintainers, 
-            log         => \$log,
-            no_job      => 0,
+            comm_id      => $c->userid, 
+            maint_list   => \@maintainers, 
+            log          => \$log,
+            no_job       => 0,
+            check_active => 1,
     );
 
     return $self->error("Can't create poll")

Modified: trunk/cgi-bin/communitylib.pl
===================================================================
--- trunk/cgi-bin/communitylib.pl	2011-02-10 08:50:56 UTC (rev 18257)
+++ trunk/cgi-bin/communitylib.pl	2011-02-10 09:47:56 UTC (rev 18258)
@@ -25,6 +25,7 @@
     my $alive_maintainers = $args{'maint_list'};
     my $textref = $args{'log'};
     my $no_job = $args{'no_job'} || 0;
+    my $check_active = $args{'check_active'} || 0;
     my $to_journal = $args{'to_journal'} || LJ::load_user('lj_elections');
 
     my $comm = LJ::load_userid($comm_id);
@@ -68,11 +69,11 @@
 
     ## All are ok. Emailing to all maintainers about election.
     my $subject = LJ::Lang::ml('poll.election.email.subject');
-    $textref .= "Sending emails to all maintainers for community " . $comm->user . "\n";
-    foreach my $maint_id (@$alive_maintainers) {
-        my $u = LJ::load_userid ($maint_id);
-        next unless $u && $u->is_visible && $u->can_manage($comm) && $u->check_activity(90);
-        $textref .= "\tSend email to maintainer ".$u->user."\n";
+    $$textref .= "Sending emails to all maintainers for community " . $comm->user . "\n";
+    foreach my $u (@$alive_maintainers) {
+        next unless $u && $u->is_visible && $u->can_manage($comm);
+        next if !$check_active && $u->check_activity(90);
+        $$textref .= "\tSend email to maintainer ".$u->user."\n";
         LJ::send_mail({ 'to'        => $u->email_raw,
                         'from'      => $LJ::ACCOUNTS_EMAIL,
                         'fromname'  => $LJ::SITENAMESHORT,

Tags: livejournal, pl, pm, wisest-owl
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