automatically update xd score when new xd is added
This commit is contained in:
@@ -2612,6 +2612,12 @@ class CommentSystem {
|
|||||||
this.syncSubscribeButton(true);
|
this.syncSubscribeButton(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Update xD score badge immediately from the POST response —
|
||||||
|
// faster and more reliable than waiting for the SSE NOTIFY.
|
||||||
|
if (typeof json.xd_score === 'number' && typeof window.updateXdBadgeFromScore === 'function') {
|
||||||
|
window.updateXdBadgeFromScore(this.itemId, json.xd_score);
|
||||||
|
}
|
||||||
|
|
||||||
this._silentSync();
|
this._silentSync();
|
||||||
this._finishSubmit(submitBtn, originalBtnHtml, parentId);
|
this._finishSubmit(submitBtn, originalBtnHtml, parentId);
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -445,6 +445,7 @@ export default (router, tpl) => {
|
|||||||
body: JSON.stringify({
|
body: JSON.stringify({
|
||||||
success: true,
|
success: true,
|
||||||
comment: newComment[0],
|
comment: newComment[0],
|
||||||
|
xd_score: xdRow?.xd_score ?? null,
|
||||||
is_new_subscription
|
is_new_subscription
|
||||||
})
|
})
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user