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

[ljcom] r9862: LJSUP-7649. Remove all call "LJ::can_man...

Committer: gprochaev
LJSUP-7649. Remove all call "LJ::can_manage"

U   trunk/cgi-bin/LJ/Hooks/ESN.pm
U   trunk/cgi-bin/LJ/Sponsor.pm
U   trunk/cgi-bin/LJ/Widget/Shop/View/RenameAccount.pm
U   trunk/htdocs/gift-details.bml
U   trunk/htdocs/tools/xfer_remaining.bml
Modified: trunk/cgi-bin/LJ/Hooks/ESN.pm
===================================================================
--- trunk/cgi-bin/LJ/Hooks/ESN.pm	2010-12-17 09:59:39 UTC (rev 9861)
+++ trunk/cgi-bin/LJ/Hooks/ESN.pm	2010-12-17 10:12:10 UTC (rev 9862)
@@ -83,7 +83,7 @@
 LJ::register_hook("esn_community_comments_track_upgrade", sub {
     my ($u, $journal) = @_;
 
-    if (LJ::can_manage($u, $journal)) {
+    if ($u && $u->can_manage($journal)) {
         return LJ::run_hook("upgrade_link", $journal) . " ";
     } else {
         return qq{

Modified: trunk/cgi-bin/LJ/Sponsor.pm
===================================================================
--- trunk/cgi-bin/LJ/Sponsor.pm	2010-12-17 09:59:39 UTC (rev 9861)
+++ trunk/cgi-bin/LJ/Sponsor.pm	2010-12-17 10:12:10 UTC (rev 9862)
@@ -635,7 +635,7 @@
 sub is_sponsor_manager {
     my ($self, $u) = @_;
     return if ($self->is_deleted);
-    return LJ::can_manage($u, $self->community);
+    return $u && $u->can_manage($self->community);
 }
 
 ## return true if user is admin of the specified domain, i.e. can create new sponsors, edit sponsors details, statuses etc.
@@ -754,7 +754,7 @@
         $send_error->($@) if $@;
         
         eval {
-            unless (LJ::can_manage($u, $self->community)) {
+            unless ($u && $u->can_manage($self->community)) {
                 LJ::leave_community($u, $self->community, 1);
             } else {
                 warn "can not delete managing user from specified community";

Modified: trunk/cgi-bin/LJ/Widget/Shop/View/RenameAccount.pm
===================================================================
--- trunk/cgi-bin/LJ/Widget/Shop/View/RenameAccount.pm	2010-12-17 09:59:39 UTC (rev 9861)
+++ trunk/cgi-bin/LJ/Widget/Shop/View/RenameAccount.pm	2010-12-17 10:12:10 UTC (rev 9862)
@@ -37,6 +37,7 @@
         'nocomms' => $remote->ljuser_display,
 		'button_tag' => '<noscript>',
 		'button_close_tag' => '</noscript>',
+        'type'  => 'S',
     };
 
     my %ret = (

Modified: trunk/htdocs/gift-details.bml
===================================================================
--- trunk/htdocs/gift-details.bml	2010-12-17 09:59:39 UTC (rev 9861)
+++ trunk/htdocs/gift-details.bml	2010-12-17 10:12:10 UTC (rev 9862)
@@ -21,7 +21,7 @@
         or return $err->("Invalid giftid");
 
     my $remote = LJ::get_remote();
-    my $is_owner = LJ::can_manage($remote, $u);
+    my $is_owner = $remote && $remote->can_manage($u);
 
     if ($POST{'mode'} eq "kill" && $is_owner) {
         $gift->remove_from_profile;

Modified: trunk/htdocs/tools/xfer_remaining.bml
===================================================================
--- trunk/htdocs/tools/xfer_remaining.bml	2010-12-17 09:59:39 UTC (rev 9861)
+++ trunk/htdocs/tools/xfer_remaining.bml	2010-12-17 10:12:10 UTC (rev 9862)
@@ -49,7 +49,7 @@
             if LJ::u_equals($u_from, $u_to);
 
         return LJ::bad_input("Source user must be currently logged in user")
-            unless $has_priv || (LJ::u_equals($u_from, $u) || LJ::can_manage($u, $u_from));
+            unless $has_priv || (LJ::u_equals($u_from, $u) || ($u && $u->can_manage($u_from)));
 
         return LJ::bad_input("Destination user already has a permanent account!")
             if $is_perm->($u_to);

Tags: bml, ljcom, 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