alf (red_alf) wrote in changelog,
alf
red_alf
changelog

[livejournal] r18611: LJSUP-8123: change the logic of Show Spa...

Committer: afedorov
LJSUP-8123: change the logic of Show Spam link working

U   trunk/htdocs/talkread.bml
Modified: trunk/htdocs/talkread.bml
===================================================================
--- trunk/htdocs/talkread.bml	2011-03-17 08:32:46 UTC (rev 18610)
+++ trunk/htdocs/talkread.bml	2011-03-17 08:58:43 UTC (rev 18611)
@@ -569,7 +569,7 @@
 	    my $readlink_text = BML::ml("talk.commentsread.counted", { replycount => $replycount });
 	    my $comments_count = BML::ml("talk.comments.counted", { replycount => $replycount });
 	
-	    if ($dthread && $pages == 1) {
+	    if (($dthread && $pages == 1) || ($GET{mode} eq 'showspam')) {
             my $readurl = LJ::Talk::talkargs($talkurl, $stylemine, $formatlight);
             $readlink = "(<a href='$readurl#comments'>$readlink_text</a>)";
         } elsif ($replycount > 0) {
@@ -581,6 +581,16 @@
         my $showspamurl = LJ::Talk::talkargs($talkurl, "mode=showspam", $stylemine, $formatlight);
         my $hidespamurl = LJ::Talk::talkargs($talkurl, "", $stylemine, $formatlight);
         my $spam_counter = $entry->prop('spam_counter') || 0;
+        
+        my $readspamlink = '';
+        if ($remote && $spam_counter > 0 && ($remote->can_manage($u) || $remote->can_moderate($u))) {
+            if ($GET{mode} eq 'showspam') {
+                $readspamlink = "(" . BML::ml('talk.hidespam', { spam_counter => $spam_counter }) . ")";
+            } else {
+                $readspamlink = "(<a href='$showspamurl'>" . BML::ml('talk.showspam', { spam_counter => $spam_counter }) . "</a>)";
+            }
+        }
+        $readspamlink .= ' - ' if $readspamlink && $allow_commenting;
 
         my $stylemine = $GET{'style'} eq 'mine' ? 1 : 0;
 
@@ -599,14 +609,7 @@
 
         # Quick Reply when posting a new top level comment
         # requires setup when logged in.
-        $ret .= "<p class='lesstop' align='center'><b>$readlink";
-        if ($remote && ($remote->can_manage($u) || $remote->can_moderate($u))) {
-            if ($GET{mode} eq 'showspam') {
-                $ret .= "(<a href='$hidespamurl'>" . BML::ml('talk.hidespam', { spam_counter => $spam_counter }) . "</a>) - ";
-            } else {
-                $ret .= "(<a href='$showspamurl'>" . BML::ml('talk.showspam', { spam_counter => $spam_counter }) . "</a>) - ";
-            }
-        }
+        $ret .= "<p class='lesstop' align='center'><b>$readlink$readspamlink";
         if ($allow_commenting) {
             if ($remote) {
                 # See if we want to force them to change their password
@@ -673,14 +676,7 @@
                           "</script>\n";
             }
 
-            $ret .= "<hr /><p class='lesstop' align='center'><b>$readlink";
-            if ($remote && ($remote->can_manage($u) || $remote->can_moderate($u))) {
-                if ($GET{mode} eq 'showspam') {
-                    $ret .= "(<a href='$hidespamurl'>" . BML::ml('talk.hidespam', { spam_counter => $spam_counter }) . "</a>) - ";
-                } else {
-                    $ret .= "(<a href='$showspamurl'>" . BML::ml('talk.showspam', { spam_counter => $spam_counter }) . "</a>) - ";
-                }
-            }
+            $ret .= "<hr /><p class='lesstop' align='center'><b>$readlink$readspamlink";
             if ($allow_commenting) {
                 if ($remote) {
                     # See if we want to force them to change their password

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