upd: set file user to system when adding emoji

Prevents cluttering of user's drive and fits the custom emoji import which sets the user as system
This commit is contained in:
Mar0xy 2023-11-12 14:00:35 +01:00
parent fd12efddaa
commit 4f0e0f067e
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828

View file

@ -72,6 +72,8 @@ export default class extends Endpoint<typeof meta, typeof paramDef> { // eslint-
const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name); const isDuplicate = await this.customEmojiService.checkDuplicate(ps.name);
if (isDuplicate) throw new ApiError(meta.errors.duplicateName); if (isDuplicate) throw new ApiError(meta.errors.duplicateName);
if (driveFile.user !== null) await this.driveFilesRepository.update(driveFile.id, { user: null });
const emoji = await this.customEmojiService.add({ const emoji = await this.customEmojiService.add({
driveFile, driveFile,
name: ps.name, name: ps.name,