Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature/remove item list #287

Merged
merged 6 commits into from
Jun 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion products/ASC.CRM/Server/Api/CasesController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ public IEnumerable<ContactDto> GetCasesMembers(int caseid)
var contacts = _daoFactory.GetContactDao().GetContacts(contactIDs);

return contactIDs == null
? new ItemList<ContactDto>()
? new List<ContactDto>()
: _mapper.Map<List<Contact>, List<ContactDto>>(contacts);
}

Expand Down
126 changes: 63 additions & 63 deletions products/ASC.Files/Core/Core/FileStorageService.cs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Helpers/DocuSignHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ public class DocuSignData

public string Name { get; set; }

public ItemList<Guid> Users { get; set; }
public List<Guid> Users { get; set; }
}

public enum DocuSignStatus
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ public string Uploaded
get { return File.CreateOnString; }
}

public ItemList<AceShortWrapper> SharingSettings
public List<AceShortWrapper> SharingSettings
{
set { }
get
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class FileEntrySerializer
static FileEntrySerializer()
{
serializers[typeof(File<>)] = new DataContractSerializer(typeof(File<>));
//serializers[typeof(ItemList<FileEntry<>>)] = new DataContractSerializer(typeof(ItemList<FileEntry<>>));
//serializers[typeof(List<FileEntry<>>)] = new DataContractSerializer(typeof(List<FileEntry<>>));
serializers[typeof(DataWrapper<>)] = new DataContractSerializer(typeof(DataWrapper<>));

//if (WorkContext.IsMono && !string.IsNullOrEmpty(WorkContext.MonoVersion))
Expand All @@ -54,7 +54,7 @@ static FileEntrySerializer()
// if (2 <= version.Length && (Convert.ToInt32(version[0]) * 1000 + Convert.ToInt32(version[1])) < 4002)
// {
// oldMonoSerializer = true;
// serializers[typeof(ItemList<FileEntry>)] = new DataContractSerializer(typeof(ItemList<FileEntry>), Type.EmptyTypes, ushort.MaxValue, false, false, null, new FileEntryResolver());
// serializers[typeof(List<FileEntry>)] = new DataContractSerializer(typeof(List<FileEntry>), Type.EmptyTypes, ushort.MaxValue, false, false, null, new FileEntryResolver());
// serializers[typeof(DataWrapper)] = new DataContractSerializer(typeof(DataWrapper), Type.EmptyTypes, ushort.MaxValue, false, false, null, new FileEntryResolver());
// }
//}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public FileOperationsManager(TempStream tempStream, DistributedTaskQueueOptionsM
ServiceProvider = serviceProvider;
}

public ItemList<FileOperationResult> GetOperationResults(Guid userId)
public List<FileOperationResult> GetOperationResults(Guid userId)
{
var operations = tasks.GetTasks();
var processlist = Process.GetProcesses();
Expand Down Expand Up @@ -91,10 +91,10 @@ public ItemList<FileOperationResult> GetOperationResults(Guid userId)
})
.ToList();

return new ItemList<FileOperationResult>(results);
return new List<FileOperationResult>(results);
}

public ItemList<FileOperationResult> CancelOperations(Guid userId)
public List<FileOperationResult> CancelOperations(Guid userId)
{
var operations = tasks.GetTasks()
.Where(t => t.GetProperty<Guid>(FileOperation.OWNER) == userId);
Expand All @@ -108,15 +108,15 @@ public ItemList<FileOperationResult> CancelOperations(Guid userId)
}


public ItemList<FileOperationResult> MarkAsRead(Guid userId, Tenant tenant, IEnumerable<JsonElement> folderIds, IEnumerable<JsonElement> fileIds)
public List<FileOperationResult> MarkAsRead(Guid userId, Tenant tenant, IEnumerable<JsonElement> folderIds, IEnumerable<JsonElement> fileIds)
{
var op1 = new FileMarkAsReadOperation<int>(ServiceProvider, new FileMarkAsReadOperationData<int>(folderIds.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), fileIds.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), tenant));
var op2 = new FileMarkAsReadOperation<string>(ServiceProvider, new FileMarkAsReadOperationData<string>(folderIds.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), fileIds.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), tenant));
var op = new FileMarkAsReadOperation(ServiceProvider, op2, op1);
return QueueTask(userId, op);
}

public ItemList<FileOperationResult> Download(Guid userId, Tenant tenant, Dictionary<JsonElement, string> folders, Dictionary<JsonElement, string> files, IDictionary<string, StringValues> headers)
public List<FileOperationResult> Download(Guid userId, Tenant tenant, Dictionary<JsonElement, string> folders, Dictionary<JsonElement, string> files, IDictionary<string, StringValues> headers)
{
var operations = tasks.GetTasks()
.Where(t => t.GetProperty<Guid>(FileOperation.OWNER) == userId)
Expand All @@ -134,7 +134,7 @@ public ItemList<FileOperationResult> Download(Guid userId, Tenant tenant, Dictio
return QueueTask(userId, op);
}

public ItemList<FileOperationResult> MoveOrCopy(Guid userId, Tenant tenant, IEnumerable<JsonElement> folders, IEnumerable<JsonElement> files, JsonElement destFolderId, bool copy, FileConflictResolveType resolveType, bool holdResult, IDictionary<string, StringValues> headers)
public List<FileOperationResult> MoveOrCopy(Guid userId, Tenant tenant, IEnumerable<JsonElement> folders, IEnumerable<JsonElement> files, JsonElement destFolderId, bool copy, FileConflictResolveType resolveType, bool holdResult, IDictionary<string, StringValues> headers)
{
var op1 = new FileMoveCopyOperation<int>(ServiceProvider, new FileMoveCopyOperationData<int>(folders.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), files.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), tenant, destFolderId, copy, resolveType, holdResult, headers));
var op2 = new FileMoveCopyOperation<string>(ServiceProvider, new FileMoveCopyOperationData<string>(folders.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), files.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), tenant, destFolderId, copy, resolveType, holdResult, headers));
Expand All @@ -143,13 +143,13 @@ public ItemList<FileOperationResult> MoveOrCopy(Guid userId, Tenant tenant, IEnu
return QueueTask(userId, op);
}

public ItemList<FileOperationResult> Delete<T>(Guid userId, Tenant tenant, IEnumerable<T> folders, IEnumerable<T> files, bool ignoreException, bool holdResult, bool immediately, IDictionary<string, StringValues> headers)
public List<FileOperationResult> Delete<T>(Guid userId, Tenant tenant, IEnumerable<T> folders, IEnumerable<T> files, bool ignoreException, bool holdResult, bool immediately, IDictionary<string, StringValues> headers)
{
var op = new FileDeleteOperation<T>(ServiceProvider, new FileDeleteOperationData<T>(folders, files, tenant, holdResult, ignoreException, immediately, headers));
return QueueTask(userId, op);
}

public ItemList<FileOperationResult> Delete(Guid userId, Tenant tenant, IEnumerable<JsonElement> folders, IEnumerable<JsonElement> files, bool ignoreException, bool holdResult, bool immediately, IDictionary<string, StringValues> headers)
public List<FileOperationResult> Delete(Guid userId, Tenant tenant, IEnumerable<JsonElement> folders, IEnumerable<JsonElement> files, bool ignoreException, bool holdResult, bool immediately, IDictionary<string, StringValues> headers)
{
var op1 = new FileDeleteOperation<int>(ServiceProvider, new FileDeleteOperationData<int>(folders.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), files.Where(r => r.ValueKind == JsonValueKind.Number).Select(r => r.GetInt32()), tenant, holdResult, ignoreException, immediately, headers));
var op2 = new FileDeleteOperation<string>(ServiceProvider, new FileDeleteOperationData<string>(folders.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), files.Where(r => r.ValueKind == JsonValueKind.String).Select(r => r.GetString()), tenant, holdResult, ignoreException, immediately, headers));
Expand All @@ -159,13 +159,13 @@ public ItemList<FileOperationResult> Delete(Guid userId, Tenant tenant, IEnumera
}


private ItemList<FileOperationResult> QueueTask(Guid userId, FileOperation op)
private List<FileOperationResult> QueueTask(Guid userId, FileOperation op)
{
tasks.QueueTask(op.RunJob, op.GetDistributedTask());
return GetOperationResults(userId);
}

private ItemList<FileOperationResult> QueueTask<T, TId>(Guid userId, FileOperation<T, TId> op) where T : FileOperationData<TId>
private List<FileOperationResult> QueueTask<T, TId>(Guid userId, FileOperation<T, TId> op) where T : FileOperationData<TId>
{
tasks.QueueTask(op.RunJob, op.GetDistributedTask());
return GetOperationResults(userId);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public class AceCollection<T>
public IEnumerable<T> Files { get; set; }
public IEnumerable<T> Folders { get; set; }

public ItemList<AceWrapper> Aces { get; set; }
public List<AceWrapper> Aces { get; set; }

public string Message { get; set; }
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
*/


using System.Collections.Generic;
using System.Text.Json.Serialization;

using ASC.Files.Core;
Expand All @@ -32,12 +33,12 @@ namespace ASC.Web.Files.Services.WCFService
{
public class DataWrapper<T>
{
public ItemList<FileEntry> Entries { get; set; }
public List<FileEntry> Entries { get; set; }

public int Total { get; set; }

[JsonPropertyName("path_parts")]
public ItemList<object> FolderPathParts { get; set; }
public List<object> FolderPathParts { get; set; }

[JsonPropertyName("folder_info")]
public Folder<T> FolderInfo { get; set; }
Expand Down
12 changes: 6 additions & 6 deletions products/ASC.Files/Core/Utils/FileSharing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -432,7 +432,7 @@ public List<AceWrapper> GetSharedInfo<T>(FileEntry<T> entry)
return result;
}

public ItemList<AceWrapper> GetSharedInfo<T>(IEnumerable<T> fileIds, IEnumerable<T> folderIds)
public List<AceWrapper> GetSharedInfo<T>(IEnumerable<T> fileIds, IEnumerable<T> folderIds)
{
if (!AuthContext.IsAuthenticated)
{
Expand Down Expand Up @@ -542,26 +542,26 @@ public ItemList<AceWrapper> GetSharedInfo<T>(IEnumerable<T> fileIds, IEnumerable
result = new List<AceWrapper> { linkAce }.Concat(result).ToList();
}

return new ItemList<AceWrapper>(result);
return new List<AceWrapper>(result);
}

public ItemList<AceShortWrapper> GetSharedInfoShortFile<T>(T fileID)
public List<AceShortWrapper> GetSharedInfoShortFile<T>(T fileID)
{
var aces = GetSharedInfo(new List<T> { fileID}, new List<T>());

return GetAceShortWrappers(aces);
}

public ItemList<AceShortWrapper> GetSharedInfoShortFolder<T>(T folderId)
public List<AceShortWrapper> GetSharedInfoShortFolder<T>(T folderId)
{
var aces = GetSharedInfo(new List<T>(), new List<T> { folderId });

return GetAceShortWrappers(aces);
}

private ItemList<AceShortWrapper> GetAceShortWrappers(ItemList<AceWrapper> aces)
private List<AceShortWrapper> GetAceShortWrappers(List<AceWrapper> aces)
{
return new ItemList<AceShortWrapper>(aces
return new List<AceShortWrapper>(aces
.Where(aceWrapper => !aceWrapper.SubjectId.Equals(FileConstant.ShareLinkId) || aceWrapper.Share != FileShare.Restrict)
.Select(aceWrapper => new AceShortWrapper(aceWrapper)));
}
Expand Down
8 changes: 4 additions & 4 deletions products/ASC.Files/Server/Helpers/FilesControllerHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ public IEnumerable<ConversationResult<T>> StartConversion(T fileId)

public IEnumerable<ConversationResult<T>> CheckConversion(T fileId, bool start)
{
return FileStorageService.CheckConversion(new ItemList<ItemList<string>>
return FileStorageService.CheckConversion(new List<List<string>>
{
new ItemList<string> { fileId.ToString(), "0", start.ToString() }
new List<string> { fileId.ToString(), "0", start.ToString() }
})
.Select(r =>
{
Expand Down Expand Up @@ -550,7 +550,7 @@ public IEnumerable<FileShareWrapper> SetSecurityInfo(IEnumerable<T> fileIds, IEn
{
if (share != null && share.Any())
{
var list = new ItemList<AceWrapper>(share.Select(FileShareParamsHelper.ToAceObject));
var list = new List<AceWrapper>(share.Select(FileShareParamsHelper.ToAceObject));
var aceCollection = new AceCollection<T>
{
Files = fileIds,
Expand Down Expand Up @@ -578,7 +578,7 @@ public string GenerateSharedLink(T fileId, FileShare share)
var sharedInfo = FileStorageService.GetSharedInfo(new List<T> { fileId }, new List<T> { }).Find(r => r.SubjectId == FileConstant.ShareLinkId);
if (sharedInfo == null || sharedInfo.Share != share)
{
var list = new ItemList<AceWrapper>
var list = new List<AceWrapper>
{
new AceWrapper
{
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Tests/SharedWithMeTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ private async Task WaitLongOperation(FileOperationWraper result, string assertEr
return;
}

ItemList<FileOperationResult> statuses;
List<FileOperationResult> statuses;
while (true)
{
statuses = FileStorageService.GetTasksStatuses();
Expand Down
7 changes: 4 additions & 3 deletions products/ASC.Files/Tests/Trash.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Threading;

using ASC.Api.Documents;
Expand Down Expand Up @@ -52,9 +53,9 @@ public void CreateFileReturnsFolderWrapper(string fileTitle)
[Order(2)]
public void DeleteFileFromTrash()
{
var Empty = FilesControllerHelper.EmptyTrash();
ItemList<FileOperationResult> statuses;
var Empty = FilesControllerHelper.EmptyTrash();
List<FileOperationResult> statuses;

while (true)
{
Expand Down