Browse Source

Don't show topic twice

Morten Brix Pedersen 24 năm trước cách đây
mục cha
commit
8d6f7b8d5f
1 tập tin đã thay đổi với 6 bổ sung0 xóa
  1. 6 0
      modules/Pisg/HTMLGenerator.pm

+ 6 - 0
modules/Pisg/HTMLGenerator.pm

@@ -1243,6 +1243,8 @@ sub _lasttopics
     if ($self->{stats}->{topics}) {
         $self->{debug}->("Total number of topics: " . scalar @{ $self->{stats}->{topics} });
 
+        my %topic_seen;
+
         my %hash = (
             total => scalar @{ $self->{stats}->{topics} }
         );
@@ -1258,6 +1260,10 @@ sub _lasttopics
 
         for (my $i = $ltopic; $i >= $tlimit; $i--) {
             my $topic = htmlentities($self->{stats}->{topics}[$i]{topic});
+            # This code makes sure that we don't see the same topic twice
+            next if ($topic_seen{$topic});
+            $topic_seen{$topic} = 1;
+
             $topic = _replace_links($topic);
             # Strip off the quotes (')
             $topic =~ s/^\'(.*)\'$/$1/;