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.
  • Loading branch information
pavelbannov committed Dec 9, 2024
1 parent e9d6a36 commit a9a76a7
Show file tree
Hide file tree
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
Expand Up @@ -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()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
});

Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
6 changes: 3 additions & 3 deletions products/ASC.Files/Core/Helpers/DocumentService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
});

Expand Down Expand Up @@ -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 }
});

Expand Down Expand Up @@ -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 }
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
2 changes: 1 addition & 1 deletion products/ASC.Files/Core/Utils/EntryManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a9a76a7

Please sign in to comment.