diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs index fbc6d56d9..f9e1786df 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Application/LINGYUN/Abp/WebhooksManagement/WebhookSubscriptionAppService.cs @@ -35,7 +35,7 @@ public class WebhookSubscriptionAppService : WebhooksManagementAppServiceBase, I var subscription = new WebhookSubscription( GuidGenerator.Create(), input.WebhookUri, - input.ToWebhookHeadersString(), + input.ToSubscribedWebhooksString(), input.ToWebhookHeadersString(), input.Secret, input.TenantId ?? CurrentTenant.Id) @@ -100,7 +100,7 @@ public class WebhookSubscriptionAppService : WebhooksManagementAppServiceBase, I var inputHeaders = input.ToWebhookHeadersString(); if (!string.Equals(subscription.Headers, inputHeaders, StringComparison.InvariantCultureIgnoreCase)) { - subscription.SetHeaders(input.ToWebhookHeadersString()); + subscription.SetHeaders(inputHeaders); } subscription.SetConcurrencyStampIfNotNull(input.ConcurrencyStamp); diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStore.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStore.cs index e254d86c6..809d64c3f 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStore.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStore.cs @@ -127,7 +127,7 @@ public class DynamicWebhookDefinitionStore : IDynamicWebhookDefinitionStore, ITr protected async virtual Task UpdateInMemoryStoreCache() { var webhookGroupRecords = await WebhookGroupRepository.GetListAsync(); - var webhookRecords = await WebhookRepository.GetListAsync(); + var webhookRecords = await WebhookRepository.GetAvailableListAsync(); await StoreCache.FillAsync(webhookGroupRecords, webhookRecords); } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStoreInMemoryCache.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStoreInMemoryCache.cs index 9f0a40c6a..7d4a5a71b 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStoreInMemoryCache.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/DynamicWebhookDefinitionStoreInMemoryCache.cs @@ -98,10 +98,15 @@ public class DynamicWebhookDefinitionStoreInMemoryCache : WebhookGroupDefinition webhookGroup, WebhookDefinitionRecord webhookRecord) { + ILocalizableString description = null; + if (!webhookRecord.Description.IsNullOrWhiteSpace()) + { + description = LocalizableStringSerializer.Deserialize(webhookRecord.Description); + } var webhook = webhookGroup.AddWebhook( webhookRecord.Name, LocalizableStringSerializer.Deserialize(webhookRecord.DisplayName), - LocalizableStringSerializer.Deserialize(webhookRecord.Description) + description ); WebhookDefinitions[webhook.Name] = webhook; diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/IWebhookDefinitionRecordRepository.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/IWebhookDefinitionRecordRepository.cs index 2c2e90353..c85916b0d 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/IWebhookDefinitionRecordRepository.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.Domain/LINGYUN/Abp/WebhooksManagement/IWebhookDefinitionRecordRepository.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Volo.Abp.Domain.Repositories; @@ -10,4 +11,6 @@ public interface IWebhookDefinitionRecordRepository : IBasicRepository FindByNameAsync( string name, CancellationToken cancellationToken = default); + + Task> GetAvailableListAsync(CancellationToken cancellationToken = default); } diff --git a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookDefinitionRecordRepository.cs b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookDefinitionRecordRepository.cs index fe2db854d..098bf72ac 100644 --- a/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookDefinitionRecordRepository.cs +++ b/aspnet-core/modules/webhooks/LINGYUN.Abp.WebhooksManagement.EntityFrameworkCore/LINGYUN/Abp/WebhooksManagement/EntityFrameworkCore/EfCoreWebhookDefinitionRecordRepository.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using System; +using System.Collections.Generic; using System.Linq; using System.Threading; using System.Threading.Tasks; @@ -18,12 +19,19 @@ public class EfCoreWebhookDefinitionRecordRepository : { } - public async Task FindByNameAsync( + public async virtual Task FindByNameAsync( string name, CancellationToken cancellationToken = default) { return await (await GetDbSetAsync()) .OrderBy(x => x.Id) - .FirstOrDefaultAsync(r => r.Name == name, cancellationToken); + .FirstOrDefaultAsync(r => r.Name == name, GetCancellationToken(cancellationToken)); + } + + public async virtual Task> GetAvailableListAsync(CancellationToken cancellationToken = default) + { + return await (await GetDbSetAsync()) + .Where(x => x.IsEnabled == true) + .ToListAsync(GetCancellationToken(cancellationToken)); } }