mark: A photo of Mark kneeling on top of the Taal Volcano in the Philippines. It was a long hike. (Default)
Mark Smith ([staff profile] mark) wrote in [site community profile] changelog2009-03-19 04:26 am

[dw-free] Overhaul S2

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

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

Allow limiting tags displayed, sorted by usage count.

Patch by [personal profile] afuna.

Files modified:
  • cgi-bin/LJ/S2.pm
--------------------------------------------------------------------------------
diff -r 45f1ef43bb1c -r 73e069b6c11a cgi-bin/LJ/S2.pm
--- a/cgi-bin/LJ/S2.pm	Thu Mar 19 04:24:20 2009 +0000
+++ b/cgi-bin/LJ/S2.pm	Thu Mar 19 04:26:19 2009 +0000
@@ -3910,7 +3910,7 @@ foreach my $class (qw(RecentPage Friends
 
 sub Page__visible_tag_list
 {
-    my ($ctx, $this) = @_;
+    my ($ctx, $this, $limit) = @_;
     return $this->{'_visible_tag_list'}
         if defined $this->{'_visible_tag_list'};
 
@@ -3928,6 +3928,11 @@ sub Page__visible_tag_list
 
         # create tag object
         push @taglist, LJ::S2::TagDetail($u, $kwid => $tags->{$kwid});
+    }
+
+    if ($limit) {
+        @taglist = sort { $b->{use_count} <=> $a->{use_count} } @taglist;
+        @taglist = splice @taglist, 0, $limit;
     }
 
     @taglist = sort { $a->{name} cmp $b->{name} } @taglist;
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
No Subject Icon Selected
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org