OSDN Git Service

Model::Discussion: fix create method when timestamp is not given
authorhylom <hylom@users.sourceforge.jp>
Thu, 10 Nov 2016 17:48:06 +0000 (02:48 +0900)
committerhylom <hylom@users.sourceforge.jp>
Thu, 10 Nov 2016 17:48:06 +0000 (02:48 +0900)
src/newslash_web/lib/Newslash/Model/Discussions.pm

index c72c41c..461adfc 100644 (file)
@@ -3,6 +3,7 @@ use Newslash::Model::Base -base;
 
 use Data::Dumper;
 use Mojo::Log;
+use POSIX qw(strftime);
 
 use constant TABLE_COLUMNS => qw(
                                     id
@@ -151,7 +152,7 @@ EOSQL
                       $params->{title},
                       $params->{url},
                       $params->{topic} || 0,
-                      $params->{ts},
+                      $params->{ts} || strftime("%F %T", gmtime),
                       $params->{type} || "open", #type
                       $uid, #uid
                       $params->{primaryskid} || $mainpage_skid,