enhance(backend): inbox queue error in update note
(cherry picked from commit 1312c4f944b235d77275a51047275f84e4904de8)
This commit is contained in:
parent
958f94dbc7
commit
8bbe703383
|
@ -785,9 +785,9 @@ export class ApInboxService {
|
||||||
const unlock = await this.appLockService.getApLock(uri);
|
const unlock = await this.appLockService.getApLock(uri);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
//const exist = await this.apNoteService.fetchNote(note);
|
const target = await this.notesRepository.findOneBy({uri: uri});
|
||||||
//if (exist) return 'skip: note exists';
|
if (!target) return `skip: target note not located: ${uri}`;
|
||||||
await this.apNoteService.updateNote(note, resolver, silent);
|
await this.apNoteService.updateNote(note, target, resolver, silent);
|
||||||
return 'ok';
|
return 'ok';
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
if (err instanceof StatusError && err.isClientError) {
|
if (err instanceof StatusError && err.isClientError) {
|
||||||
|
|
|
@ -335,7 +335,7 @@ export class ApNoteService {
|
||||||
}
|
}
|
||||||
|
|
||||||
@bindThis
|
@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();
|
if (resolver == null) resolver = this.apResolverService.createResolver();
|
||||||
|
|
||||||
const object = await resolver.resolve(value);
|
const object = await resolver.resolve(value);
|
||||||
|
@ -365,13 +365,6 @@ export class ApNoteService {
|
||||||
throw new Error('actor has been suspended');
|
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 limit = promiseLimit<MiDriveFile>(2);
|
||||||
const files = (await Promise.all(toArray(note.attachment).map(attach => (
|
const files = (await Promise.all(toArray(note.attachment).map(attach => (
|
||||||
limit(() => this.apImageService.resolveImage(actor, {
|
limit(() => this.apImageService.resolveImage(actor, {
|
||||||
|
@ -413,7 +406,7 @@ export class ApNoteService {
|
||||||
apHashtags,
|
apHashtags,
|
||||||
apEmojis,
|
apEmojis,
|
||||||
poll,
|
poll,
|
||||||
}, b_note, silent);
|
}, target, silent);
|
||||||
} catch (err: any) {
|
} catch (err: any) {
|
||||||
this.logger.warn(`note update failed: ${err}`);
|
this.logger.warn(`note update failed: ${err}`);
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue