File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -265,6 +265,8 @@ func (app *JSONStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
265265 comment .Content = entity ["content" ].(string )
266266 comment .Date = FindTimeFromObjectID (comment .ID .Hex ())
267267 comment .PostID = bson .ObjectIdHex (entity ["postId" ].(string ))
268+ comment .Upvotes = 1
269+ comment .Score = hotScore (comment .Upvotes , comment .Date )
268270
269271 if entity ["parentCommentId" ] != nil {
270272 comment .ParentCommentID = bson .ObjectIdHex (entity ["parentCommentId" ].(string ))
@@ -291,6 +293,13 @@ func (app *JSONStoreApplication) DeliverTx(tx []byte) types.ResponseDeliverTx {
291293 panic (dbErr )
292294 }
293295
296+ // For recording default upvote
297+ var document UserCommentVote
298+ document .ID = bson .NewObjectId ()
299+ document .UserID = user .ID
300+ document .CommentID = comment .ID
301+
302+ db .C ("usercommentvotes" ).Insert (document )
294303 db .C ("posts" ).Update (bson.M {"_id" : comment .PostID }, bson.M {"$inc" : bson.M {"numComments" : 1 }})
295304
296305 break
You can’t perform that action at this time.
0 commit comments