Node.js based forum software built for the modern web
Merge branch 'master' into develop
Barış Soner Uşaklı2b50a74f5e43
diff --cc src/api/posts.jsindex 3c90ee4f92,efeec43ace..04c9384177--- a/src/api/posts.js+++ b/src/api/posts.js@@@ -397,41 -365,17 +397,41 @@@ async function getTooltipData(uids)};}let otherCount = 0;- if (upvotedUids.length > cutoff) {- otherCount = upvotedUids.length - (cutoff - 1);- upvotedUids = upvotedUids.slice(0, cutoff - 1);+ if (uids.length > cutoff) {+ otherCount = uids.length - (cutoff - 1);+ uids = uids.slice(0, cutoff - 1);}- const usernames = await user.getUsernamesByUids(uids);- const users = await user.getUsersFields(upvotedUids, ['username']);++ const users = await user.getUsersFields(uids, ['username']);return {otherCount,- usernames,+ usernames: users.map(user => user.displayname),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, type) {