OSDN Git Service

Model::Stories: fix some warnings and add alias story->{discussiond_id}
authorhylom <hylom@users.sourceforge.jp>
Tue, 28 Mar 2017 16:00:14 +0000 (01:00 +0900)
committerhylom <hylom@users.sourceforge.jp>
Tue, 28 Mar 2017 16:00:14 +0000 (01:00 +0900)
src/newslash_web/lib/Newslash/Model/Stories.pm

index ca30bb5..b16cd2a 100644 (file)
@@ -995,13 +995,15 @@ sub _generalize {
 
     #my $max_weight = 0;
     for my $t (@{$story->{topics}}) {
-        if ($t->{tid} == $story->{tid}) {
+        if ($t->{tid} && $t->{tid} == $story->{tid}) {
             $story->{primary_topic} = $t;
         }
         #if ($t->{weight} && $t->{weight} > $max_weight) {
         #    $max_weight = $t->{weight};
         #}
     }
+
+    $story->{discussion_id} = $story->{discussion};
 }
 
 # delete story from database