Fix null coalescing in /admin/emoji/update (fixes #44) (#45)

Reviewed-on: https://codeberg.org/yeentown/barkey/pulls/45
Reviewed-by: zima <zima@noreply.codeberg.org>
Co-authored-by: HellhoundSoftware <keith@keithhacks.cyou>
Co-committed-by: HellhoundSoftware <keith@keithhacks.cyou>
This commit is contained in:
~keith 2025-01-14 01:48:00 +00:00 committed by zima
parent 4bfe849810
commit cbd0bde157

View file

@ -96,10 +96,14 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
emojiId = emoji.id;
}
let categoryNfc: string|null|undefined = ps.category?.normalize('NFC');
// stop ?. from turning a null into an undefined
if (ps.category === null) categoryNfc = null;
await this.customEmojiService.update(emojiId, {
driveFile,
name: nameNfc,
category: ps.category?.normalize('NFC'),
category: categoryNfc,
aliases: ps.aliases?.map(a => a.normalize('NFC')),
license: ps.license,
isSensitive: ps.isSensitive,