Node.js based forum software built for the modern web
feat: invoke intents.trigger on guest vote attempt
Julian Lamf93f45d1e345
diff --git a/public/src/client/topic/votes.js b/public/src/client/topic/votes.jsindex 3c325cbbc3..225fc30032 100644--- a/public/src/client/topic/votes.js+++ b/public/src/client/topic/votes.js@@ -99,14 +99,24 @@ define('forum/topic/votes', [const method = currentState ? 'del' : 'put';const pid = post.attr('data-pid');++ if (!app.user.uid) {+ let objectId;+ if (utils.isNumber(pid)) {+ objectId = document.location.origin + config.relative_path + '/post/' + pid;+ } else {+ objectId = pid;+ }+ import('modules/intents').then(({ trigger }) => {+ trigger('like', { object: objectId });+ });+ return false;+ }+api[method](`/posts/${encodeURIComponent(pid)}/vote`, {delta: delta,}, function (err) {if (err) {- if (!app.user.uid) {- ajaxify.go('login');- return;- }return alerts.error(err);}hooks.fire('action:post.toggleVote', {