Skip to content

Commit

Permalink
Fix incorrect type parameter in SendMoveMessageAsync calls
Browse files Browse the repository at this point in the history
Updated the type parameter of `SendMoveMessageAsync` method calls from `FileEntry<T1>` to `FileEntry<T2>` in `FilesMessageService.cs` for correct target type. This change ensures the method receives the correct type and aligns with the updated parameters used in `FileMoveCopyOperation.cs`.
  • Loading branch information
pavelbannov committed Aug 2, 2024
1 parent bbd4d95 commit b30bd4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Helpers/FilesMessageService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ public async Task SendCopyMessageAsync<T1, T2>(FileEntry<T2> target, Folder<T1>
}
}

public async Task SendMoveMessageAsync<T1, T2>(FileEntry<T1> target, Folder<T1> from, Folder<T2> to, List<Folder<T2>> toParents, bool overwrite,
public async Task SendMoveMessageAsync<T1, T2>(FileEntry<T2> target, Folder<T1> from, Folder<T2> to, List<Folder<T2>> toParents, bool overwrite,
IDictionary<string, StringValues> headers, string[] description)
{
var action = target switch
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ private async Task<List<Folder<TTo>>> MoveOrCopyFoldersAsync<TTo>(IServiceScope

newFolderId = await FolderDao.MoveFolderAsync(folder.Id, toFolderId, CancellationToken);
newFolder = await folderDao.GetFolderAsync(newFolderId);
await filesMessageService.SendMoveMessageAsync(folder, await parentFolderTask, toFolder, toFolderParents, true, _headers, [newFolder.Title, toFolder.Title, toFolder.Id.ToString()]);
await filesMessageService.SendMoveMessageAsync(newFolder, await parentFolderTask, toFolder, toFolderParents, true, _headers, [newFolder.Title, toFolder.Title, toFolder.Id.ToString()]);

if (isToFolder)
{
Expand Down Expand Up @@ -644,7 +644,6 @@ private async Task<List<Folder<TTo>>> MoveOrCopyFoldersAsync<TTo>(IServiceScope
else
{
await fileMarker.RemoveMarkAsNewForAllAsync(folder);
var rootFolder = await FolderDao.GetFolderAsync(folder.RootId);

TTo newFolderId = default;

Expand Down Expand Up @@ -739,7 +738,11 @@ await socketManager.DeleteFolder(folder, action: async () =>
else
{
var parentFolder = await parentFolderTask;
await filesMessageService.SendMoveMessageAsync(folder, parentFolder, toFolder, toFolderParents, true, _headers, [folder.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);
newFolder = await folderDao.GetFolderAsync(newFolderId);
if (newFolder != null)
{
await filesMessageService.SendMoveMessageAsync(newFolder, parentFolder, toFolder, toFolderParents, true, _headers, [folder.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);
}
}


Expand Down Expand Up @@ -925,7 +928,7 @@ private async Task<List<FileEntry<TTo>>> MoveOrCopyFilesAsync<TTo>(IServiceScope
await socketManager.DeleteFileAsync(file, action: async () => newFileId = await FileDao.MoveFileAsync(file.Id, toFolderId, deleteLinks));
newFile = await fileDao.GetFileAsync(newFileId);

await filesMessageService.SendMoveMessageAsync(file, parentFolder, toFolder, toParentFolders, false, _headers, [file.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);
await filesMessageService.SendMoveMessageAsync(newFile, parentFolder, toFolder, toParentFolders, false, _headers, [file.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);

if (file.RootFolderType == FolderType.TRASH && newFile.ThumbnailStatus == Thumbnail.NotRequired)
{
Expand Down Expand Up @@ -1067,7 +1070,7 @@ await socketManager.DeleteFileAsync(file, action: async () =>
await LinkDao.DeleteAllLinkAsync(file.Id);
});

await filesMessageService.SendMoveMessageAsync(file, parentFolder, toFolder, toParentFolders, true, _headers, [file.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);
await filesMessageService.SendMoveMessageAsync(newFile, parentFolder, toFolder, toParentFolders, true, _headers, [file.Title, parentFolder.Title, toFolder.Title, toFolder.Id.ToString()]);

if (ProcessedFile(fileId))
{
Expand Down

0 comments on commit b30bd4a

Please sign in to comment.