소스 검색

Don't show topic twice

Morten Brix Pedersen 25 년 전
부모
커밋
8d6f7b8d5f
1개의 변경된 파일6개의 추가작업 그리고 0개의 파일을 삭제
  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/;