Skip to content

Node.js based forum software built for the modern web

Trigger ActivityPub follow intent for guests in account header

Julian Lamcae0d6e8776e
diff --git a/public/src/client/account/header.js b/public/src/client/account/header.js
index dabfe5dff7..b016c580e5 100644
--- a/public/src/client/account/header.js
+++ b/public/src/client/account/header.js
@@ -96,6 +96,19 @@ define('forum/account/header', [
}
function toggleFollow(type) {
+ if (!app.user.uid) {
+ let objectId;
+ if (utils.isNumber(ajaxify.data.uid)) {
+ objectId = config.url + '/user/' + ajaxify.data.uid;
+ } else {
+ objectId = ajaxify.data.userslug;
+ }
+ import('modules/intents').then(({ trigger }) => {
+ trigger('follow', { object: objectId });
+ });
+ return false;
+ }
+
const target = isFinite(ajaxify.data.uid) ? ajaxify.data.uid : encodeURIComponent(ajaxify.data.userslug);
api[type === 'follow' ? 'put' : 'del']('/users/' + target + '/follow', undefined, function (err) {
if (err) {