Skip to content

Node.js based forum software built for the modern web

Merge branch 'develop' into activitypub

Barış Soner Uşaklı8971bba53d7b
diff --cc install/package.json
index 87601fc20e,162c9d717b..57d98a803a
--- a/install/package.json
+++ b/install/package.json
@@@ -105,11 -104,11 +105,11 @@@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
- "nodebb-theme-harmony": "1.2.63",
+ "nodebb-theme-harmony": "2.0.0-pre.32",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.6",
- "nodebb-theme-persona": "13.3.25",
+ "nodebb-theme-persona": "14.0.0-pre.1",
- "nodebb-widget-essentials": "7.0.17",
+ "nodebb-widget-essentials": "7.0.18",
"nodemailer": "6.9.14",
"nprogress": "0.2.0",
"passport": "0.7.0",
diff --cc public/src/client/topic/votes.js
index 1149c3d900,ae690de93a..15ab05e6b7
--- a/public/src/client/topic/votes.js
+++ b/public/src/client/topic/votes.js
@@@ -13,16 -13,20 +13,23 @@@ define('forum/topic/votes',
components.get('topic').on('mouseenter', '[data-pid] [component="post/vote-count"]', loadDataAndCreateTooltip);
components.get('topic').on('mouseleave', '[data-pid] [component="post/vote-count"]', destroyTooltip);
}
+
+ components.get('topic').on('mouseenter', '[data-pid] [component="post/announce-count"]', loadDataAndCreateTooltip);
+ components.get('topic').on('mouseleave', '[data-pid] [component="post/announce-count"]', destroyTooltip);
};
+ function canSeeUpVotes() {
+ const { upvoteVisibility, privileges } = ajaxify.data;
+ return privileges.isAdminOrMod ||
+ upvoteVisibility === 'all' ||
+ (upvoteVisibility === 'loggedin' && config.loggedIn);
+ }
+
function canSeeVotes() {
- const { voteVisibility, privileges } = ajaxify.data;
+ const { upvoteVisibility, downvoteVisibility, privileges } = ajaxify.data;
return privileges.isAdminOrMod ||
- voteVisibility === 'all' ||
- (voteVisibility === 'loggedin' && config.loggedIn);
+ upvoteVisibility === 'all' || downvoteVisibility === 'all' ||
+ ((upvoteVisibility === 'loggedin' || downvoteVisibility === 'loggedin') && config.loggedIn);
}
function destroyTooltip() {
diff --cc src/api/posts.js
index 0af9558823,4e3917a008..5d5a7742a1
--- a/src/api/posts.js
+++ b/src/api/posts.js
@@@ -389,33 -376,9 +397,33 @@@ async function getTooltipData(uids)
usernames,
cutoff,
};
+}
+
+postsAPI.getAnnouncers = async (caller, data) => {
+ if (!data.pid) {
+ throw new Error('[[error:invalid-data]]');
+ }
+ if (!meta.config.activitypubEnabled) {
+ return [];
+ }
+ const { pid } = data;
+ const cid = await posts.getCidByPid(pid);
+ if (!await privileges.categories.isUserAllowedTo('topics:read', cid, caller.uid)) {
+ throw new Error('[[error:no-privileges]]');
+ }
+ const notes = require('../activitypub/notes');
+ const announcers = await notes.announce.list({ pid });
+ const uids = announcers.map(ann => ann.actor);
+ if (data.tooltip) {
+ return await getTooltipData(uids);
+ }
+ return {
+ announceCount: uids.length,
+ announcers: await user.getUsersFields(uids, ['username', 'userslug', 'picture']),
+ };
};
- async function canSeeVotes(uid, cids) {
+ async function canSeeVotes(uid, cids, type) {
const isArray = Array.isArray(cids);
if (!isArray) {
cids = [cids];