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'); throw new Error('fail');
}; };
let oldnote = await this.notesRepository.findOneBy({ const oldnote = await this.notesRepository.findOneBy({
id: editid, id: editid,
}); });
@ -711,10 +711,12 @@ export class NoteEditService implements OnApplicationShutdown {
@bindThis @bindThis
private async renderNoteOrRenoteActivity(data: Option, note: MiNote) { private async renderNoteOrRenoteActivity(data: Option, note: MiNote) {
if (data.localOnly) return null; 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) 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.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); return this.apRendererService.addContext(content);
} }