merge: when creating a note as a side-effect, make it silent - fixes #986 (!932)

View MR for information: https://activitypub.software/TransFem-org/Sharkey/-/merge_requests/932

Closes #986

Approved-by: Marie <github@yuugi.dev>
Approved-by: Hazelnoot <acomputerdog@gmail.com>
This commit is contained in:
Hazelnoot 2025-05-08 14:05:16 +00:00
commit 3fc2cc125b

View file

@ -470,7 +470,7 @@ export class ApInboxService {
} }
@bindThis @bindThis
private async create(actor: MiRemoteUser, activity: ICreate | IUpdate, resolver?: Resolver): Promise<string | void> { private async create(actor: MiRemoteUser, activity: ICreate | IUpdate, resolver?: Resolver, silent = false): Promise<string | void> {
const uri = getApId(activity); const uri = getApId(activity);
this.logger.info(`Create: ${uri}`); this.logger.info(`Create: ${uri}`);
@ -505,7 +505,7 @@ export class ApInboxService {
}); });
if (isPost(object)) { if (isPost(object)) {
await this.createNote(resolver, actor, object, false); await this.createNote(resolver, actor, object, silent);
} else { } else {
return `skip: Unsupported type for Create: ${getApType(object)} ${getNullableApId(object)}`; return `skip: Unsupported type for Create: ${getApType(object)} ${getNullableApId(object)}`;
} }
@ -889,7 +889,7 @@ export class ApInboxService {
} else if (getApType(object) === 'Question') { } else if (getApType(object) === 'Question') {
// If we get an Update(Question) for a note that doesn't exist, then create it instead // If we get an Update(Question) for a note that doesn't exist, then create it instead
if (!await this.apNoteService.hasNote(object)) { if (!await this.apNoteService.hasNote(object)) {
return await this.create(actor, activity, resolver); return await this.create(actor, activity, resolver, true);
} }
await this.apQuestionService.updateQuestion(object, actor, resolver); await this.apQuestionService.updateQuestion(object, actor, resolver);
@ -897,7 +897,7 @@ export class ApInboxService {
} else if (isPost(object)) { } else if (isPost(object)) {
// If we get an Update(Note) for a note that doesn't exist, then create it instead // If we get an Update(Note) for a note that doesn't exist, then create it instead
if (!await this.apNoteService.hasNote(object)) { if (!await this.apNoteService.hasNote(object)) {
return await this.create(actor, activity, resolver); return await this.create(actor, activity, resolver, true);
} }
await this.apNoteService.updateNote(object, actor, resolver); await this.apNoteService.updateNote(object, actor, resolver);