[dw-free] Fix various my/if constructions
[commit: http://hg.dwscoalition.org/dw-free/rev/555a213bdacc]
http://bugs.dwscoalition.org/show_bug.cgi?id=4230
Fix all the bad my $var = ... if ... constructions.
Patch by
sophie.
Files modified:
http://bugs.dwscoalition.org/show_bug.cgi?id=4230
Fix all the bad my $var = ... if ... constructions.
Patch by
Files modified:
- cgi-bin/DW/Controller/RPC/CutExpander.pm
- htdocs/admin/invites/codetrace.bml
- htdocs/support/see_request.bml
--------------------------------------------------------------------------------
diff -r 049c2c2b3a80 -r 555a213bdacc cgi-bin/DW/Controller/RPC/CutExpander.pm
--- a/cgi-bin/DW/Controller/RPC/CutExpander.pm Fri Jan 27 13:46:00 2012 +0800
+++ b/cgi-bin/DW/Controller/RPC/CutExpander.pm Fri Jan 27 13:51:52 2012 +0800
@@ -45,7 +45,7 @@
# all parameters are included; get the entry.
my $ditemid = $args->{ditemid};
my $uid = LJ::get_userid( $args->{journal} );
- my $entry = LJ::Entry->new( $uid, ditemid => $ditemid ) if $uid;
+ my $entry = $uid ? LJ::Entry->new( $uid, ditemid => $ditemid ) : undef;
# FIXME: This returns 200 due to old library, Make return proper when we are jQuery only.
return $error_out->( 200, BML::ml( "error.nopermission" ) ) unless $entry;
diff -r 049c2c2b3a80 -r 555a213bdacc htdocs/admin/invites/codetrace.bml
--- a/htdocs/admin/invites/codetrace.bml Fri Jan 27 13:46:00 2012 +0800
+++ b/htdocs/admin/invites/codetrace.bml Fri Jan 27 13:51:52 2012 +0800
@@ -59,7 +59,7 @@
foreach my $code ( @codes ) {
my $owner = $code->owner == $account->id ? $account : LJ::load_userid( $code->owner );
- my $recipient = LJ::load_userid( $code->recipient ) if $code->is_used;
+ my $recipient = $code->is_used ? LJ::load_userid( $code->recipient ) : undef;
$ret .= "<tr>";
$ret .= "<td><tt>" . $code->code . "</tt></td>";
$ret .= "<td>" . ( $owner ? $owner->ljuser_display : "" ) . "</td>";
diff -r 049c2c2b3a80 -r 555a213bdacc htdocs/support/see_request.bml
--- a/htdocs/support/see_request.bml Fri Jan 27 13:46:00 2012 +0800
+++ b/htdocs/support/see_request.bml Fri Jan 27 13:51:52 2012 +0800
@@ -205,9 +205,9 @@
if ($foundspid) {
return BML::redirect("see_request?id=$foundspid");
} else {
- my $goback = BML::ml('.goback.text', {request_link=>"href='see_request?id=$spid'", spid=>$spid}) if $sp;
+ my $goback = $sp ? BML::ml('.goback.text', {request_link=>"href='see_request?id=$spid'", spid=>$spid}) : undef;
my $what = $find eq 'next' || $find eq 'cnext' ? $ML{'.next'} : $ML{'.previous'};
- my $cat = $ML{'.incat'} if $find eq 'cnext' || $find eq 'cprev';
+ my $cat = $find eq 'cnext' || $find eq 'cprev' ? $ML{'.incat'} : undef;
return "<?h1 $ML{'.error'} h1?>".BML::ml('.error.text2', {what=>$what, cat=>$cat})." $goback";
}
}
--------------------------------------------------------------------------------
