[dw-free] change class method calls to user method calls for ajax_auth_token
[commit: http://hg.dwscoalition.org/dw-free/rev/62338401f906]
http://bugs.dwscoalition.org/show_bug.cgi?id=1597
Refactor.
Patch by
kareila.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=1597
Refactor.
Patch by
![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Files modified:
- cgi-bin/LJ/S2.pm
- htdocs/tools/endpoints/changerelation.bml
- htdocs/tools/endpoints/ctxpopup.bml
- htdocs/tools/endpoints/esn_subs.bml
- htdocs/tools/endpoints/widget.bml
-------------------------------------------------------------------------------- diff -r 520d62d9da00 -r 62338401f906 cgi-bin/LJ/S2.pm --- a/cgi-bin/LJ/S2.pm Sun Aug 09 07:58:04 2009 +0000 +++ b/cgi-bin/LJ/S2.pm Sun Aug 09 08:38:05 2009 +0000 @@ -2959,9 +2959,9 @@ sub _Comment__get_link my $subscr = $subs[0]; return $null_link unless $subscr; - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', subid => $subscr->id, - action => 'delsub'); + action => 'delsub' ); my $etypeid = 'LJ::Event::JournalNewComment'->etypeid; @@ -3009,7 +3009,7 @@ sub _Comment__get_link etypeid => $etypeid, arg2 => LJ::Comment->new($comment->entry->journal, dtalkid => $dtalkid)->jtalkid, ); - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', action => 'addsub', %subparams); + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', action => 'addsub', %subparams ); my %btn_params = map { ('lj_' . $_, $subparams{$_}) } keys %subparams; @@ -3558,12 +3558,12 @@ sub _Entry__get_link my $newentry_auth_token; if ($newentry_sub) { - $newentry_auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + $newentry_auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', subid => $newentry_sub->id, action => 'delsub', ); } elsif ($remote) { - $newentry_auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + $newentry_auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', journalid => $journalu->id, action => 'addsub', etypeid => $newentry_etypeid, @@ -3581,7 +3581,7 @@ sub _Entry__get_link require_active => 1, ); - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', journalid => $journalu->id, action => 'addsub', etypeid => $etypeid, @@ -3614,9 +3614,9 @@ sub _Entry__get_link my $subscr = $subs[0]; return $null_link unless $subscr; - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', subid => $subscr->id, - action => 'delsub'); + action => 'delsub' ); return LJ::S2::Link("$LJ::SITEROOT/manage/subscriptions/entry?journal=$journal&itemid=$this->{'itemid'}", $ctx->[S2::PROPS]->{"text_unwatch_comments"}, diff -r 520d62d9da00 -r 62338401f906 htdocs/tools/endpoints/changerelation.bml --- a/htdocs/tools/endpoints/changerelation.bml Sun Aug 09 07:58:04 2009 +0000 +++ b/htdocs/tools/endpoints/changerelation.bml Sun Aug 09 08:38:05 2009 +0000 @@ -17,7 +17,7 @@ or return $err->("Sorry, you must be logged in to use this feature."); # check auth token - return $err->("Invalid auth token") unless LJ::Auth->check_ajax_auth_token($remote, '/__rpc_changerelation', %POST); + return $err->("Invalid auth token") unless $remote->check_ajax_auth_token( '/__rpc_changerelation', %POST ); my $target = $POST{target} or return $err->("No target specified"); my $action = $POST{action} or return $err->("No action specified"); diff -r 520d62d9da00 -r 62338401f906 htdocs/tools/endpoints/ctxpopup.bml --- a/htdocs/tools/endpoints/ctxpopup.bml Sun Aug 09 07:58:04 2009 +0000 +++ b/htdocs/tools/endpoints/ctxpopup.bml Sun Aug 09 08:38:05 2009 +0000 @@ -112,12 +112,11 @@ if ($remote) { push @actions, 'addTrust', 'addWatch', 'removeTrust', 'removeWatch', 'setBan' , 'setUnban'; foreach my $action (@actions) { - $ret{"${action}_authtoken"} = LJ::Auth->ajax_auth_token( - $remote, - $uri, - target => $u->user, - action => $action, - ); + $ret{"${action}_authtoken"} = $remote->ajax_auth_token( + $uri, + target => $u->user, + action => $action, + ); } } diff -r 520d62d9da00 -r 62338401f906 htdocs/tools/endpoints/esn_subs.bml --- a/htdocs/tools/endpoints/esn_subs.bml Sun Aug 09 07:58:04 2009 +0000 +++ b/htdocs/tools/endpoints/esn_subs.bml Sun Aug 09 08:38:05 2009 +0000 @@ -25,7 +25,7 @@ or return $err->("Sorry, you must be logged in to use this feature."); # check auth token - return $err->("Invalid auth token") unless LJ::Auth->check_ajax_auth_token($remote, '/__rpc_esn_subs', %POST); + return $err->("Invalid auth token") unless $remote->check_ajax_auth_token( '/__rpc_esn_subs', %POST ); my $action = $POST{action} or return $err->("No action specified"); my $success = 0; @@ -49,7 +49,7 @@ $ret{subscribed} = 0; - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', action => 'addsub', %postauth, ); @@ -100,9 +100,9 @@ $ret{dtalkid} = $cmt->dtalkid if $cmt; } - my $auth_token = LJ::Auth->ajax_auth_token($remote, '/__rpc_esn_subs', + my $auth_token = $remote->ajax_auth_token( '/__rpc_esn_subs', subid => $subscr->id, - action => 'delsub'); + action => 'delsub' ); if ($subscr->event_class eq 'LJ::Event::JournalNewEntry') { $ret{newentry_token} = $auth_token; diff -r 520d62d9da00 -r 62338401f906 htdocs/tools/endpoints/widget.bml --- a/htdocs/tools/endpoints/widget.bml Sun Aug 09 07:58:04 2009 +0000 +++ b/htdocs/tools/endpoints/widget.bml Sun Aug 09 08:38:05 2009 +0000 @@ -64,7 +64,7 @@ # just a normal post request, handle it and then return status local $LJ::WIDGET_NO_AUTH_CHECK = 1 if - LJ::Auth->check_ajax_auth_token($remote, "/_widget", auth_token => delete $POST{auth_token}); + $remote->check_ajax_auth_token( "/_widget", auth_token => delete $POST{auth_token} ); my %res; @@ -78,7 +78,7 @@ $ret{_widget_post} = 1; # generate new auth token for future requests if succesfully checked auth token - $ret{auth_token} = LJ::Auth->ajax_auth_token($remote, "/_widget") if $LJ::WIDGET_NO_AUTH_CHECK; + $ret{auth_token} = $remote->ajax_auth_token( "/_widget" ) if $LJ::WIDGET_NO_AUTH_CHECK; } if (delete $POST{_widget_update}) { --------------------------------------------------------------------------------