diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs index 8847cc3e14..a1c5e89381 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/DaoFactory.cs @@ -70,7 +70,7 @@ public static class DaoFactoryExtension { services.TryAdd(); services.TryAdd(); - services.TryAdd(); + services.TryAdd(); services.TryAdd>(); services.TryAdd, FileDao>(); diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs index a551e5a429..f15a292bc1 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs @@ -46,7 +46,6 @@ internal class FileDao : AbstractDao, IFileDao private readonly IMapper _mapper; private readonly ThumbnailSettings _thumbnailSettings; private readonly IQuotaService _quotaService; - private readonly TagDao _tagDao; public FileDao( ILogger logger, @@ -74,8 +73,7 @@ internal class FileDao : AbstractDao, IFileDao Settings settings, IMapper mapper, ThumbnailSettings thumbnailSettings, - IQuotaService quotaService, - TagDao tagDao) + IQuotaService quotaService) : base( dbContextManager, userManager, @@ -104,7 +102,6 @@ internal class FileDao : AbstractDao, IFileDao _mapper = mapper; _thumbnailSettings = thumbnailSettings; _quotaService = quotaService; - _tagDao = tagDao; } public Task InvalidateCacheAsync(int fileId) @@ -907,14 +904,16 @@ internal class FileDao : AbstractDao, IFileDao } } + var tagDao = _daoFactory.GetTagDao(); + if (toFolderId == trashId && oldParentId.HasValue) { var origin = Tag.Origin(fileId, FileEntryType.File, oldParentId.Value, _authContext.CurrentAccount.ID); - await _tagDao.SaveTags(origin); + await tagDao.SaveTags(origin); } else if (oldParentId == trashId) { - await _tagDao.RemoveTagLinksAsync(fileId, FileEntryType.File, TagType.Origin); + await tagDao.RemoveTagLinksAsync(fileId, FileEntryType.File, TagType.Origin); } await filesDbContext.SaveChangesAsync();