diff --git a/common/ASC.Api.Core/Auth/ScopesRequirement.cs b/common/ASC.Api.Core/Auth/ScopesRequirement.cs index 4d2e1f85bed..a2a88bd9ca6 100644 --- a/common/ASC.Api.Core/Auth/ScopesRequirement.cs +++ b/common/ASC.Api.Core/Auth/ScopesRequirement.cs @@ -25,12 +25,7 @@ // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode namespace ASC.Api.Core.Auth; -public class ScopesRequirement : IAuthorizationRequirement +public class ScopesRequirement(string scopes) : IAuthorizationRequirement { - public string Scopes { get; } - - public ScopesRequirement(string scopes) - { - Scopes = scopes ?? throw new ArgumentNullException(nameof(scopes)); - } + public string Scopes { get; } = scopes ?? throw new ArgumentNullException(nameof(scopes)); } \ No newline at end of file diff --git a/common/ASC.Api.Core/Cors/Services/DynamicCorsPolicyService.cs b/common/ASC.Api.Core/Cors/Services/DynamicCorsPolicyService.cs index 08b4d51c6b5..8ddfa72d815 100644 --- a/common/ASC.Api.Core/Cors/Services/DynamicCorsPolicyService.cs +++ b/common/ASC.Api.Core/Cors/Services/DynamicCorsPolicyService.cs @@ -8,8 +8,7 @@ public class DynamicCorsPolicyService : IDynamicCorsPolicyService private readonly CorsOptions _options; private readonly IDynamicCorsPolicyResolver _dynamicCorsPolicyResolver; - public DynamicCorsPolicyService(IOptions options, - IDynamicCorsPolicyResolver dynamicCorsPolicyResolver) + public DynamicCorsPolicyService(IOptions options, IDynamicCorsPolicyResolver dynamicCorsPolicyResolver) { ArgumentNullException.ThrowIfNull(options); @@ -163,9 +162,9 @@ private static void AddHeaderValues(IList target, IList headerVa return; } - for (var i = 0; i < headerValues.Count; i++) + foreach (var t in headerValues) { - target.Add(headerValues[i]); + target.Add(t); } } diff --git a/common/ASC.Api.Core/Middleware/CommonApiResponse.cs b/common/ASC.Api.Core/Middleware/CommonApiResponse.cs index 9e2fe7ac8b0..38d99856cab 100644 --- a/common/ASC.Api.Core/Middleware/CommonApiResponse.cs +++ b/common/ASC.Api.Core/Middleware/CommonApiResponse.cs @@ -120,7 +120,7 @@ protected internal SuccessApiResponse(HttpContext httpContext, object response) Links = [ - new() { Href = httpContext.Request.GetDisplayUrl(), Action = httpContext.Request.Method } + new Link { Href = httpContext.Request.GetDisplayUrl(), Action = httpContext.Request.Method } ]; } } diff --git a/common/ASC.Common/Caching/KafkaCacheNotify.cs b/common/ASC.Common/Caching/KafkaCacheNotify.cs index 449390abc87..0c5b04ea3ab 100644 --- a/common/ASC.Common/Caching/KafkaCacheNotify.cs +++ b/common/ASC.Common/Caching/KafkaCacheNotify.cs @@ -24,6 +24,8 @@ // content are licensed under the terms of the Creative Commons Attribution-ShareAlike 4.0 // International. See the License terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode +using Confluent.Kafka.Admin; + namespace ASC.Common.Caching; [Singleton] @@ -121,8 +123,8 @@ async Task ActionAsync() //TODO: must add checking exist await adminClient.CreateTopicsAsync( [ - new() - { + new TopicSpecification + { Name = channelName, NumPartitions = 1, ReplicationFactor = 1 @@ -185,7 +187,7 @@ public void Dispose() GC.SuppressFinalize(this); } - protected virtual void Dispose(bool disposing) + protected void Dispose(bool disposing) { if (!_disposedValue) { diff --git a/common/ASC.Common/Threading/DistributedTaskQueue.cs b/common/ASC.Common/Threading/DistributedTaskQueue.cs index 7a876aa0292..209efa4a970 100644 --- a/common/ASC.Common/Threading/DistributedTaskQueue.cs +++ b/common/ASC.Common/Threading/DistributedTaskQueue.cs @@ -43,14 +43,9 @@ public class DistributedTaskQueue(IServiceProvider serviceProvider, /// private int _maxThreadsCount = 1; private string _name; - private int _timeUntilUnregisterInSeconds; private TaskScheduler Scheduler { get; set; } = TaskScheduler.Default; - public int TimeUntilUnregisterInSeconds - { - get => _timeUntilUnregisterInSeconds; - set => _timeUntilUnregisterInSeconds = value; - } + public int TimeUntilUnregisterInSeconds { get; set; } public string Name { diff --git a/common/ASC.Core.Common/Billing/License/LicenseReader.cs b/common/ASC.Core.Common/Billing/License/LicenseReader.cs index c589ecf7921..734cc6558bf 100644 --- a/common/ASC.Core.Common/Billing/License/LicenseReader.cs +++ b/common/ASC.Core.Common/Billing/License/LicenseReader.cs @@ -250,7 +250,7 @@ private async Task LicenseToDBAsync(License license) var tariff = new Tariff { - Quotas = [new(quota.TenantId, 1)], + Quotas = [new Quota(quota.TenantId, 1)], DueDate = license.DueDate }; diff --git a/common/ASC.Core.Common/Billing/TariffService.cs b/common/ASC.Core.Common/Billing/TariffService.cs index 277feddcfb1..8f534ffed14 100644 --- a/common/ASC.Core.Common/Billing/TariffService.cs +++ b/common/ASC.Core.Common/Billing/TariffService.cs @@ -277,7 +277,7 @@ public async Task GetTariffAsync(int tenantId, bool withRequestToPayment tariff = new Tariff { - Quotas = [new(quota.TenantId, 1)], + Quotas = [new Quota(quota.TenantId, 1)], DueDate = DateTime.UtcNow.AddDays(DefaultTrialPeriod) }; diff --git a/common/ASC.Core.Common/Data/DbSettingsManager.cs b/common/ASC.Core.Common/Data/DbSettingsManager.cs index a564399c905..85d6742c4ed 100644 --- a/common/ASC.Core.Common/Data/DbSettingsManager.cs +++ b/common/ASC.Core.Common/Data/DbSettingsManager.cs @@ -207,8 +207,6 @@ private async Task SaveAsync(T settings, int tenantId, Guid userId) whe { context.WebstudioSettings.Remove(s); } - - await context.SaveChangesAsync(); } else { @@ -221,10 +219,10 @@ private async Task SaveAsync(T settings, int tenantId, Guid userId) whe }; await context.AddOrUpdateAsync(q => q.WebstudioSettings, s); - - await context.SaveChangesAsync(); } + await context.SaveChangesAsync(); + await dbSettingsManagerCache.RemoveAsync(key); _cache.Insert(key, settings, _expirationTimeout); diff --git a/common/ASC.Core.Common/HostedSolution.cs b/common/ASC.Core.Common/HostedSolution.cs index 6297d423d1c..59cc4e8e41f 100644 --- a/common/ASC.Core.Common/HostedSolution.cs +++ b/common/ASC.Core.Common/HostedSolution.cs @@ -211,7 +211,7 @@ public async Task SetTariffAsync(int tenant, bool paid) var quota = (await quotaService.GetTenantQuotasAsync()).FirstOrDefault(q => paid ? q.NonProfit : q.Trial); if (quota != null) { - await tariffService.SetTariffAsync(tenant, new Tariff { Quotas = [new(quota.TenantId, 1)], DueDate = DateTime.MaxValue }); + await tariffService.SetTariffAsync(tenant, new Tariff { Quotas = [new Quota(quota.TenantId, 1)], DueDate = DateTime.MaxValue }); } } diff --git a/common/ASC.Core.Common/Notify/Messages/NoticeMessage.cs b/common/ASC.Core.Common/Notify/Messages/NoticeMessage.cs index 026e19a3931..07f50d79c80 100644 --- a/common/ASC.Core.Common/Notify/Messages/NoticeMessage.cs +++ b/common/ASC.Core.Common/Notify/Messages/NoticeMessage.cs @@ -31,9 +31,6 @@ public class NoticeMessage : INoticeMessage [NonSerialized] private readonly List _arguments = []; - [NonSerialized] - private IPattern _pattern; - public NoticeMessage() { } public NoticeMessage(IDirectRecipient recipient, INotifyAction action, string objectID) @@ -64,11 +61,8 @@ public NoticeMessage(IDirectRecipient recipient, string subject, string body, st public IDirectRecipient Recipient { get; private set; } - public IPattern Pattern - { - get => _pattern; - internal set => _pattern = value; - } + [field: NonSerialized] + public IPattern Pattern { get; internal set; } public INotifyAction Action { get; private set; } diff --git a/common/ASC.Core.Common/Notify/RecipientProviderImpl.cs b/common/ASC.Core.Common/Notify/RecipientProviderImpl.cs index 05f65e6a295..1321b303c9c 100644 --- a/common/ASC.Core.Common/Notify/RecipientProviderImpl.cs +++ b/common/ASC.Core.Common/Notify/RecipientProviderImpl.cs @@ -31,27 +31,29 @@ namespace ASC.Core.Notify; [Scope(typeof(IRecipientProvider))] public class RecipientProviderImpl(UserManager userManager) : IRecipientProvider { - public virtual async Task GetRecipientAsync(string id) + public async Task GetRecipientAsync(string id) { - if (TryParseGuid(id, out var recID)) + if (!TryParseGuid(id, out var recID)) { - var user = await userManager.GetUsersAsync(recID); - if (user.Id != Constants.LostUser.Id) - { - return new DirectRecipient(user.Id.ToString(), user.ToString()); - } + return null; + } - var group = await userManager.GetGroupInfoAsync(recID); - if (group.ID != Constants.LostGroupInfo.ID) - { - return new RecipientsGroup(group.ID.ToString(), group.Name); - } + var user = await userManager.GetUsersAsync(recID); + if (user.Id != Constants.LostUser.Id) + { + return new DirectRecipient(user.Id.ToString(), user.ToString()); + } + + var group = await userManager.GetGroupInfoAsync(recID); + if (group.ID != Constants.LostGroupInfo.ID) + { + return new RecipientsGroup(group.ID.ToString(), group.Name); } return null; } - public virtual async Task GetGroupEntriesAsync(IRecipientsGroup group) + public async Task GetGroupEntriesAsync(IRecipientsGroup group) { ArgumentNullException.ThrowIfNull(group); @@ -69,7 +71,7 @@ public virtual async Task GetGroupEntriesAsync(IRecipientsGroup gr return result.ToArray(); } - public virtual async Task GetGroupsAsync(IRecipient recipient) + public async Task GetGroupsAsync(IRecipient recipient) { ArgumentNullException.ThrowIfNull(recipient); @@ -87,17 +89,14 @@ public virtual async Task GetGroupsAsync(IRecipient recipien } else if (recipient is IDirectRecipient) { - foreach (var group in (await userManager.GetUserGroupsAsync(recID, IncludeType.Distinct))) - { - result.Add(new RecipientsGroup(group.ID.ToString(), group.Name)); - } + result.AddRange((await userManager.GetUserGroupsAsync(recID, IncludeType.Distinct)).Select(group => new RecipientsGroup(group.ID.ToString(), group.Name))); } } return result.ToArray(); } - public virtual async Task GetRecipientAddressesAsync(IDirectRecipient recipient, string senderName) + public async Task GetRecipientAddressesAsync(IDirectRecipient recipient, string senderName) { ArgumentNullException.ThrowIfNull(recipient); diff --git a/common/ASC.Core.Common/Notify/TopSubscriptionProvider.cs b/common/ASC.Core.Common/Notify/TopSubscriptionProvider.cs index 76dedd10e46..599eb814e77 100644 --- a/common/ASC.Core.Common/Notify/TopSubscriptionProvider.cs +++ b/common/ASC.Core.Common/Notify/TopSubscriptionProvider.cs @@ -26,9 +26,7 @@ namespace ASC.Notify.Model; -public class TopSubscriptionProvider(IRecipientProvider recipientProvider, - ISubscriptionProvider directSubscriptionProvider) - : ISubscriptionProvider +public class TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscriptionProvider directSubscriptionProvider) : ISubscriptionProvider { private readonly string[] _defaultSenderMethods = []; private readonly ISubscriptionProvider _subscriptionProvider = directSubscriptionProvider ?? throw new ArgumentNullException(nameof(directSubscriptionProvider)); @@ -42,7 +40,7 @@ public TopSubscriptionProvider(IRecipientProvider recipientProvider, ISubscripti } - public virtual async Task GetSubscriptionMethodAsync(INotifyAction action, IRecipient recipient) + public async Task GetSubscriptionMethodAsync(INotifyAction action, IRecipient recipient) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -64,7 +62,7 @@ public virtual async Task GetSubscriptionMethodAsync(INotifyAction act return senders is { Length: > 0 } ? senders : _defaultSenderMethods; } - public virtual async Task GetRecipientsAsync(INotifyAction action, string objectID) + public async Task GetRecipientsAsync(INotifyAction action, string objectID) { ArgumentNullException.ThrowIfNull(action); @@ -75,7 +73,7 @@ public virtual async Task GetRecipientsAsync(INotifyAction action, return recipents.ToArray(); } - public virtual async Task IsUnsubscribeAsync(IDirectRecipient recipient, INotifyAction action, string objectID) + public async Task IsUnsubscribeAsync(IDirectRecipient recipient, INotifyAction action, string objectID) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -84,7 +82,7 @@ public virtual async Task IsUnsubscribeAsync(IDirectRecipient recipient, I } - public virtual async Task SubscribeAsync(INotifyAction action, string objectID, IRecipient recipient) + public async Task SubscribeAsync(INotifyAction action, string objectID, IRecipient recipient) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -92,7 +90,7 @@ public virtual async Task SubscribeAsync(INotifyAction action, string objectID, await _subscriptionProvider.SubscribeAsync(action, objectID, recipient); } - public virtual async Task UnSubscribeAsync(INotifyAction action, string objectID, IRecipient recipient) + public async Task UnSubscribeAsync(INotifyAction action, string objectID, IRecipient recipient) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -114,7 +112,7 @@ public async Task UnSubscribeAsync(INotifyAction action) await _subscriptionProvider.UnSubscribeAsync(action); } - public virtual async Task UnSubscribeAsync(INotifyAction action, IRecipient recipient) + public async Task UnSubscribeAsync(INotifyAction action, IRecipient recipient) { var objects = await GetSubscriptionsAsync(action, recipient); foreach (var objectID in objects) @@ -123,7 +121,7 @@ public virtual async Task UnSubscribeAsync(INotifyAction action, IRecipient reci } } - public virtual async Task UpdateSubscriptionMethodAsync(INotifyAction action, IRecipient recipient, params string[] senderNames) + public async Task UpdateSubscriptionMethodAsync(INotifyAction action, IRecipient recipient, params string[] senderNames) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -132,7 +130,7 @@ public virtual async Task UpdateSubscriptionMethodAsync(INotifyAction action, IR await _subscriptionProvider.UpdateSubscriptionMethodAsync(action, recipient, senderNames); } - public virtual async Task GetSubscriptionRecordAsync(INotifyAction action, IRecipient recipient, string objectID) + public async Task GetSubscriptionRecordAsync(INotifyAction action, IRecipient recipient, string objectID) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); @@ -159,7 +157,7 @@ public virtual async Task GetSubscriptionRecordAsync(INotifyAction actio return subscriptionRecord; } - public virtual async Task GetSubscriptionsAsync(INotifyAction action, IRecipient recipient, bool checkSubscribe = true) + public async Task GetSubscriptionsAsync(INotifyAction action, IRecipient recipient, bool checkSubscribe = true) { ArgumentNullException.ThrowIfNull(action); ArgumentNullException.ThrowIfNull(recipient); diff --git a/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs b/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs index f9ee0cdf79a..0bd33b9a6e5 100644 --- a/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs +++ b/common/ASC.Data.Backup.Core/BackupAjaxHandler.cs @@ -246,7 +246,7 @@ public async Task GetScheduleAsync() } schedule.StorageType = BackupStorageType.ThirdPartyConsumer; - schedule.StorageParams = new(); + schedule.StorageParams = new Dictionary(); foreach (var r in consumer.AdditionalKeys) { schedule.StorageParams.Add(r, await consumer.GetAsync(r)); diff --git a/common/ASC.Data.Storage/StorageHandler.cs b/common/ASC.Data.Storage/StorageHandler.cs index 800f9cb7e99..c2464d85731 100644 --- a/common/ASC.Data.Storage/StorageHandler.cs +++ b/common/ASC.Data.Storage/StorageHandler.cs @@ -76,7 +76,7 @@ public async Task InvokeAsync(HttpContext context, TenantManager tenantManager, return; } - var headers = header != null && header.Length > 0 ? header.Split('&').Select(HttpUtility.UrlDecode).ToList() : []; + var headers = header is { Length: > 0 } ? header.Split('&').Select(HttpUtility.UrlDecode).ToList() : []; if (storage.ContentAsAttachment) { diff --git a/common/ASC.Migration/Migrators/Model/MigrationGroup.cs b/common/ASC.Migration/Migrators/Model/MigrationGroup.cs index 823ed321393..cb5a2b25830 100644 --- a/common/ASC.Migration/Migrators/Model/MigrationGroup.cs +++ b/common/ASC.Migration/Migrators/Model/MigrationGroup.cs @@ -31,7 +31,7 @@ public class MigrationGroup public HashSet UserKeys { get; set; } public string ManagerKey { get; set; } public bool ShouldImport { get; set; } - public virtual MigratingApiGroup ToApiInfo() + public MigratingApiGroup ToApiInfo() { return new MigratingApiGroup { diff --git a/common/ASC.Migration/Migrators/Model/MigrationInfo.cs b/common/ASC.Migration/Migrators/Model/MigrationInfo.cs index 655aecd9e95..8cef7f705dd 100644 --- a/common/ASC.Migration/Migrators/Model/MigrationInfo.cs +++ b/common/ASC.Migration/Migrators/Model/MigrationInfo.cs @@ -43,7 +43,7 @@ public class MigrationInfo public int FailedUsers { get; set; } public List Errors { get; set; } = []; - public virtual MigrationApiInfo ToApiInfo() + public MigrationApiInfo ToApiInfo() { return new MigrationApiInfo { @@ -61,7 +61,7 @@ public virtual MigrationApiInfo ToApiInfo() }; } - public virtual void Merge(MigrationApiInfo apiInfo) + public void Merge(MigrationApiInfo apiInfo) { Users.AddRange(ExistUsers); Users.AddRange(WithoutEmailUsers); diff --git a/common/ASC.Migration/Migrators/Model/MigrationStorage.cs b/common/ASC.Migration/Migrators/Model/MigrationStorage.cs index 9d1318cade8..5a8e84fcd3d 100644 --- a/common/ASC.Migration/Migrators/Model/MigrationStorage.cs +++ b/common/ASC.Migration/Migrators/Model/MigrationStorage.cs @@ -38,7 +38,7 @@ public class MigrationStorage public bool ShouldImportSharedFiles { get; set; } public bool ShouldImportSharedFolders { get; set; } - public virtual MigratingApiFiles ToApiInfo() + public MigratingApiFiles ToApiInfo() { return new MigratingApiFiles { diff --git a/common/ASC.Migration/Migrators/Model/MigrationUser.cs b/common/ASC.Migration/Migrators/Model/MigrationUser.cs index 34797409683..45af5367fbc 100644 --- a/common/ASC.Migration/Migrators/Model/MigrationUser.cs +++ b/common/ASC.Migration/Migrators/Model/MigrationUser.cs @@ -34,7 +34,7 @@ public class MigrationUser(DisplayUserSettingsHelper displayUserSettingsHelper) public bool HasPhoto { get; set; } public string PathToPhoto { get; set; } - public virtual MigratingApiUser ToApiInfo(string key) + public MigratingApiUser ToApiInfo(string key) { return new MigratingApiUser { diff --git a/common/ASC.Migration/Migrators/Provider/Google/GoogleWorkspaceMigrator.cs b/common/ASC.Migration/Migrators/Provider/Google/GoogleWorkspaceMigrator.cs index 9813ea7eb01..c118bd52b7f 100644 --- a/common/ASC.Migration/Migrators/Provider/Google/GoogleWorkspaceMigrator.cs +++ b/common/ASC.Migration/Migrators/Provider/Google/GoogleWorkspaceMigrator.cs @@ -237,7 +237,7 @@ private void ParseGroup(string tmpFolder) private MigrationUser ParseUser(string tmpFolder) { - var user = new MigrationUser(DisplayUserSettingsHelper) { Info = new() }; + var user = new MigrationUser(DisplayUserSettingsHelper) { Info = new UserInfo() }; ParseRootHtml(tmpFolder, user); ParseProfile(tmpFolder, user); diff --git a/common/ASC.Migration/Migrators/Provider/NC/NextcloudWorkspaceMigrator.cs b/common/ASC.Migration/Migrators/Provider/NC/NextcloudWorkspaceMigrator.cs index e65b9ba2121..c78bffe3b6e 100644 --- a/common/ASC.Migration/Migrators/Provider/NC/NextcloudWorkspaceMigrator.cs +++ b/common/ASC.Migration/Migrators/Provider/NC/NextcloudWorkspaceMigrator.cs @@ -239,7 +239,7 @@ private void DbExtractGroup(string dbFile) foreach (var g in groupList) { - var group = new MigrationGroup { Info = new(), UserKeys = [] }; + var group = new MigrationGroup { Info = new GroupInfo(), UserKeys = [] }; group.Info.Name = g.Split(',').First().Trim('\''); MigrationInfo.Groups.Add(group.Info.Name, group); } diff --git a/common/ASC.Migration/Migrators/Provider/WorkspaceMigrator.cs b/common/ASC.Migration/Migrators/Provider/WorkspaceMigrator.cs index e720f2e083e..d10c1ecdd54 100644 --- a/common/ASC.Migration/Migrators/Provider/WorkspaceMigrator.cs +++ b/common/ASC.Migration/Migrators/Provider/WorkspaceMigrator.cs @@ -577,7 +577,7 @@ private void ParseGroup() } var group = new MigrationGroup { - Info = new() + Info = new GroupInfo { Name = row["name"].ToString() }, diff --git a/common/services/ASC.ApiSystem/Controllers/PortalController.cs b/common/services/ASC.ApiSystem/Controllers/PortalController.cs index 4fc0d5d9912..db7c01116c6 100644 --- a/common/services/ASC.ApiSystem/Controllers/PortalController.cs +++ b/common/services/ASC.ApiSystem/Controllers/PortalController.cs @@ -266,7 +266,7 @@ public async ValueTask RegisterAsync(TenantModel model) var tariff = new Tariff { - Quotas = [new(trialQuotaId, 1)], + Quotas = [new Quota(trialQuotaId, 1)], DueDate = dueDate }; await hostedSolution.SetTariffAsync(t.Id, tariff); diff --git a/common/services/ASC.ApiSystem/GlobalUsings.cs b/common/services/ASC.ApiSystem/GlobalUsings.cs index 4d670671a0a..6adde2dac99 100644 --- a/common/services/ASC.ApiSystem/GlobalUsings.cs +++ b/common/services/ASC.ApiSystem/GlobalUsings.cs @@ -34,7 +34,6 @@ global using System.Text.Encodings.Web; global using System.Text.Json.Serialization; global using System.Text.RegularExpressions; -global using System.Web; global using System.Web.Http.Filters; global using ASC.Api.Core; @@ -46,7 +45,6 @@ global using ASC.ApiSystem.Interfaces; global using ASC.ApiSystem.Models; global using ASC.Common; -global using ASC.Common.Caching; global using ASC.Common.Logging; global using ASC.Common.Utils; global using ASC.Core; diff --git a/common/services/ASC.AuditTrail/Repositories/LoginEventsRepository.cs b/common/services/ASC.AuditTrail/Repositories/LoginEventsRepository.cs index 69ae4b33b26..83c5d588e3f 100644 --- a/common/services/ASC.AuditTrail/Repositories/LoginEventsRepository.cs +++ b/common/services/ASC.AuditTrail/Repositories/LoginEventsRepository.cs @@ -117,7 +117,7 @@ public async Task GetLastSuccessEventAsync(int tenantId) (int)MessageAction.LoginSuccesViaTfaApp, (int)MessageAction.LoginSuccessViaApiTfa, - (int)MessageAction.Logout, + (int)MessageAction.Logout }; return await auditTrailContext.LoginEvents diff --git a/common/services/ASC.ElasticSearch/Engine/BaseIndexer.cs b/common/services/ASC.ElasticSearch/Engine/BaseIndexer.cs index 221a4985ca8..32fb692961c 100644 --- a/common/services/ASC.ElasticSearch/Engine/BaseIndexer.cs +++ b/common/services/ASC.ElasticSearch/Engine/BaseIndexer.cs @@ -484,9 +484,8 @@ private Func GetScriptUpdateByQuery(T data, params Ex var source = new StringBuilder(); var parameters = new Dictionary(); - for (var i = 0; i < fields.Length; i++) + foreach (var field in fields) { - var field = fields[i]; var func = field.Compile(); var newValue = func(data); string name; diff --git a/products/ASC.Files/Core/Audit/AuditReportUploader.cs b/products/ASC.Files/Core/Audit/AuditReportUploader.cs index 8f15adcfba1..7ea29f43dfe 100644 --- a/products/ASC.Files/Core/Audit/AuditReportUploader.cs +++ b/products/ASC.Files/Core/Audit/AuditReportUploader.cs @@ -40,7 +40,7 @@ public async Task UploadCsvReport(Stream stream, string reportName) var file = await fileUploader.ExecAsync(await globalFolderHelper.FolderMyAsync, reportName, stream.Length, stream, true); var fileUrl = commonLinkUtility.GetFullAbsolutePath(filesLinkUtility.GetFileWebEditorUrl(file.Id)); - fileUrl += string.Format("&options={{\"codePage\":{0}}}", Encoding.UTF8.CodePage); + fileUrl += $"&options={{\"codePage\":{Encoding.UTF8.CodePage}}}"; return fileUrl; } diff --git a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs index dbb28908a6f..47776786210 100644 --- a/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs +++ b/products/ASC.Files/Core/Core/Dao/TeamlabDao/FileDao.cs @@ -482,8 +482,8 @@ public async Task> SaveFileAsync(File file, Stream fileStream, bo var isNew = false; DbFile toInsert = null; - var cloneStreamForSave = new MemoryStream(); - var streamChange = false; + var cloneStreamForSave = new MemoryStream(); + var streamChange = false; await using (var filesDbContext = await _dbContextFactory.CreateDbContextAsync()) { var parentFolders = await filesDbContext.DbFolderTreesAsync(file.ParentId).ToListAsync(); @@ -497,7 +497,7 @@ await strategy.ExecuteAsync(async () => { await using var tx = await filesDbContext.Database.BeginTransactionAsync(); - if (file.Id == 0) + if (file.Id == 0) { file.Id = await filesDbContext.FileMaxIdAsync() + 1; file.Version = 1; @@ -512,7 +512,7 @@ await strategy.ExecuteAsync(async () => file.ModifiedBy = _authContext.CurrentAccount.ID; file.ModifiedOn = _tenantUtil.DateTimeNow(); - if (file.CreateBy == Guid.Empty) + if (file.CreateBy == Guid.Empty) { file.CreateBy = _authContext.CurrentAccount.ID; } @@ -527,62 +527,62 @@ await strategy.ExecuteAsync(async () => await filesDbContext.DisableCurrentVersionAsync(tenantId, file.Id); } - var fileType = FileUtility.GetFileTypeByFileName(file.Title); + var fileType = FileUtility.GetFileTypeByFileName(file.Title); - if (fileType == FileType.Pdf && file.Category == (int)FilterType.None) - { - var originalCopyStream = new MemoryStream(); - await fileStream.CopyToAsync(originalCopyStream); + if (fileType == FileType.Pdf && file.Category == (int)FilterType.None) + { + var originalCopyStream = new MemoryStream(); + await fileStream.CopyToAsync(originalCopyStream); - var cloneStreamForCheck = await tempStream.CloneMemoryStream(originalCopyStream, 300); - cloneStreamForSave = await tempStream.CloneMemoryStream(originalCopyStream); - streamChange = true; - try - { - if (await fileChecker.CheckExtendedPDFstream(cloneStreamForCheck)) - { - file.Category = (int)FilterType.PdfForm; - } - } - finally + var cloneStreamForCheck = await tempStream.CloneMemoryStream(originalCopyStream, 300); + cloneStreamForSave = await tempStream.CloneMemoryStream(originalCopyStream); + streamChange = true; + try + { + if (await fileChecker.CheckExtendedPDFstream(cloneStreamForCheck)) { - await originalCopyStream.DisposeAsync(); - await cloneStreamForCheck.DisposeAsync(); + file.Category = (int)FilterType.PdfForm; } } - - toInsert = new DbFile - { - Id = file.Id, - Version = file.Version, - VersionGroup = file.VersionGroup, - CurrentVersion = true, - ParentId = file.ParentId, - Title = file.Title, - ContentLength = file.ContentLength, - Category = file.Category != (int)FilterType.None ? file.Category : (int)file.FilterType, - CreateBy = file.CreateBy, - CreateOn = _tenantUtil.DateTimeToUtc(file.CreateOn), - ModifiedBy = file.ModifiedBy, - ModifiedOn = _tenantUtil.DateTimeToUtc(file.ModifiedOn), - ConvertedType = file.ConvertedType, - Comment = file.Comment, - Encrypted = file.Encrypted, - Forcesave = file.Forcesave, - ThumbnailStatus = file.ThumbnailStatus, - TenantId = tenantId - }; - - if (isNew) + finally { - await filesDbContext.Files.AddAsync(toInsert); + await originalCopyStream.DisposeAsync(); + await cloneStreamForCheck.DisposeAsync(); } - else - { - await filesDbContext.AddOrUpdateAsync(r => r.Files, toInsert); - } - await filesDbContext.SaveChangesAsync(); - await tx.CommitAsync(); + } + + toInsert = new DbFile + { + Id = file.Id, + Version = file.Version, + VersionGroup = file.VersionGroup, + CurrentVersion = true, + ParentId = file.ParentId, + Title = file.Title, + ContentLength = file.ContentLength, + Category = file.Category != (int)FilterType.None ? file.Category : (int)file.FilterType, + CreateBy = file.CreateBy, + CreateOn = _tenantUtil.DateTimeToUtc(file.CreateOn), + ModifiedBy = file.ModifiedBy, + ModifiedOn = _tenantUtil.DateTimeToUtc(file.ModifiedOn), + ConvertedType = file.ConvertedType, + Comment = file.Comment, + Encrypted = file.Encrypted, + Forcesave = file.Forcesave, + ThumbnailStatus = file.ThumbnailStatus, + TenantId = tenantId + }; + + if (isNew) + { + await filesDbContext.Files.AddAsync(toInsert); + } + else + { + await filesDbContext.AddOrUpdateAsync(r => r.Files, toInsert); + } + await filesDbContext.SaveChangesAsync(); + await tx.CommitAsync(); }); file.PureTitle = file.Title; @@ -619,26 +619,26 @@ await strategy.ExecuteAsync(async () => var properties = fileProp ?? new EntryProperties { FormFilling = new FormFillingProperties() }; if (!properties.FormFilling.CollectFillForm) { - var inProcessFormFolder = await folderDao.GetFoldersAsync(currentRoom.Id, FolderType.InProcessFormFolder).FirstOrDefaultAsync(); - var readyFormFolder = await folderDao.GetFoldersAsync(currentRoom.Id, FolderType.ReadyFormFolder).FirstOrDefaultAsync(); + var inProcessFormFolder = await folderDao.GetFoldersAsync(currentRoom.Id, FolderType.InProcessFormFolder).FirstOrDefaultAsync(); + var readyFormFolder = await folderDao.GetFoldersAsync(currentRoom.Id, FolderType.ReadyFormFolder).FirstOrDefaultAsync(); - if (inProcessFormFolder == null && readyFormFolder == null) + if (inProcessFormFolder == null && readyFormFolder == null) + { + var (readyFormFolderId, inProcessFormFolderId) = await entryManager.InitSystemFormFillingFolders(currentRoom.Id, folderDao, file.CreateBy); + var systemFormFillingFolders = new List> { - var (readyFormFolderId, inProcessFormFolderId) = await entryManager.InitSystemFormFillingFolders(currentRoom.Id, folderDao, file.CreateBy); - var systemFormFillingFolders = new List> - { - await folderDao.GetFolderAsync(readyFormFolderId), - await folderDao.GetFolderAsync(inProcessFormFolderId) - }; - foreach (var formFolder in systemFormFillingFolders) - { - var a = await fileSharing.GetSharedInfoAsync(formFolder); - var u = a.Where(ace => ace is not { Access: FileShare.FillForms }).Select(ace => ace.Id).ToList(); - - await socketManager.CreateFolderAsync(formFolder, u); - await filesMessageService.SendAsync(MessageAction.FolderCreated, formFolder, formFolder.Title); - } + await folderDao.GetFolderAsync(readyFormFolderId), + await folderDao.GetFolderAsync(inProcessFormFolderId) + }; + foreach (var formFolder in systemFormFillingFolders) + { + var a = await fileSharing.GetSharedInfoAsync(formFolder); + var u = a.Where(ace => ace is not { Access: FileShare.FillForms }).Select(ace => ace.Id).ToList(); + + await socketManager.CreateFolderAsync(formFolder, u); + await filesMessageService.SendAsync(MessageAction.FolderCreated, formFolder, formFolder.Title); } + } properties.FormFilling.StartFilling = true; properties.FormFilling.CollectFillForm = true; properties.FormFilling.OriginalFormId = file.Id; @@ -647,7 +647,7 @@ await folderDao.GetFolderAsync(inProcessFormFolderId) if (file.IsForm) { await socketManager.CreateFormAsync(file, securityContext.CurrentAccount.ID, count <= 1); - } + } } } else @@ -658,36 +658,36 @@ await folderDao.GetFolderAsync(inProcessFormFolderId) throw new Exception(FilesCommonResource.ErrorMessage_UploadToFormRoom); } } - } } + } } if (fileStream != null) - { - try - { - await SaveFileStreamAsync(file, streamChange ? cloneStreamForSave : fileStream, currentFolder); - } - catch (Exception saveException) { try { - if (isNew) + await SaveFileStreamAsync(file, streamChange ? cloneStreamForSave : fileStream, currentFolder); + } + catch (Exception saveException) + { + try { - var stored = await (await globalStore.GetStoreAsync()).IsDirectoryAsync(GetUniqFileDirectory(file.Id)); - await DeleteFileAsync(file.Id, stored, file.GetFileQuotaOwner()); + if (isNew) + { + var stored = await (await globalStore.GetStoreAsync()).IsDirectoryAsync(GetUniqFileDirectory(file.Id)); + await DeleteFileAsync(file.Id, stored, file.GetFileQuotaOwner()); + } + else if (!await IsExistOnStorageAsync(file)) + { + await DeleteVersionAsync(file); + } } - else if (!await IsExistOnStorageAsync(file)) + catch (Exception deleteException) { - await DeleteVersionAsync(file); + throw new Exception(saveException.Message, deleteException); } + throw; } - catch (Exception deleteException) - { - throw new Exception(saveException.Message, deleteException); - } - throw; - } finally { await cloneStreamForSave.DisposeAsync(); diff --git a/products/ASC.Files/Core/Core/Entries/SubmitFormsData.cs b/products/ASC.Files/Core/Core/Entries/SubmitFormsData.cs index b43aa14e365..795d0c56cb3 100644 --- a/products/ASC.Files/Core/Core/Entries/SubmitFormsData.cs +++ b/products/ASC.Files/Core/Core/Entries/SubmitFormsData.cs @@ -112,7 +112,7 @@ List GetData(long start, long stop, DateTime lastIndexed) (int, int, int) GetCount(DateTime lastIndexed) { - return new(0, 0, 0); + return new ValueTuple(0, 0, 0); } } } \ No newline at end of file diff --git a/products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs b/products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs index 2756cc716b9..7060608f8f8 100644 --- a/products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs +++ b/products/ASC.Files/Core/Core/Search/FactoryIndexerFile.cs @@ -158,7 +158,7 @@ List GetData(long start, long stop, DateTime lastIndexed) var count = Queries.FilesCount(filesDbContext, lastIndexed); - return new(count, maxId, minId); + return new ValueTuple(count, maxId, minId); } } diff --git a/products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs b/products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs index 1f5ebb98051..811b1ae7afa 100644 --- a/products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs +++ b/products/ASC.Files/Core/Core/Search/FactoryIndexerFolder.cs @@ -131,7 +131,7 @@ List GetData(long start, long stop, DateTime lastIndexed) var count = Queries.FoldersCount(filesDbContext, lastIndexed); - return new(count, maxId, minId); + return new ValueTuple(count, maxId, minId); } } } diff --git a/products/ASC.Files/Core/Helpers/DocuSignHelper.cs b/products/ASC.Files/Core/Helpers/DocuSignHelper.cs index 8f5ed456aa4..9b7b0d7c875 100644 --- a/products/ASC.Files/Core/Helpers/DocuSignHelper.cs +++ b/products/ASC.Files/Core/Helpers/DocuSignHelper.cs @@ -219,8 +219,8 @@ private async Task GetApiClientAsync(DocuSignAccount account, OA DocumentBase64 = Convert.ToBase64String(fileBytes), DocumentFields = [ - new() { Name = FilesLinkUtility.FolderId, Value = folderId }, - new() { Name = FilesLinkUtility.FileTitle, Value = file.Title } + new NameValue { Name = FilesLinkUtility.FolderId, Value = folderId }, + new NameValue { Name = FilesLinkUtility.FileTitle, Value = file.Title } ], DocumentId = "1", //file.ID.ToString(), FileExtension = FileUtility.GetFileExtension(file.Title), @@ -236,9 +236,9 @@ private async Task CreateEnvelopeAsync(string accountId, Document docume { EnvelopeEvents = [ - new() { EnvelopeEventStatusCode = nameof(DocuSignStatus.Completed) }, - new() { EnvelopeEventStatusCode = nameof(DocuSignStatus.Declined) }, - new() { EnvelopeEventStatusCode = nameof(DocuSignStatus.Voided) } + new EnvelopeEvent { EnvelopeEventStatusCode = nameof(DocuSignStatus.Completed) }, + new EnvelopeEvent { EnvelopeEventStatusCode = nameof(DocuSignStatus.Declined) }, + new EnvelopeEvent { EnvelopeEventStatusCode = nameof(DocuSignStatus.Voided) } ], IncludeDocumentFields = "true", //RecipientEvents = new List @@ -279,7 +279,7 @@ private async Task CreateEnvelopeAsync(string accountId, Document docume { CustomFields = new CustomFields { - TextCustomFields = [new() { Name = UserField, Value = authContext.CurrentAccount.ID.ToString() }] + TextCustomFields = [new TextCustomField { Name = UserField, Value = authContext.CurrentAccount.ID.ToString() }] }, Documents = [document], EmailBlurb = docuSignData.Message, diff --git a/products/ASC.Files/Core/Services/DocumentService/Configuration.cs b/products/ASC.Files/Core/Services/DocumentService/Configuration.cs index d8a408480c6..871240b4730 100644 --- a/products/ASC.Files/Core/Services/DocumentService/Configuration.cs +++ b/products/ASC.Files/Core/Services/DocumentService/Configuration.cs @@ -653,29 +653,18 @@ public Paragraph(List runs) [JsonPropertyName("runs")] public List Runs { get; set; } } -public class Run +public class Run(string text, bool usedInHash = true) { - private readonly bool _usedInHash; - - internal bool UsedInHash => _usedInHash; - - public Run(string text, bool usedInHash = true) - { - FontSize = "26"; - Fill = [124, 124, 124]; - Text = text; - - _usedInHash = usedInHash; - } + internal bool UsedInHash => usedInHash; [JsonPropertyName("fill")] - public int[] Fill { get; set; } + public int[] Fill { get; set; } = [124, 124, 124]; [JsonPropertyName("text")] - public string Text { get; set; } + public string Text { get; set; } = text; [JsonPropertyName("font-size")] - public string FontSize { get; set; } + public string FontSize { get; set; } = "26"; } public class FileReference diff --git a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileDeleteOperation.cs b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileDeleteOperation.cs index 904bb54fa62..21654b360fc 100644 --- a/products/ASC.Files/Core/Services/WCFService/FileOperations/FileDeleteOperation.cs +++ b/products/ASC.Files/Core/Services/WCFService/FileOperations/FileDeleteOperation.cs @@ -114,7 +114,7 @@ protected override async Task DoJob(AsyncServiceScope serviceScope) } if (root != null) { - this[Res] += string.Format("folder_{0}{1}", root.Id, SplitChar); + this[Res] += $"folder_{root.Id}{SplitChar}"; } if (_isEmptyTrash) { diff --git a/products/ASC.Files/Core/Utils/EntryManager.cs b/products/ASC.Files/Core/Utils/EntryManager.cs index 9112353ea33..68b8630ca9e 100644 --- a/products/ASC.Files/Core/Utils/EntryManager.cs +++ b/products/ASC.Files/Core/Utils/EntryManager.cs @@ -208,7 +208,7 @@ public async Task SetFormInfoAsync(IEnumerable> files) if (!files.Any()) { return; -} + } var pdfs = new List>(); @@ -1542,13 +1542,13 @@ public async Task> SaveEditingAsync(T fileId, string fileExtension, s var originalForm = await fileDao.GetFileAsync(originalFormId); await using (await distributedLockProvider.TryAcquireFairLockAsync($"fillform_{roomId}_{originalFormId}")) - { + { var origProperties = await daoFactory.GetFileDao().GetProperties(originalFormId); if (userId.Equals(ASC.Core.Configuration.Constants.Guest.ID) && (origProperties.FormFilling.ResultsFileID == null || Equals(origProperties.FormFilling.ResultsFileID, default(T)))) - { + { await InitFormFillingFolders(file, room, origProperties, folderDao, fileDao, originalForm.CreateBy); origProperties = await daoFactory.GetFileDao().GetProperties(originalFormId); - } + } origProperties.FormFilling.ResultFormNumber++; await fileDao.SaveProperties(originalFormId, origProperties); @@ -1586,12 +1586,12 @@ public async Task> SaveEditingAsync(T fileId, string fileExtension, s File result; if (tmpStream.CanSeek) - { + { pdfFile.ContentLength = tmpStream.Length; result = await fileDao.SaveFileAsync(pdfFile, tmpStream, false); - } - else - { + } + else + { var (buffered, isNew) = await tempStream.TryGetBufferedAsync(tmpStream); try { @@ -1609,7 +1609,7 @@ public async Task> SaveEditingAsync(T fileId, string fileExtension, s await notifyClient.SendFormSubmittedAsync(room, originalForm, pdfFile); if (fillingSessionId != null) - { + { await distributedCache.SetStringAsync(fillingSessionId, result.Id.ToString()); } @@ -1631,7 +1631,7 @@ public async Task> SaveEditingAsync(T fileId, string fileExtension, s ResultsFileID = origProperties.FormFilling.ResultsFileID, ResultFormNumber = origProperties.FormFilling.ResultFormNumber } - }; + }; await fileDao.SaveProperties(result.Id, resProp); var aces = await fileSharing.GetSharedInfoAsync(room); @@ -1652,8 +1652,8 @@ public async Task> SaveEditingAsync(T fileId, string fileExtension, s await fileMarker.RemoveMarkAsNewForAllAsync(file); await linkDao.DeleteAllLinkAsync(file.Id); - } } + } catch(Exception ex) { logger.LogError(ex, "Form submission error"); @@ -2152,14 +2152,14 @@ private async Task CreateFormFillingFolder(string sourceTitle, T parentId, private async Task CreateCsvResult(T resultsFolderId, Guid createBy, string sourceTitle, IFileDao fileDao) { using var textStream = new MemoryStream(Encoding.UTF8.GetBytes("")); - var csvFile = serviceProvider.GetService>(); - csvFile.ParentId = resultsFolderId; - csvFile.Title = Global.ReplaceInvalidCharsAndTruncate(sourceTitle + ".csv"); - csvFile.CreateBy = createBy; + var csvFile = serviceProvider.GetService>(); + csvFile.ParentId = resultsFolderId; + csvFile.Title = Global.ReplaceInvalidCharsAndTruncate(sourceTitle + ".csv"); + csvFile.CreateBy = createBy; - var file = await fileDao.SaveFileAsync(csvFile, textStream, false); + var file = await fileDao.SaveFileAsync(csvFile, textStream, false); - return file.Id; + return file.Id; } private async Task> InitFormFillingProperties(T roomId, string sourceTitle, T sourceFileId, T inProcessFormFolderId, T readyFormFolderId, Guid createBy, EntryProperties properties, IFileDao fileDao, IFolderDao folderDao) diff --git a/products/ASC.Files/Server/Api/EditorController.cs b/products/ASC.Files/Server/Api/EditorController.cs index 63ceae6bedc..d0a07b31188 100644 --- a/products/ASC.Files/Server/Api/EditorController.cs +++ b/products/ASC.Files/Server/Api/EditorController.cs @@ -228,7 +228,7 @@ public async Task> OpenEditAsync(OpenEditRequestDto inDto inDto.EditorType = inDto.EditorType == EditorType.Mobile ? inDto.EditorType : EditorType.Embedded; file = formDraft; - fillingSessionId = string.Format("{0}_{1}", formDraft.Id, securityContext.CurrentAccount.ID); + fillingSessionId = $"{formDraft.Id}_{securityContext.CurrentAccount.ID}"; } else { diff --git a/web/ASC.Web.Api/Api/Settings/LicenseController.cs b/web/ASC.Web.Api/Api/Settings/LicenseController.cs index 768a2c7cb88..255554a9815 100644 --- a/web/ASC.Web.Api/Api/Settings/LicenseController.cs +++ b/web/ASC.Web.Api/Api/Settings/LicenseController.cs @@ -169,7 +169,7 @@ public async Task ActivateTrialAsync() var tariff = new Tariff { - Quotas = [new(quota.TenantId, 1)], + Quotas = [new Quota(quota.TenantId, 1)], DueDate = DateTime.Today.AddDays(DEFAULT_TRIAL_PERIOD) }; diff --git a/web/ASC.Web.Api/ApiModels/ResponseDto/LoginEventDto.cs b/web/ASC.Web.Api/ApiModels/ResponseDto/LoginEventDto.cs index 32a809084be..d89a813683a 100644 --- a/web/ASC.Web.Api/ApiModels/ResponseDto/LoginEventDto.cs +++ b/web/ASC.Web.Api/ApiModels/ResponseDto/LoginEventDto.cs @@ -26,87 +26,70 @@ namespace ASC.Web.Api.ApiModel.ResponseDto; -public class LoginEventDto +public class LoginEventDto(LoginEvent loginEvent, ApiDateTimeHelper apiDateTimeHelper) { /// /// ID /// - public int Id { get; set; } + public int Id { get; set; } = loginEvent.Id; /// /// Date /// - public ApiDateTime Date { get; set; } + public ApiDateTime Date { get; set; } = apiDateTimeHelper.Get(loginEvent.Date); /// /// User /// - public string User { get; set; } + public string User { get; set; } = loginEvent.UserName; /// /// User ID /// - public Guid UserId { get; set; } + public Guid UserId { get; set; } = loginEvent.UserId; /// /// Login /// - public string Login { get; set; } + public string Login { get; set; } = loginEvent.Login; /// /// Action /// - public string Action { get; set; } + public string Action { get; set; } = loginEvent.ActionText; /// /// Action ID /// - public MessageAction ActionId { get; set; } + public MessageAction ActionId { get; set; } = (MessageAction)loginEvent.Action; /// /// IP /// - public string IP { get; set; } + public string IP { get; set; } = loginEvent.IP; /// /// Country /// - public string Country { get; set; } + public string Country { get; set; } = loginEvent.Country; /// /// City /// - public string City { get; set; } + public string City { get; set; } = loginEvent.City; /// /// Browser /// - public string Browser { get; set; } + public string Browser { get; set; } = loginEvent.Browser; /// /// Platform /// - public string Platform { get; set; } + public string Platform { get; set; } = loginEvent.Platform; /// /// Page /// - public string Page { get; set; } - - public LoginEventDto(LoginEvent loginEvent, ApiDateTimeHelper apiDateTimeHelper) - { - Id = loginEvent.Id; - Date = apiDateTimeHelper.Get(loginEvent.Date); - User = loginEvent.UserName; - UserId = loginEvent.UserId; - Login = loginEvent.Login; - Action = loginEvent.ActionText; - ActionId = (MessageAction)loginEvent.Action; - IP = loginEvent.IP; - Country = loginEvent.Country; - City = loginEvent.City; - Browser = loginEvent.Browser; - Platform = loginEvent.Platform; - Page = loginEvent.Page; - } + public string Page { get; set; } = loginEvent.Page; } \ No newline at end of file diff --git a/web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs b/web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs index 1d2b74fce64..bb9517f72c5 100644 --- a/web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs +++ b/web/ASC.Web.Core/Users/UserPhotoThumbnailManager.cs @@ -211,15 +211,15 @@ public async Task> ThumbnailList() { return [ - new() { Size = UserPhotoManager.RetinaFotoSize, ImgUrl = await userPhotoManager.GetRetinaPhotoURL(userId) }, + new ThumbnailItem { Size = UserPhotoManager.RetinaFotoSize, ImgUrl = await userPhotoManager.GetRetinaPhotoURL(userId) }, - new() { Size = UserPhotoManager.MaxFotoSize, ImgUrl = await userPhotoManager.GetMaxPhotoURL(userId) }, + new ThumbnailItem { Size = UserPhotoManager.MaxFotoSize, ImgUrl = await userPhotoManager.GetMaxPhotoURL(userId) }, - new() { Size = UserPhotoManager.BigFotoSize, ImgUrl = await userPhotoManager.GetBigPhotoURL(userId) }, + new ThumbnailItem { Size = UserPhotoManager.BigFotoSize, ImgUrl = await userPhotoManager.GetBigPhotoURL(userId) }, - new() { Size = UserPhotoManager.MediumFotoSize, ImgUrl = await userPhotoManager.GetMediumPhotoURL(userId) }, + new ThumbnailItem { Size = UserPhotoManager.MediumFotoSize, ImgUrl = await userPhotoManager.GetMediumPhotoURL(userId) }, - new() { Size = UserPhotoManager.SmallFotoSize, ImgUrl = await userPhotoManager.GetSmallPhotoURL(userId) } + new ThumbnailItem { Size = UserPhotoManager.SmallFotoSize, ImgUrl = await userPhotoManager.GetSmallPhotoURL(userId) } ]; } diff --git a/web/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs b/web/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs index 8381e87d558..23f8dc4b632 100644 --- a/web/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs +++ b/web/ASC.Web.Core/WhiteLabel/TenantLogoManager.cs @@ -55,7 +55,7 @@ public async Task GetFaviconAsync(bool timeParam, bool dark) if (timeParam) { var now = DateTime.Now; - faviconPath = string.Format("{0}?t={1}", faviconPath, now.Ticks); + faviconPath = $"{faviconPath}?t={now.Ticks}"; } } else