fu: Close-up of Fu, bringing a scoop of water to her mouth (Default)
fu ([personal profile] fu) wrote in [site community profile] changelog2011-09-06 01:08 pm

[dw-free] Reply links still shown on comment pages, even when we've hit maxcomments

[commit: http://hg.dwscoalition.org/dw-free/rev/00330a280321]

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

Show on the comments page when you've hit maxcomments.

Patch by [personal profile] fu.

Files modified:
  • bin/upgrading/s2layers/core2.s2
  • htdocs/talkread.bml
  • htdocs/talkread.bml.text
--------------------------------------------------------------------------------
diff -r dd62b82c8a0c -r 00330a280321 bin/upgrading/s2layers/core2.s2
--- a/bin/upgrading/s2layers/core2.s2	Tue Sep 06 21:04:34 2011 +0800
+++ b/bin/upgrading/s2layers/core2.s2	Tue Sep 06 21:07:51 2011 +0800
@@ -5078,10 +5078,14 @@
             "</li>\n";
             }
         if ($.comments.enabled) {
-            $count ++;
-            """<li class="entry-replylink""" + ( $count == 1 ? " first-item" : "" ) + """">""";
-            $ep->print_reply_link({ "linktext" => $*text_post_comment, "target" => $target });
-            "</li>\n";
+            if ($.comments.maxcomments) {
+                print safe "$*text_max_comments";
+            } else {
+                $count ++;
+                """<li class="entry-replylink""" + ( $count == 1 ? " first-item" : "" ) + """">""";
+                $ep->print_reply_link({ "linktext" => $*text_post_comment, "target" => $target });
+                "</li>\n";
+            }
         }
         "</ul>";
     } else {
diff -r dd62b82c8a0c -r 00330a280321 htdocs/talkread.bml
--- a/htdocs/talkread.bml	Tue Sep 06 21:04:34 2011 +0800
+++ b/htdocs/talkread.bml	Tue Sep 06 21:07:51 2011 +0800
@@ -57,7 +57,7 @@
 
     # pre-load common strings for little speed and less typing later
     # (we're doing this *after* set_language_scope is called, because
-    # two below are relative strings)
+    # a few below are relative strings)
     my %T = qw(postcomments    talk.commentpost
                readcomments    talk.commentsread
                parent          talk.parentlink
@@ -70,6 +70,7 @@
                link            talk.commentpermlink
                deleted         .subjectdeleted
                nosubject       .nosubject
+               maxcomments     .maxcomments
                );
     foreach (keys %T) { $T{$_} = $ML{$T{$_}}; }
 
@@ -124,6 +125,7 @@
     }
 
     my $entry = LJ::Entry->new($u, ditemid => $ditemid);
+    my $maxcomments = ( $entry->reply_count >= $u->count_maxcomments ) ? 1 : 0;
 
     # canonical link to the entry or comment thread
     $$head .= LJ::canonical_link( $entry->url, $GET{thread} );
@@ -573,16 +575,18 @@
                 my $replyurl = LJ::Talk::talkargs( $talkurl, "replyto=$dtid", $style_args );
                 if ($post->{'state'} eq 'F') {
                     $ret .= "($T{'frozen'})&nbsp; ";
-                } elsif ($remote) {
-                    if ( $post->{state} eq 'S' ) {
-                        # if the user can see the comment, they can also reply
-                        # if they can also unscreen, they are given the option to reply and unscreen
-                        $ret .= "(" . LJ::make_qr_link( $dtid, $post->{subject}, $T{replythis}, $replyurl ) .  ")&nbsp; ";
+                } elsif ( ! $maxcomments ) {
+                    if ($remote) {
+                        if ( $post->{state} eq 'S' ) {
+                            # if the user can see the comment, they can also reply
+                            # if they can also unscreen, they are given the option to reply and unscreen
+                            $ret .= "(" . LJ::make_qr_link( $dtid, $post->{subject}, $T{replythis}, $replyurl ) .  ")&nbsp; ";
+                        } else {
+                            $ret .= "(" . LJ::make_qr_link($dtid, $post->{'subject'}, $T{'replythis'}, $replyurl) .  ")&nbsp; ";
+                        }
                     } else {
-                        $ret .= "(" . LJ::make_qr_link($dtid, $post->{'subject'}, $T{'replythis'}, $replyurl) .  ")&nbsp; ";
+                        $ret .= "(<a href='$replyurl'>$T{'replythis'}</a>)&nbsp; ";
                     }
-                } else {
-                    $ret .= "(<a href='$replyurl'>$T{'replythis'}</a>)&nbsp; ";
                 }
 
                 my $parentid = $post->{'parenttalkid'} || $post->{'parenttalkid_actual'};
@@ -670,10 +674,14 @@
         # Quick Reply when posting a new top level comment
         # requires setup when logged in.
         $ret .= "<p class='lesstop' align='center'><b>$readlink";
-        if ($remote) {
-            $ret .= "(" . LJ::make_qr_link('top', '', $T{'postcomments'}, $posturl) . ")";
+        if ( $maxcomments ) {
+            $ret .= "($T{maxcomments})";
         } else {
-            $ret .= "(<a href='$posturl'>$T{'postcomments'}</a>)";
+            if ($remote) {
+                $ret .= "(" . LJ::make_qr_link('top', '', $T{'postcomments'}, $posturl) . ")";
+            } else {
+                $ret .= "(<a href='$posturl'>$T{'postcomments'}</a>)";
+            }
         }
 
         $ret .= "</b></p>";
@@ -722,10 +730,14 @@
             }
 
             $ret .= "<hr /><p class='lesstop' align='center'><b>$readlink";
-            if ( $remote ) {
-                $ret .= "(" . LJ::make_qr_link('bottom', '', $T{'postcomments'}, $posturl) . ")";
+            if ( $maxcomments ) {
+                $ret .= "($T{maxcomments})";
             } else {
-                $ret .= "(<a href='$posturl'>$T{'postcomments'}</a>)";
+                if ( $remote ) {
+                    $ret .= "(" . LJ::make_qr_link('bottom', '', $T{'postcomments'}, $posturl) . ")";
+                } else {
+                    $ret .= "(<a href='$posturl'>$T{'postcomments'}</a>)";
+                }
             }
             $ret .= "</b></p>";
             $ret .= "<div align='center'>" . LJ::make_qr_target('bottom') . "</div>" if $remote;
diff -r dd62b82c8a0c -r 00330a280321 htdocs/talkread.bml.text
--- a/htdocs/talkread.bml.text	Tue Sep 06 21:04:34 2011 +0800
+++ b/htdocs/talkread.bml.text	Tue Sep 06 21:07:51 2011 +0800
@@ -19,6 +19,8 @@
 
 .from_external=(from [[site]])
 
+.maxcomments=Maximum comments reached
+
 .noreplies=No replies
 
 .nosubject=(no subject)
--------------------------------------------------------------------------------

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