[backend/api] Delete DriveFile associated with Emoji if possible

This commit is contained in:
pancakes 2024-06-25 19:06:50 +10:00 committed by Iceshrimp development
parent 15ad2e438d
commit 31c17b333a

View file

@ -66,6 +66,12 @@ public partial class EmojiService(DatabaseContext db, DriveService driveSvc, Sys
var emojiId = emoji.Id;
var driveFile = await db.DriveFiles.FirstOrDefaultAsync(p => p.Url == emoji.OriginalUrl);
if (driveFile != null)
{
await driveSvc.RemoveFile(driveFile.Id);
}
db.Remove(emoji);
await db.SaveChangesAsync();