[livejournal] r18261: LJSUP-7871. Add function for manually fo...
Committer: gprochaev
LJSUP-7871. Add function for manually forcing a community owner pollU trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm
Modified: trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm 2011-02-10 10:12:17 UTC (rev 18260)
+++ trunk/cgi-bin/LJ/Console/Command/CommunityPoll.pm 2011-02-10 10:20:29 UTC (rev 18261)
@@ -48,20 +48,23 @@
return $self->error("Community has not have maintainers")
unless $maint_list;
- my @maintainers = split /,/, $maint_list;
+ my @got_maintainers = split /,/, $maint_list;
return $self->error("Election poll exists already")
if ($c->prop("election_poll_id") && $confirm ne 'confirm');
## Check for maintainers alive
- @maintainers = map {
+ my @maintainers = map {
my $u = LJ::load_user($_);
$u;
} grep {
my $u = LJ::load_user($_);
$u && $u->is_visible && !$u->is_expunged && $u->can_manage($c) ? 1 : 0;
- } @maintainers;
+ } @got_maintainers;
+ return $self->error("Can't create poll. At least one user is not maintainer of community $comm_name")
+ unless @maintainers == @got_maintainers;
+
return $self->error("Can't create poll. No maintainers given or they are not maintainers.")
unless @maintainers;
