From 95d1caf8dc94b36357a3322e633206d424084d24 Mon Sep 17 00:00:00 2001 From: qkli4 Date: Mon, 4 Nov 2024 17:28:32 +0800 Subject: [PATCH] fix(postPoints): Fix the Bug of Duplicate Points Increase When Posting a New Topic --- plugin/actions.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/plugin/actions.js b/plugin/actions.js index ee14496..22f4bb2 100644 --- a/plugin/actions.js +++ b/plugin/actions.js @@ -34,6 +34,11 @@ * @param postData {object} Post with signature - { pid:3, uid:1, tid:'1', content:'text', timestamp:1429974406764, reputation:0, votes: 0, edited: 0, deleted: 0, cid:2 } */ Action.postSave = function (postData) { + // When creating a new topic, both the postSave and topicSave events are triggered, resulting in the points being increased twice. In this scenario, we need to filter out the points increase triggered by postSave. + if (postData.post.isMain) { + return; + } + var value = settings.get().postWeight; incrementPoints(postData.post.uid, value); };