mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-03-18 18:40:58 +01:00
Merge branch 'develop' of https://github.com/NodeBB/NodeBB into develop
This commit is contained in:
@@ -986,19 +986,31 @@ Mocks.activities.create = async (pid, uid, post) => {
|
||||
return { activity, targets };
|
||||
};
|
||||
|
||||
Mocks.activities.like = (pid, uid) => ({
|
||||
id: `${nconf.get('url')}/uid/${uid}#activity/like/${encodeURIComponent(pid)}`,
|
||||
type: 'Like',
|
||||
actor: `${nconf.get('url')}/uid/${uid}`,
|
||||
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
|
||||
});
|
||||
Mocks.activities.like = async (pid, uid) => {
|
||||
const authorUid = await posts.getPostField(pid, 'uid');
|
||||
|
||||
Mocks.activities.dislike = (pid, uid) => ({
|
||||
id: `${nconf.get('url')}/uid/${uid}#activity/dislike/${encodeURIComponent(pid)}`,
|
||||
type: 'Dislike',
|
||||
actor: `${nconf.get('url')}/uid/${uid}`,
|
||||
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
|
||||
});
|
||||
return {
|
||||
id: `${nconf.get('url')}/uid/${uid}#activity/like/${encodeURIComponent(pid)}`,
|
||||
type: 'Like',
|
||||
actor: `${nconf.get('url')}/uid/${uid}`,
|
||||
to: [activitypub._constants.publicAddress],
|
||||
cc: [authorUid],
|
||||
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
|
||||
};
|
||||
};
|
||||
|
||||
Mocks.activities.dislike = async (pid, uid) => {
|
||||
const authorUid = await posts.getPostField(pid, 'uid');
|
||||
|
||||
return {
|
||||
id: `${nconf.get('url')}/uid/${uid}#activity/dislike/${encodeURIComponent(pid)}`,
|
||||
type: 'Dislike',
|
||||
actor: `${nconf.get('url')}/uid/${uid}`,
|
||||
to: [activitypub._constants.publicAddress],
|
||||
cc: [authorUid],
|
||||
object: utils.isNumber(pid) ? `${nconf.get('url')}/post/${pid}` : pid,
|
||||
};
|
||||
};
|
||||
|
||||
Mocks.activities.announce = async (tid, uid) => {
|
||||
const { mainPid: pid, cid } = await topics.getTopicFields(tid, ['mainPid', 'cid']);
|
||||
|
||||
@@ -254,7 +254,7 @@ Out.delete.note = enabledCheck(async (uid, pid) => {
|
||||
Out.like = {};
|
||||
|
||||
Out.like.note = enabledCheck(async (uid, pid) => {
|
||||
const payload = activitypub.mocks.activities.like(pid, uid);
|
||||
const payload = await activitypub.mocks.activities.like(pid, uid);
|
||||
|
||||
if (!activitypub.helpers.isUri(pid)) { // only 1b12 announce for local likes
|
||||
await activitypub.feps.announce(pid, payload);
|
||||
|
||||
@@ -224,7 +224,7 @@ Controller.getCategoryOutbox = async (req, res) => {
|
||||
count,
|
||||
page,
|
||||
perPage: 20,
|
||||
url: `${nconf.get('url')}/category/1/outbox`,
|
||||
url: `${nconf.get('url')}/category/${cid}/outbox`,
|
||||
});
|
||||
if (collection.orderedItems) {
|
||||
collection.orderedItems = await Promise.all(collection.orderedItems.map(async (pid) => {
|
||||
|
||||
Reference in New Issue
Block a user