Skip to content

Node.js based forum software built for the modern web

Revert "feat: log all post edits to the event log, return eid when logging events, plumb eid into Update(Note) to federate out as a unique id"

Opliko8003b00acd9a
diff --git a/src/api/activitypub.js b/src/api/activitypub.js
index 0d21d6e0b1..6a7f3e7f1c 100644
--- a/src/api/activitypub.js
+++ b/src/api/activitypub.js
@@ -144,7 +144,7 @@ activitypubApi.update.profile = enabledCheck(async (caller, { uid }) => {
});
});
-activitypubApi.update.note = enabledCheck(async (caller, { post, eid }) => {
+activitypubApi.update.note = enabledCheck(async (caller, { post }) => {
const object = await activitypub.mocks.note(post);
const { targets } = await buildRecipients(object, post.user.uid);
@@ -155,7 +155,6 @@ activitypubApi.update.note = enabledCheck(async (caller, { post, eid }) => {
}
const payload = {
- id: `${nconf.get('url')}/api/v3/events/${eid}`,
type: 'Update',
to: object.to,
cc: object.cc,
diff --git a/src/api/posts.js b/src/api/posts.js
index ca12816a7b..4533b4464c 100644
--- a/src/api/posts.js
+++ b/src/api/posts.js
@@ -112,16 +112,16 @@ postsAPI.edit = async function (caller, data) {
if (editResult.topic.isMainPost) {
await topics.thumbs.migrate(data.uuid, editResult.topic.tid);
}
- let eid;
- if (editResult.post.changed) {
- ({ eid } = await events.log({
+ const selfPost = parseInt(caller.uid, 10) === parseInt(editResult.post.uid, 10);
+ if (!selfPost && editResult.post.changed) {
+ await events.log({
type: `post-edit`,
uid: caller.uid,
ip: caller.ip,
pid: editResult.post.pid,
oldContent: editResult.post.oldContent,
newContent: editResult.post.newContent,
- }));
+ });
}
if (editResult.topic.renamed) {
@@ -140,9 +140,7 @@ postsAPI.edit = async function (caller, data) {
if (!editResult.post.deleted) {
websockets.in(`topic_${editResult.topic.tid}`).emit('event:post_edited', editResult);
- if (eid) {
- await require('.').activitypub.update.note(caller, { post: postObj[0], eid });
- }
+ await require('.').activitypub.update.note(caller, { post: postObj[0] });
return returnData;
}
diff --git a/src/events.js b/src/events.js
index b750876341..41e1f0d29b 100644
--- a/src/events.js
+++ b/src/events.js
@@ -99,8 +99,6 @@ events.log = async function (data) {
db.setObject(`event:${eid}`, data),
]);
plugins.hooks.fire('action:events.log', { data: data });
-
- return { eid };
};
// filter, start, stop, from(optional), to(optional), uids(optional)