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

[livejournal] r18093: LJSUP-7764. New members during the elect...

Committer: gprochaev
LJSUP-7764. New members during the election

U   trunk/cgi-bin/communitylib.pl
Modified: trunk/cgi-bin/communitylib.pl
===================================================================
--- trunk/cgi-bin/communitylib.pl	2011-01-24 08:53:45 UTC (rev 18092)
+++ trunk/cgi-bin/communitylib.pl	2011-01-24 10:20:09 UTC (rev 18093)
@@ -169,8 +169,18 @@
         moderate => 'M',
         admin => 'A',
     );
+    my ($is_super, $poll) = (undef, undef);
+    my $poll_id = $cu->prop('election_poll_id');
+    if ($poll_id) {
+        my $poll = LJ::Poll->new ($poll_id);
+        $is_super = $poll->prop('supermaintainer');
+    }
     foreach (keys %edgelist) {
-        LJ::set_rel($cu->{userid}, $u->{userid}, $edgelist{$_}) if $args->{$_};
+        unless ($is_super && $poll && !$poll->is_closed && $args->{$_} eq 'A') {
+            LJ::set_rel($cu->{userid}, $u->{userid}, $edgelist{$_}) if $args->{$_};
+        } else {
+            return LJ::error("Can't set user $u->{user} as maintainer for $cu->{user}");
+        }
     }
 
     # now we can delete the invite and update the status on the other side

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