fix: #13375, plus additional tests

This commit is contained in:
Julian Lam
2025-05-13 13:59:34 -04:00
parent 30db15836b
commit fe13c75549
3 changed files with 72 additions and 47 deletions

View File

@@ -41,6 +41,7 @@ inbox.create = async (req) => {
return await activitypub.notes.assertPrivate(object);
}
// Category sync, remove when cross-posting available
const { cids } = await activitypub.actors.getLocalFollowers(actor);
let cid = null;
if (cids.size > 0) {
@@ -262,12 +263,19 @@ inbox.announce = async (req) => {
let tid;
let pid;
// Category sync, remove when cross-posting available
const { cids } = await activitypub.actors.getLocalFollowers(actor);
let cid = null;
if (cids.size > 0) {
cid = Array.from(cids)[0];
}
// 1b12 announce
const categoryActor = await categories.exists(actor);
if (categoryActor) {
cid = actor;
}
switch(true) {
case object.type === 'Like': {
const id = object.object.id || object.object;
@@ -318,13 +326,7 @@ inbox.announce = async (req) => {
}
}
// Handle case where Announce(Create(Note-ish)) is received
if (object.type === 'Create' && activitypub._constants.acceptedPostTypes.includes(object.object.type)) {
pid = object.object.id;
} else {
pid = object.id;
}
pid = object.id;
pid = await activitypub.resolveId(0, pid); // in case wrong id is passed-in; unlikely, but still.
if (!pid) {
return;