From ab3438e28504a8ab31080273287d4b8812c7ba68 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 22 Apr 2020 11:59:44 +0200 Subject: [PATCH] Fixed full text book and webhook. --- .../Actions/Webhook/WebhookActionHandler.cs | 4 --- .../Contents/Text/TextIndexingProcess.cs | 4 --- .../Apps/AppContributorsController.cs | 2 +- .../Contents/Text/TextIndexerTestsBase.cs | 36 +++++++++++++++++++ 4 files changed, 37 insertions(+), 9 deletions(-) diff --git a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs index 002d1f4a5..51ed32f40 100644 --- a/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs +++ b/backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs @@ -5,7 +5,6 @@ // All rights reserved. Licensed under the MIT license. // ========================================================================== -using System; using System.Net.Http; using System.Text; using System.Threading; @@ -18,7 +17,6 @@ namespace Squidex.Extensions.Actions.Webhook { public sealed class WebhookActionHandler : RuleActionHandler { - private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(2); private readonly IHttpClientFactory httpClientFactory; public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) @@ -59,8 +57,6 @@ namespace Squidex.Extensions.Actions.Webhook { using (var httpClient = httpClientFactory.CreateClient()) { - httpClient.Timeout = DefaultTimeout; - var request = new HttpRequestMessage(HttpMethod.Post, job.RequestUrl) { Content = new StringContent(job.RequestBody, Encoding.UTF8, "application/json") diff --git a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs index 3c5046491..784d9456c 100644 --- a/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs +++ b/backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs @@ -148,8 +148,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text ServeAll = false, ServePublished = true }); - - state.DocIdForPublished = state.DocIdCurrent; } else { @@ -164,8 +162,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text ServePublished = isPublished, Texts = data.ToTexts() }); - - state.DocIdForPublished = state.DocIdNew; } await textIndexerState.SetAsync(state); diff --git a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs index a9a4c5488..edb158c53 100644 --- a/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs +++ b/backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs @@ -87,7 +87,7 @@ namespace Squidex.Areas.Api.Controllers.Apps } /// - /// Remove contributor from app. + /// Remove contributor. /// /// The name of the app. /// The id of the contributor. diff --git a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs index 3225afa7d..e67d9d331 100644 --- a/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs +++ b/backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs @@ -99,6 +99,23 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text ); } + [Fact] + public async Task Should_update_draft_only_multiple_times() + { + await TestCombinations( + Create(ids1[0], "iv", "V1"), + + Update(ids1[0], "iv", "V2"), + Update(ids1[0], "iv", "V3"), + + Search(expected: null, text: "V2", target: SearchScope.All), + Search(expected: null, text: "V2", target: SearchScope.Published), + + Search(expected: ids1, text: "V3", target: SearchScope.All), + Search(expected: null, text: "V3", target: SearchScope.Published) + ); + } + [Fact] public async Task Should_also_serve_published_after_publish() { @@ -130,6 +147,25 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text ); } + [Fact] + public async Task Should_also_update_published_content_multiple_times() + { + await TestCombinations( + Create(ids1[0], "iv", "V1"), + + Publish(ids1[0]), + + Update(ids1[0], "iv", "V2"), + Update(ids1[0], "iv", "V3"), + + Search(expected: null, text: "V2", target: SearchScope.All), + Search(expected: null, text: "V2", target: SearchScope.Published), + + Search(expected: ids1, text: "V3", target: SearchScope.All), + Search(expected: ids1, text: "V3", target: SearchScope.Published) + ); + } + [Fact] public async Task Should_simulate_new_version() {