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

[livejournal] r22395: LJSV-2291: 2 owners can be set in one co...

Committer: wisest-owl
LJSV-2291: 2 owners can be set in one community

U   trunk/cgi-bin/LJ/Console/Command/SetOwner.pm
U   trunk/htdocs/community/members.bml
U   trunk/htdocs/community/members.bml.text
Modified: trunk/cgi-bin/LJ/Console/Command/SetOwner.pm
===================================================================
--- trunk/cgi-bin/LJ/Console/Command/SetOwner.pm	2012-07-05 10:54:56 UTC (rev 22394)
+++ trunk/cgi-bin/LJ/Console/Command/SetOwner.pm	2012-07-05 12:56:18 UTC (rev 22395)
@@ -42,9 +42,11 @@
     }
 
     my $s_maints = LJ::load_rel_user($c->{userid}, 'S');
-    my $s_maint_u = @$s_maints ? LJ::load_userid($s_maints->[0]) : undef;
-    if ($s_maint_u) {
-        LJ::clear_rel($c->{userid}, $s_maint_u->{userid}, 'S');
+    my $s_maint_us = @$s_maints ? LJ::load_userids(@$s_maints) || {} : {};
+    if (%$s_maint_us) {
+        foreach my $u (values %$s_maint_us) {
+            LJ::clear_rel($c->{userid}, $u->{userid}, 'S');
+        }
     }
 
     $c->log_event('set_owner', { actiontarget => $u->{userid}, remote => $remote });

Modified: trunk/htdocs/community/members.bml
===================================================================
--- trunk/htdocs/community/members.bml	2012-07-05 10:54:56 UTC (rev 22394)
+++ trunk/htdocs/community/members.bml	2012-07-05 12:56:18 UTC (rev 22395)
@@ -103,6 +103,13 @@
 
     # saving a form submission
     if ($POST{'select_as_sm'}) {
+        unless ($remote->can_super_manage($c)) {
+            $ret .= "<?h1 $ML{'Error'} h1?><?p ";
+            $ret .= BML::ml('.error.noaccess_sm',
+                            { 'comm' => LJ::ljuser($cname, { 'type' => 'C' }) });
+            $ret .= " p?>";
+            return $print_with_ad->($ret);
+        }
         my $new_sm = $POST{'uid_to_sm'};
         my $new_sm_u = LJ::load_userid($new_sm);
         ## Is user exist, active and maintainer?

Modified: trunk/htdocs/community/members.bml.text
===================================================================
--- trunk/htdocs/community/members.bml.text	2012-07-05 10:54:56 UTC (rev 22394)
+++ trunk/htdocs/community/members.bml.text	2012-07-05 12:56:18 UTC (rev 22395)
@@ -26,6 +26,8 @@
 
 .error.noaccess=Only community maintainers are able to edit membership lists. You are not a maintainer of community [[comm]].
 
+.error.noaccess_sm=Only community owners are able to set a new owner. You are not a owner of community [[comm]].
+
 .error.noattr=No attributes selected for user: [[user]]
 
 .error.nocomm=Community not found.

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