Przeglądaj źródła

Fix #74 - don't show nobody user

George S. Baugh 5 lat temu
rodzic
commit
74baf678df
2 zmienionych plików z 10 dodań i 6 usunięć
  1. 6 5
      lib/Trog/Data/DUMMY.pm
  2. 4 1
      www/templates/posts.tx

+ 6 - 5
lib/Trog/Data/DUMMY.pm

@@ -48,7 +48,7 @@ Posts generally need to have the following:
 
 =head2 new(Config::Simple $config)
 
-Try not to do expensive things here.  
+Try not to do expensive things here.
 
 =cut
 
@@ -129,7 +129,7 @@ sub get ($self, %request) {
     my $pages = int(scalar(@filtered) / ($offset || 1) );
 
     @filtered = splice(@filtered, ( int($request{page}) -1) * $offset, $offset) if $request{page} && $request{limit};
-    
+
     # Next, go ahead and build the "post type"
     @filtered = _add_post_type(@filtered);
     # Next, add the type of post this is
@@ -184,9 +184,10 @@ sub _add_media_type (@posts) {
     return map {
         my $post = $_;
         $post->{content_type} //= '';
-        $post->{is_video} = 1 if $post->{content_type} =~ m/^video\//;
-        $post->{is_audio} = 1 if $post->{content_type} =~ m/^audio\//;
-        $post->{is_image} = 1 if $post->{content_type} =~ m/^image\//;
+        $post->{is_video}   = 1 if $post->{content_type} =~ m/^video\//;
+        $post->{is_audio}   = 1 if $post->{content_type} =~ m/^audio\//;
+        $post->{is_image}   = 1 if $post->{content_type} =~ m/^image\//;
+        $post->{is_profile} = 1 if grep {$_ eq 'about' } @{$post->{tags}};
         $post
     } @posts;
 }

+ 4 - 1
www/templates/posts.tx

@@ -12,6 +12,9 @@
     : if ( $post.aclname && $in_series ) {
     : next;
     : }
+    : if ( $post.is_profile && $post.user == 'Nobody' ) {
+    : next;
+    : }
     :if ( $tiled ) {
         <a href="<: $route :>/<: $post.id :>" class="tile">
         : if ($post.is_video) {
@@ -41,7 +44,7 @@
                 <span id="<: $post.id :>-<: $post.version :>-time" style="float:right;"><: $post.created :></span>
                 <a class='usericon <: $post.user :>' title='Posted by <: $post.user :>'></a>
             </h3>
-            : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.wallpaper && $post.preview ) {
+            : if ( !$post.video_href && !$post.is_image && !$post.is_video && !$post.is_profile && $post.preview ) {
                 <div style="background-image:url(<: $post.preview :>);" class="responsive preview"></div>
             : }
             : if ( $post.video_href ) {