Skip to content

Commit

Permalink
Refactor code for improved clarity and consistency
Browse files Browse the repository at this point in the history
This commit updates various code sections to eliminate unnecessary punctuation, aligns collection initializations with standard syntax, and improves conditional expressions for enhanced readability. These changes enhance code clarity, maintainability, and consistency across the project without altering functionality.
pavelbannov committed Dec 9, 2024
1 parent e9d6a36 commit a9a76a7
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion common/ASC.Common/Utils/SwaggerCustomFilter.cs
Original file line number Diff line number Diff line change
@@ -221,7 +221,7 @@ private OpenApiSchema UpdateSchema(Type checkType, OpenApiSchema result)

if (enumDataString.Count > 0)
{
result.OneOf = new List<OpenApiSchema>()
result.OneOf = new List<OpenApiSchema>
{
new()
{
Original file line number Diff line number Diff line change
@@ -395,7 +395,7 @@ public async Task<ConfigurationDto<T>> Convert(Configuration<T> source, File<T>
ErrorMessage = source.Error
};

result.EditorUrl = FilesLinkUtility.AddQueryString(result.EditorUrl, new Dictionary<string, string>() {
result.EditorUrl = FilesLinkUtility.AddQueryString(result.EditorUrl, new Dictionary<string, string> {
{ FilesLinkUtility.ShardKey, result.Document?.Key }
});

2 changes: 1 addition & 1 deletion products/ASC.Files/Core/GlobalUsings.cs
Original file line number Diff line number Diff line change
@@ -49,7 +49,7 @@
global using System.Text.Unicode;
global using System.Web;
global using System.Xml;
global using ASC.Api.Collections;

global using ASC.Api.Core;
global using ASC.Api.Core.Extensions;
global using ASC.Api.Core.Model;
6 changes: 3 additions & 3 deletions products/ASC.Files/Core/Helpers/DocumentService.cs
Original file line number Diff line number Diff line change
@@ -148,7 +148,7 @@ public static string GenerateRevisionId(string expectedKey)

documentRevisionId = GenerateRevisionId(documentRevisionId);

documentConverterUrl = FilesLinkUtility.AddQueryString(documentConverterUrl, new Dictionary<string, string>() {
documentConverterUrl = FilesLinkUtility.AddQueryString(documentConverterUrl, new Dictionary<string, string> {
{ FilesLinkUtility.ShardKey, documentRevisionId }
});

@@ -231,7 +231,7 @@ public static async Task<CommandResponse> CommandRequestAsync(FileUtility fileUt
string signatureSecret,
IHttpClientFactory clientFactory)
{
documentTrackerUrl = FilesLinkUtility.AddQueryString(documentTrackerUrl, new Dictionary<string, string>() {
documentTrackerUrl = FilesLinkUtility.AddQueryString(documentTrackerUrl, new Dictionary<string, string> {
{ FilesLinkUtility.ShardKey, documentRevisionId }
});

@@ -344,7 +344,7 @@ public static async Task<CommandResponse> CommandRequestAsync(FileUtility fileUt
string signatureSecret,
IHttpClientFactory clientFactory)
{
docbuilderUrl = FilesLinkUtility.AddQueryString(docbuilderUrl, new Dictionary<string, string>() {
docbuilderUrl = FilesLinkUtility.AddQueryString(docbuilderUrl, new Dictionary<string, string> {
{ FilesLinkUtility.ShardKey, requestKey }
});

Original file line number Diff line number Diff line change
@@ -376,7 +376,7 @@ public Options GetOptions<T>(Folder<T> room)
}
paragrahs.Add(new Paragraph(runs));

var options = new Options()
var options = new Options
{
WatermarkOnDraw = new WatermarkOnDraw(watermarkSettings.ImageWidth * watermarkSettings.ImageScale / 100, watermarkSettings.ImageHeight * watermarkSettings.ImageScale / 100 , watermarkSettings.ImageUrl, watermarkSettings.Rotate, paragrahs)
};
Original file line number Diff line number Diff line change
@@ -452,7 +452,7 @@ private static (List<FilesDownloadOperationItem<int>>, List<FilesDownloadOperati
if (item.Id.TryGetProperty("password", out var p))
{
password = p.GetString();
};
}

if (key.ValueKind == JsonValueKind.Number)
{
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Utils/EntryManager.cs
Original file line number Diff line number Diff line change
@@ -1556,7 +1556,7 @@ public async Task<File<T>> SaveEditingAsync<T>(T fileId, string fileExtension, s
var resultFolder = await folderDao.GetFolderAsync(origProperties.FormFilling.ResultsFolderId);
var resultFile = await fileDao.GetFileAsync(origProperties.FormFilling.ResultsFileID);

if (resultFolder == null || resultFolder.FolderType != FolderType.FormFillingFolderDone)
if (resultFolder is not { FolderType: FolderType.FormFillingFolderDone })
{
logger.LogDebug("Result folder: {Folder} not found.", origProperties.FormFilling.ResultsFolderId);

0 comments on commit a9a76a7

Please sign in to comment.