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

[livejournal] r18446: LJSUP-8069. Wrong set a community owner

Committer: gprochaev
LJSUP-8069. Wrong set a community owner

U   trunk/cgi-bin/LJ/Poll.pm
Modified: trunk/cgi-bin/LJ/Poll.pm
===================================================================
--- trunk/cgi-bin/LJ/Poll.pm	2011-03-03 04:32:15 UTC (rev 18445)
+++ trunk/cgi-bin/LJ/Poll.pm	2011-03-03 04:38:13 UTC (rev 18446)
@@ -818,9 +818,12 @@
         return 0;
     }
 
+    ## Search answer item for election winner.
+    @items = grep { $_->{'pollitid'} == $max_votes_for } @items;
+
     ## We found election winner. Set this user as supermaintainer and close election.
-    if ($max_votes_for && $items[$max_votes_for - 1]) {
-        my $winner = $items[$max_votes_for - 1]->{item};
+    if ($max_votes_for && @items) {
+        my $winner = $items[0]->{'item'};
         $winner =~ s/<lj user='(.*?)'>/$1/;
         $winner = LJ::load_user($winner);
         if ($winner && $winner->can_manage($is_super) && $winner->is_visible) {

Tags: livejournal, 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