Browse Source

Fixed full text book and webhook.

pull/516/head
Sebastian 6 years ago
parent
commit
ab3438e285
  1. 4
      backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs
  2. 4
      backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs
  3. 2
      backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs
  4. 36
      backend/tests/Squidex.Domain.Apps.Entities.Tests/Contents/Text/TextIndexerTestsBase.cs

4
backend/extensions/Squidex.Extensions/Actions/Webhook/WebhookActionHandler.cs

@ -5,7 +5,6 @@
// All rights reserved. Licensed under the MIT license. // All rights reserved. Licensed under the MIT license.
// ========================================================================== // ==========================================================================
using System;
using System.Net.Http; using System.Net.Http;
using System.Text; using System.Text;
using System.Threading; using System.Threading;
@ -18,7 +17,6 @@ namespace Squidex.Extensions.Actions.Webhook
{ {
public sealed class WebhookActionHandler : RuleActionHandler<WebhookAction, WebhookJob> public sealed class WebhookActionHandler : RuleActionHandler<WebhookAction, WebhookJob>
{ {
private static readonly TimeSpan DefaultTimeout = TimeSpan.FromSeconds(2);
private readonly IHttpClientFactory httpClientFactory; private readonly IHttpClientFactory httpClientFactory;
public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory) public WebhookActionHandler(RuleEventFormatter formatter, IHttpClientFactory httpClientFactory)
@ -59,8 +57,6 @@ namespace Squidex.Extensions.Actions.Webhook
{ {
using (var httpClient = httpClientFactory.CreateClient()) using (var httpClient = httpClientFactory.CreateClient())
{ {
httpClient.Timeout = DefaultTimeout;
var request = new HttpRequestMessage(HttpMethod.Post, job.RequestUrl) var request = new HttpRequestMessage(HttpMethod.Post, job.RequestUrl)
{ {
Content = new StringContent(job.RequestBody, Encoding.UTF8, "application/json") Content = new StringContent(job.RequestBody, Encoding.UTF8, "application/json")

4
backend/src/Squidex.Domain.Apps.Entities/Contents/Text/TextIndexingProcess.cs

@ -148,8 +148,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
ServeAll = false, ServeAll = false,
ServePublished = true ServePublished = true
}); });
state.DocIdForPublished = state.DocIdCurrent;
} }
else else
{ {
@ -164,8 +162,6 @@ namespace Squidex.Domain.Apps.Entities.Contents.Text
ServePublished = isPublished, ServePublished = isPublished,
Texts = data.ToTexts() Texts = data.ToTexts()
}); });
state.DocIdForPublished = state.DocIdNew;
} }
await textIndexerState.SetAsync(state); await textIndexerState.SetAsync(state);

2
backend/src/Squidex/Areas/Api/Controllers/Apps/AppContributorsController.cs

@ -87,7 +87,7 @@ namespace Squidex.Areas.Api.Controllers.Apps
} }
/// <summary> /// <summary>
/// Remove contributor from app. /// Remove contributor.
/// </summary> /// </summary>
/// <param name="app">The name of the app.</param> /// <param name="app">The name of the app.</param>
/// <param name="id">The id of the contributor.</param> /// <param name="id">The id of the contributor.</param>

36
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] [Fact]
public async Task Should_also_serve_published_after_publish() 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] [Fact]
public async Task Should_simulate_new_version() public async Task Should_simulate_new_version()
{ {

Loading…
Cancel
Save