mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: add timestamp to most activity ids
This commit is contained in:
@@ -130,8 +130,8 @@ Helpers.resolveLocalId = async (input) => {
|
||||
|
||||
let activityData = {};
|
||||
if (hash.startsWith('#activity')) {
|
||||
const [, activity, data] = hash.split('/', 3);
|
||||
activityData = { activity, data };
|
||||
const [, activity, data, timestamp] = hash.split('/', 4);
|
||||
activityData = { activity, data, timestamp };
|
||||
}
|
||||
|
||||
// https://bb.devnull.land/cid/2#activity/follow/activitypub@community.nodebb.org│
|
||||
|
||||
@@ -48,7 +48,7 @@ inbox.create = async (req) => {
|
||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
||||
if (followers.length) {
|
||||
await activitypub.send('cid', cid, followers, {
|
||||
id: `${object.id}#activity/announce`,
|
||||
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||
type: 'Announce',
|
||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||
cc: [activitypub._constants.publicAddress],
|
||||
@@ -281,7 +281,7 @@ inbox.follow = async (req) => {
|
||||
|
||||
user.onFollow(actor, id);
|
||||
activitypub.send('uid', id, actor, {
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}`,
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}/${Date.now()}`,
|
||||
type: 'Accept',
|
||||
object: {
|
||||
id: followId,
|
||||
@@ -308,7 +308,7 @@ inbox.follow = async (req) => {
|
||||
}
|
||||
|
||||
activitypub.send('cid', id, actor, {
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}`,
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/accept:follow/${handle}/${Date.now()}`,
|
||||
type: 'Accept',
|
||||
object: {
|
||||
id: followId,
|
||||
|
||||
@@ -159,7 +159,7 @@ Notes.assert = async (uid, input, options = { skipChecks: false }) => {
|
||||
const followers = await activitypub.notes.getCategoryFollowers(cid);
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await activitypub.send('cid', cid, followers, {
|
||||
id: `${object.id}#activity/announce`,
|
||||
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||
type: 'Announce',
|
||||
to: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||
cc: [activitypub._constants.publicAddress],
|
||||
|
||||
@@ -70,7 +70,7 @@ activitypubApi.unfollow = enabledCheck(async (caller, { type, id, actor }) => {
|
||||
}
|
||||
|
||||
await activitypub.send(type, id, [actor], {
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/undo:follow/${handle}`,
|
||||
id: `${nconf.get('url')}/${type}/${id}#activity/undo:follow/${handle}/${Date.now()}`,
|
||||
type: 'Undo',
|
||||
object,
|
||||
});
|
||||
@@ -146,14 +146,14 @@ activitypubApi.create.note = enabledCheck(async (caller, { pid }) => {
|
||||
|
||||
const payloads = {
|
||||
create: {
|
||||
id: `${object.id}#activity/create`,
|
||||
id: `${object.id}#activity/create/${Date.now()}`,
|
||||
type: 'Create',
|
||||
to,
|
||||
cc,
|
||||
object,
|
||||
},
|
||||
announce: {
|
||||
id: `${object.id}#activity/announce`,
|
||||
id: `${object.id}#activity/announce/${Date.now()}`,
|
||||
type: 'Announce',
|
||||
to: [activitypub._constants.publicAddress],
|
||||
cc: [`${nconf.get('url')}/category/${cid}/followers`],
|
||||
@@ -277,7 +277,7 @@ activitypubApi.undo.like = enabledCheck(async (caller, { pid }) => {
|
||||
}
|
||||
|
||||
await activitypub.send('uid', caller.uid, [uid], {
|
||||
id: `${nconf.get('url')}/uid/${caller.uid}#activity/undo:like/${encodeURIComponent(pid)}`,
|
||||
id: `${nconf.get('url')}/uid/${caller.uid}#activity/undo:like/${encodeURIComponent(pid)}/${Date.now()}`,
|
||||
type: 'Undo',
|
||||
object: {
|
||||
actor: `${nconf.get('url')}/uid/${caller.uid}`,
|
||||
@@ -318,7 +318,7 @@ activitypubApi.undo.flag = enabledCheck(async (caller, flag) => {
|
||||
const reason = flag.reason ||
|
||||
(flag.reports && flag.reports.filter(report => report.reporter.uid === caller.uid).at(-1).value);
|
||||
await activitypub.send('uid', caller.uid, reportedIds, {
|
||||
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}`,
|
||||
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/undo:flag/${caller.uid}/${Date.now()}`,
|
||||
type: 'Undo',
|
||||
object: {
|
||||
id: `${nconf.get('url')}/${flag.type}/${encodeURIComponent(flag.targetId)}#activity/flag/${caller.uid}`,
|
||||
|
||||
Reference in New Issue
Block a user