mirror of
https://codeberg.org/yeentown/barkey
synced 2024-11-25 17:35:12 +00:00
delete old emoji file when replaced - fixes #608
it's the same code that 5f7fc54ee9
added
to `delete` and `deleteBulk`, with the extra check that we're not
deleting the same file we're setting
This commit is contained in:
parent
5496aa27db
commit
1e86cba7dc
1 changed files with 7 additions and 0 deletions
|
@ -142,6 +142,13 @@ export class CustomEmojiService implements OnApplicationShutdown {
|
||||||
|
|
||||||
this.localEmojisCache.refresh();
|
this.localEmojisCache.refresh();
|
||||||
|
|
||||||
|
if (data.driveFile != null) {
|
||||||
|
const file = await this.driveFilesRepository.findOneBy({ url: emoji.originalUrl, userHost: emoji.host ? emoji.host : IsNull() });
|
||||||
|
if (file && file.id != data.driveFile.id) {
|
||||||
|
await this.driveService.deleteFile(file, false, moderator ? moderator : undefined);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const packed = await this.emojiEntityService.packDetailed(emoji.id);
|
const packed = await this.emojiEntityService.packDetailed(emoji.id);
|
||||||
|
|
||||||
if (emoji.name === data.name) {
|
if (emoji.name === data.name) {
|
||||||
|
|
Loading…
Reference in a new issue