mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-11-10 04:18 am

[dw-nonfree] migrate LJ::get_cap / $u->get_cap to specific user methods

[commit: http://hg.dwscoalition.org/dw-nonfree/rev/c99e78edd140]

http://bugs.dwscoalition.org/show_bug.cgi?id=1894

Migrate LJ::get_cap calls to LJ::User->can_do_stuffs methods.

Patch by [staff profile] denise.

Files modified:
  • cgi-bin/DW/Hooks/EntryForm.pm
--------------------------------------------------------------------------------
diff -r b9391575ec2f -r c99e78edd140 cgi-bin/DW/Hooks/EntryForm.pm
--- a/cgi-bin/DW/Hooks/EntryForm.pm	Tue Nov 10 03:07:33 2009 +0000
+++ b/cgi-bin/DW/Hooks/EntryForm.pm	Tue Nov 10 04:18:19 2009 +0000
@@ -29,10 +29,11 @@ LJ::register_hook( 'entryforminfo', sub 
     };
 
     my $usejournal = $journal ? "?usejournal=$journal" : "";
+    my $ju = LJ::load_user( $journal ) if $journal;
 
     my $can_make_poll = 0;
-    $can_make_poll = LJ::get_cap( $remote, "makepoll" ) if $remote;
-    $can_make_poll ||= LJ::get_cap( LJ::load_user( $journal ), "makepoll" ) if $journal;
+    $can_make_poll = $remote->can_create_polls if $remote;
+    $can_make_poll ||= $ju->can_create_polls if $ju;
 
     return $make_list->(
         # URL, link text, whether to show or not
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org