pauamma: Cartooney crab wearing hot pink and acid green facemask holding drink with straw (Default)
Res facta quae tamen fingi potuit ([personal profile] pauamma) wrote in [site community profile] changelog2009-03-09 08:37 pm

[dw-free] Configure Thread Expander

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

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

Comment thread expander

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/S2.pm
  • cgi-bin/LJ/User.pm
  • etc/config.pl
  • htdocs/talkread.bml
--------------------------------------------------------------------------------
diff -r 790d6028b787 -r b849a06289a2 cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Mon Mar 09 20:14:48 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Mon Mar 09 20:35:29 2009 +0000
@@ -3123,7 +3123,7 @@ sub _Comment__get_link
                             LJ::S2::Image("$LJ::IMGPREFIX/btn_edit.gif", 22, 20));
     }
     if ($key eq "expand_comments") {
-        return $null_link unless LJ::run_hook('show_thread_expander');
+        return $null_link unless $u->show_thread_expander( $remote );
         ## show "Expand" link only if 
         ## 1) the comment is collapsed 
         ## 2) any of comment's children are collapsed
diff -r 790d6028b787 -r b849a06289a2 cgi-bin/LJ/User.pm
--- a/cgi-bin/LJ/User.pm	Mon Mar 09 20:14:48 2009 +0000
+++ b/cgi-bin/LJ/User.pm	Mon Mar 09 20:35:29 2009 +0000
@@ -2072,6 +2072,15 @@ sub should_show_schools_to {
     return 0;
 }
 
+# should show the thread expander for this user/journal
+sub show_thread_expander {
+    my ( $u, $remote ) = @_;
+    
+    return 1 if $remote && $remote->get_cap( 'thread_expander' )
+        || $u->get_cap( 'thread_expander' );
+
+    return 0;
+}
 
 sub _lazy_migrate_infoshow {
     my ($u) = @_;
diff -r 790d6028b787 -r b849a06289a2 etc/config.pl
--- a/etc/config.pl	Mon Mar 09 20:14:48 2009 +0000
+++ b/etc/config.pl	Mon Mar 09 20:35:29 2009 +0000
@@ -355,6 +355,7 @@
             'rateperiod-failed_login' => 60*5, # 5 minutes
             'rateallowed-failed_login' => 3,
             'staff_headicon' => 0,
+            thread_expander => 0,
             );
 
     # capability class limits.
@@ -401,7 +402,8 @@
             'synd_create' => 1,
             'tags_max' => 1000,
             'textmessaging' => 0,
-            'tools_recent_comments_display' => 10,
+            thread_expander => 0,            
+            'tools_recent_comments_display' => 10,            
             'track_defriended' => 0,
             'track_pollvotes' => 0,
             'track_thread' => 0,
@@ -451,6 +453,7 @@
             'synd_create' => 1,
             'tags_max' => 1500,
             'textmessaging' => 1,
+            thread_expander => 1,            
             'tools_recent_comments_display' => 100,
             'track_defriended' => 1,
             'track_pollvotes' => 1,
@@ -499,6 +502,7 @@
             'synd_create' => 1,
             'tags_max' => 2000,
             'textmessaging' => 1,
+            thread_expander => 1,            
             'tools_recent_comments_display' => 150,
             'track_defriended' => 1,
             'track_pollvotes' => 1,
@@ -554,6 +558,7 @@
             'synd_create' => 1,
             'tags_max' => 2000,
             'textmessaging' => 1,
+            thread_expander => 1,            
             'tools_recent_comments_display' => 150,
             'track_defriended' => 1,
             'track_pollvotes' => 1,
@@ -602,6 +607,7 @@
             'synd_create' => 1,
             'tags_max' => 2000,
             'textmessaging' => 1,
+            thread_expander => 1,            
             'tools_recent_comments_display' => 150,
             'track_defriended' => 1,
             'track_pollvotes' => 1,
diff -r 790d6028b787 -r b849a06289a2 htdocs/talkread.bml
--- a/htdocs/talkread.bml	Mon Mar 09 20:14:48 2009 +0000
+++ b/htdocs/talkread.bml	Mon Mar 09 20:35:29 2009 +0000
@@ -453,7 +453,7 @@ my $old_url = 0;
     $LJ_cmtinfo{'canAdmin'} = LJ::can_manage($remote, $u) ? 1 : 0;
     $LJ_cmtinfo{'remote'} = $remote ? $remote->{user} : "";
     my $fmt_time_short = "%%hh%%:%%min%% %%a%%m";
-    my $show_thread_expander = LJ::run_hook('show_thread_expander');
+    my $show_thread_expander = $u->show_thread_expander( $remote );
 
     my $recurse_post = sub
     {
--------------------------------------------------------------------------------

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