From cbc74041c63fe50b7ad97ee745ffa90e867e5211 Mon Sep 17 00:00:00 2001 From: igoradamenko Date: Fri, 18 May 2018 23:45:25 +0300 Subject: [PATCH] fix adding comment to store, again --- web/app/common/store.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/web/app/common/store.js b/web/app/common/store.js index 9e5fda31..f61d2ba5 100644 --- a/web/app/common/store.js +++ b/web/app/common/store.js @@ -30,21 +30,11 @@ class Store { return this.data[key]; } - addComment({ text, id, pid }) { - const newComment = { - comment: { - id, - text, - user: this.get('user'), - time: new Date(), - ...(pid ? { pid } : {}), - }, - }; - - if (pid) { - this.pasteReply(newComment); + addComment(comment) { + if (comment.pid) { + this.pasteReply(comment); } else { - this.pasteComment(newComment); + this.pasteComment(comment); } }