changelog_bot (changelog_bot) wrote in changelog,
changelog_bot
changelog_bot
changelog

[livejournal] r18083: LJSUP-7738

Committer: emazin
LJSUP-7738
U   trunk/cgi-bin/LJ/Talk.pm
Modified: trunk/cgi-bin/LJ/Talk.pm
===================================================================
--- trunk/cgi-bin/LJ/Talk.pm	2011-01-21 10:31:00 UTC (rev 18082)
+++ trunk/cgi-bin/LJ/Talk.pm	2011-01-21 10:33:24 UTC (rev 18083)
@@ -348,15 +348,17 @@
     return 0 unless $remote;
     return 1 if $remote->{'user'} eq $u->{'user'} ||
                 $remote->{'user'} eq (ref $up ? $up->{'user'} : $up) ||
-                $remote->can_manage($u);
+                $remote->can_manage($u) || $remote->can_moderate($u);
     return 0;
 }
 
 sub can_unscreen {
+    return 0 if $_[0]->can_moderate($_[1]);
     return LJ::Talk::can_screen(@_);
 }
 
 sub can_view_screened {
+    return 0 if $_[0]->can_moderate($_[1]);
     return LJ::Talk::can_delete(@_);
 }
 
@@ -365,6 +367,7 @@
 }
 
 sub can_unfreeze {
+    return 1 if $_[0]->can_moderate($_[1]);
     return LJ::Talk::can_unscreen(@_);
 }
 
@@ -1282,6 +1285,26 @@
         }
     }
 
+    # load first level and 3 first replies(or replies to replies)
+    if ($opts->{'expand_strategy'} eq 'mobile') {
+        undef @check_for_children;
+        foreach my $first_itemid (@top_replies) {
+            next unless $children{$first_itemid};
+            my @childrens = @{ $children{$first_itemid} };
+            my $load = $opts->{'expand_child'} || 3;
+            while( @childrens && $load > 0 ){
+                if ( @childrens >= $load ){
+                    push @posts_to_load, splice(@childrens, 0, $load);
+                    last;
+                }else{
+                    push @posts_to_load, @childrens;
+                    $load -= @childrens;
+                    @childrens = map {$children{$_}?@{$children{$_}}:()} @childrens;
+                }
+            }
+        }        
+    }
+    
     my (@subjects_to_load, @subjects_ignored);
     while (@check_for_children) {
         my $cfc = shift @check_for_children;

Tags: changelog_bot, livejournal, pm
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