kareila: (Default)
kareila ([personal profile] kareila) wrote in [site community profile] changelog2009-10-22 08:27 pm

[dw-free] talkscreen success has no return link

[commit: http://hg.dwscoalition.org/dw-free/rev/57d74128423a]

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

Add return link from screen/unscreen success page.

Patch by [staff profile] denise.

Files modified:
  • htdocs/talkscreen.bml
--------------------------------------------------------------------------------
diff -r d4f316b1e8bc -r 57d74128423a htdocs/talkscreen.bml
--- a/htdocs/talkscreen.bml	Thu Oct 22 19:41:24 2009 +0000
+++ b/htdocs/talkscreen.bml	Thu Oct 22 15:27:05 2009 -0500
@@ -107,6 +107,7 @@ _info?><?_code
     my $ditemid = $qitemid*256 + $anum;
 
     my $itemlink = LJ::journal_base($u) . "/$ditemid.html";
+    my $linktext = BML::ml( '.link', { aopts => "href='$itemlink'" } );
     my $commentlink = "$itemlink?view=$dtalkid" . LJ::Talk::comment_anchor( $dtalkid );
 
     if ($mode eq 'screen') {
@@ -130,94 +131,91 @@ _info?><?_code
         }
         # FIXME: no error checking?
         return $jsres->($mode) if $jsmode;
-        $body = "<?h1 $ML{'.screened.title'} h1?><?p " . BML::ml('.screened.body', {'link'=>$commentlink}) . " p?>";
+        $body = "<?h1 $ML{'.screened.title'} h1?><?p $ML{'.screened.body'} $linktext p?>";
         return;
     }
 
- if ($mode eq 'unscreen') {
-     my $can_unscreen = LJ::Talk::can_unscreen($remote, $u, $up, $post->{'userpost'});
-     return $error->($ML{'.error.privs.unscreen'}) unless $can_unscreen;
-     if ($POST{'confirm'} eq 'Y') {
+    if ($mode eq 'unscreen') {
+        my $can_unscreen = LJ::Talk::can_unscreen($remote, $u, $up, $post->{'userpost'});
+        return $error->($ML{'.error.privs.unscreen'}) unless $can_unscreen;
+        if ($POST{'confirm'} eq 'Y') {
             $error->($ML{'error.invalidform'}) unless LJ::check_form_auth();
-     } else {
-         $body .= "<?h1 $ML{'.unscreen.sure.title'} h1?><?p $ML{'.unscreen.sure.body'} p?>";
-         $body .= "<p><form method='POST' action='talkscreen'><center>\n";
-         $body .= LJ::form_auth();
-         $body .= LJ::html_hidden(mode => 'unscreen', 'talkid' => $talkid,
-                                 journal => $u->{user}, confirm => 'Y');
-         $body .= LJ::html_submit(undef, $ML{'.unscreen.doit'});
-         $body .= "</center>";
-         $body .= "</form>\n";
-         return;
-     }
-     if ($state ne 'A') {
-         LJ::Talk::unscreen_comment($u, $qitemid, $qtalkid);
-     }
-     # FIXME: no error checking?
-     return $jsres->($mode) if $jsmode;
-     $body = "<?h1 $ML{'.unscreened.title'} h1?><?p " . BML::ml('.unscreened.body', {'link'=>$commentlink}) . " p?>";
-     return;
- }
+        } else {
+            $body .= "<?h1 $ML{'.unscreen.sure.title'} h1?><?p $ML{'.unscreen.sure.body'} p?>";
+            $body .= "<p><form method='POST' action='talkscreen'><center>\n";
+            $body .= LJ::form_auth();
+            $body .= LJ::html_hidden(mode => 'unscreen', 'talkid' => $talkid,
+                                     journal => $u->{user}, confirm => 'Y');
+            $body .= LJ::html_submit(undef, $ML{'.unscreen.doit'});
+            $body .= "</center>";
+            $body .= "</form>\n";
+            return;
+        }
+        if ($state ne 'A') {
+            LJ::Talk::unscreen_comment($u, $qitemid, $qtalkid);
+        }
+        # FIXME: no error checking?
+        return $jsres->($mode) if $jsmode;
+        $body = "<?h1 $ML{'.unscreened.title'} h1?><?p $ML{'.unscreened.body'} $linktext p?>";
+        return;
+    }
 
- if ($mode eq 'freeze') {
-     my $can_freeze = LJ::Talk::can_freeze($remote, $u, $up, $post->{userpost});
-     unless ($can_freeze) {
-         $body = "<?h1 $ML{'Error'} h1?><?p $ML{'.error.privs.freeze'} p?>";
-         return;
-     }
+    if ($mode eq 'freeze') {
+        my $can_freeze = LJ::Talk::can_freeze($remote, $u, $up, $post->{userpost});
+        unless ($can_freeze) {
+            $body = "<?h1 $ML{'Error'} h1?><?p $ML{'.error.privs.freeze'} p?>";
+            return;
+        }
 
-     if ($POST{confirm} eq 'Y') {
+        if ($POST{confirm} eq 'Y') {
             $error->($ML{'error.invalidform'}) unless LJ::check_form_auth();
-     } else {
-         $body .= "<?h1 $ML{'.freeze.sure.title'} h1?><?p $ML{'.freeze.sure.body'} p?>";
-         $body .= "<p><form method='post' action='talkscreen'><center>\n";
-         $body .= LJ::form_auth();
-         $body .= LJ::html_hidden(mode => 'freeze', 'talkid' => $talkid,
-                                 journal => $u->{user}, confirm => 'Y');
-         $body .= LJ::html_submit(undef, $ML{'.freeze.doit'});
-         $body .= "</center>";
-         $body .= "</form>\n";
-         return;
-     }
-     if ($state ne 'F') {
-         LJ::Talk::freeze_thread($u, $qitemid, $qtalkid);
-     }
-     return $jsres->($mode) if $jsmode;
-     my $linktext = BML::ml('.link', { aopts => "href='$itemlink'" });
-     $body = "<?h1 $ML{'.frozen.title'} h1?><?p $ML{'.frozen.body'} $linktext p?>";
-     return;
- }
+        } else {
+            $body .= "<?h1 $ML{'.freeze.sure.title'} h1?><?p $ML{'.freeze.sure.body'} p?>";
+            $body .= "<p><form method='post' action='talkscreen'><center>\n";
+            $body .= LJ::form_auth();
+            $body .= LJ::html_hidden(mode => 'freeze', 'talkid' => $talkid,
+                                     journal => $u->{user}, confirm => 'Y');
+            $body .= LJ::html_submit(undef, $ML{'.freeze.doit'});
+            $body .= "</center>";
+            $body .= "</form>\n";
+            return;
+        }
+        if ($state ne 'F') {
+            LJ::Talk::freeze_thread($u, $qitemid, $qtalkid);
+        }
+        return $jsres->($mode) if $jsmode;
+        $body = "<?h1 $ML{'.frozen.title'} h1?><?p $ML{'.frozen.body'} $linktext p?>";
+        return;
+    }
 
- if ($mode eq 'unfreeze') {
-     my $can_unfreeze = LJ::Talk::can_unfreeze($remote, $u, $up, $post->{userpost});
-     unless ($can_unfreeze) {
-         $body = "<?h1 $ML{'Error'} h1?><?p You are not allowed to unfreeze this thread p?>";
-         return;
-     }
-     if ($POST{confirm} eq 'Y') {
+    if ($mode eq 'unfreeze') {
+        my $can_unfreeze = LJ::Talk::can_unfreeze($remote, $u, $up, $post->{userpost});
+        unless ($can_unfreeze) {
+            $body = "<?h1 $ML{'Error'} h1?><?p You are not allowed to unfreeze this thread p?>";
+            return;
+        }
+        if ($POST{confirm} eq 'Y') {
             $error->($ML{'error.invalidform'}) unless LJ::check_form_auth();
-     } else {
-         $body .= "<?h1 $ML{'.unfreeze.sure.title'} h1?><?p $ML{'.unfreeze.sure.body'} p?>";
-         $body .= "<p><form method='post' action='talkscreen'><center>\n";
-         $body .= LJ::form_auth();
-         $body .= LJ::html_hidden(mode => 'unfreeze', 'talkid' => $talkid,
-                                 journal => $u->{user}, confirm => 'Y');
-         $body .= LJ::html_submit(undef, $ML{'.unfreeze.doit'});
-         $body .= "</center>";
-         $body .= "</form>\n";
-         return;
-     }
-     if ($state eq 'F') {
-         LJ::Talk::unfreeze_thread($u, $qitemid, $qtalkid);
-     }
-     return $jsres->($mode) if $jsmode;
-     my $linktext = BML::ml('.link', { aopts => "href='$itemlink'" });
-     $body = "<?h1 $ML{'.unfrozen.title'} h1?><?p $ML{'.unfrozen.body'} $linktext p?>";
-     return;
- }
+        } else {
+            $body .= "<?h1 $ML{'.unfreeze.sure.title'} h1?><?p $ML{'.unfreeze.sure.body'} p?>";
+            $body .= "<p><form method='post' action='talkscreen'><center>\n";
+            $body .= LJ::form_auth();
+            $body .= LJ::html_hidden(mode => 'unfreeze', 'talkid' => $talkid,
+                                     journal => $u->{user}, confirm => 'Y');
+            $body .= LJ::html_submit(undef, $ML{'.unfreeze.doit'});
+            $body .= "</center></form>\n";
+            return;
+        }
+        if ($state eq 'F') {
+            LJ::Talk::unfreeze_thread($u, $qitemid, $qtalkid);
+        }
+        return $jsres->($mode) if $jsmode;
+        $body = "<?h1 $ML{'.unfrozen.title'} h1?><?p $ML{'.unfrozen.body'} $linktext p?>";
+        return;
+    }
 
- $body = "<?h1 $ML{'Error'} h1?><?p $ML{'error.unknownmode'} p?>";
- return;
+    $body = "<?h1 $ML{'Error'} h1?><?p $ML{'error.unknownmode'} p?>";
+    return;
 
 }
 _code?><?page
--------------------------------------------------------------------------------