1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-11-30 15:58:19 +09:00

Merge branch 'develop' of https://github.com/kokonect-link/cherrypick into develop

This commit is contained in:
NoriDev 2023-10-30 17:20:22 +09:00
commit 06bc175a96
2 changed files with 7 additions and 14 deletions

View File

@ -794,10 +794,10 @@ export class ApInboxService {
if (isActor(object)) {
await this.apPersonService.updatePerson(actor.uri, resolver, object);
return 'ok: Person updated';
} /*else if (getApType(object) === 'Question') {
} else if (getApType(object) === 'Question') {
await this.apQuestionService.updateQuestion(object, resolver).catch(err => console.error(err));
return 'ok: Question updated';
}*/ else if (getApType(object) === 'Note' || getApType(object) === 'Question') {
} else if (getApType(object) === 'Note') {
await this.updateNote(resolver, actor, object, false, activity);
return 'ok: Note updated';
} else {
@ -824,9 +824,9 @@ export class ApInboxService {
const unlock = await this.appLockService.getApLock(uri);
try {
//const exist = await this.apNoteService.fetchNote(note);
//if (exist) return 'skip: note exists';
await this.apNoteService.updateNote(note, resolver, silent);
const target = await this.notesRepository.findOneBy({uri: uri});
if (!target) return `skip: target note not located: ${uri}`;
await this.apNoteService.updateNote(note, target, resolver, silent);
return 'ok';
} catch (err) {
if (err instanceof StatusError && err.isClientError) {

View File

@ -340,7 +340,7 @@ export class ApNoteService {
}
@bindThis
public async updateNote(value: string | IObject, resolver?: Resolver, silent = false): Promise<MiNote | null> {
public async updateNote(value: string | IObject, target: MiNote, resolver?: Resolver, silent = false): Promise<MiNote | null> {
if (resolver == null) resolver = this.apResolverService.createResolver();
const object = await resolver.resolve(value);
@ -370,13 +370,6 @@ export class ApNoteService {
throw new Error('actor has been suspended');
}
const b_note = await this.notesRepository.findOneBy({
uri: entryUri
}).then(x => {
if (x == null) throw new Error('note not found');
return x;
});
const limit = promiseLimit<MiDriveFile>(2);
const files = (await Promise.all(toArray(note.attachment).map(attach => (
limit(() => this.apImageService.resolveImage(actor, {
@ -418,7 +411,7 @@ export class ApNoteService {
apHashtags,
apEmojis,
poll,
}, b_note, silent);
}, target, silent);
} catch (err: any) {
this.logger.warn(`note update failed: ${err}`);
return err;