fix: update? what update

This commit is contained in:
Mar0xy 2023-09-22 22:54:35 +02:00
parent a19473eb46
commit 1795195097
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
3 changed files with 6 additions and 4 deletions

View file

@ -216,7 +216,7 @@ export class NoteEditService implements OnApplicationShutdown {
throw new Error('fail');
};
let oldnote = await this.notesRepository.findOneBy({
const oldnote = await this.notesRepository.findOneBy({
id: editid,
});
@ -711,10 +711,12 @@ export class NoteEditService implements OnApplicationShutdown {
@bindThis
private async renderNoteOrRenoteActivity(data: Option, note: MiNote) {
if (data.localOnly) return null;
const user = await this.usersRepository.findOneBy({ id: note.userId });
if (user == null) throw new Error('user not found');
const content = data.renote && data.text == null && data.poll == null && (data.files == null || data.files.length === 0)
? this.apRendererService.renderAnnounce(data.renote.uri ? data.renote.uri : `${this.config.url}/notes/${data.renote.id}`, note)
: this.apRendererService.renderCreate(await this.apRendererService.renderNote(note, false), note);
: this.apRendererService.renderUpdate(await this.apRendererService.renderNote(note, false), user);
return this.apRendererService.addContext(content);
}

View file

@ -205,4 +205,4 @@ export type RoleAssignmentsRepository = Repository<MiRoleAssignment>;
export type FlashsRepository = Repository<MiFlash>;
export type FlashLikesRepository = Repository<MiFlashLike>;
export type UserMemoRepository = Repository<MiUserMemo>;
export type NoteEditRepository = Repository<NoteEdit>;
export type NoteEditRepository = Repository<NoteEdit>;

View file

@ -354,4 +354,4 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
};
});
}
}
}