Browse Source

Fix new status in content collection.

pull/641/head
Sebastian 5 years ago
parent
commit
5792dde599
  1. 11
      backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs
  2. 2
      backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs

11
backend/src/Squidex.Domain.Apps.Entities.MongoDb/Contents/MongoContentRepository_SnapshotStore.cs

@ -95,6 +95,10 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents
{ {
var content = CreateContent(value, value.Data, newVersion); var content = CreateContent(value, value.Data, newVersion);
content.NewStatus = value.NewStatus;
content.ScheduledAt = value.ScheduleJob?.DueTime;
content.ScheduleJob = value.ScheduleJob;
await collectionAll.UpsertVersionedAsync(content.DocumentId, oldVersion, content); await collectionAll.UpsertVersionedAsync(content.DocumentId, oldVersion, content);
} }
@ -102,6 +106,10 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents
{ {
var content = CreateContent(value, value.CurrentVersion.Data, newVersion); var content = CreateContent(value, value.CurrentVersion.Data, newVersion);
content.NewStatus = null;
content.ScheduledAt = null;
content.ScheduleJob = null;
await collectionPublished.UpsertVersionedAsync(content.DocumentId, oldVersion, content); await collectionPublished.UpsertVersionedAsync(content.DocumentId, oldVersion, content);
} }
@ -113,9 +121,6 @@ namespace Squidex.Domain.Apps.Entities.MongoDb.Contents
content.DocumentId = value.UniqueId; content.DocumentId = value.UniqueId;
content.IndexedAppId = value.AppId.Id; content.IndexedAppId = value.AppId.Id;
content.IndexedSchemaId = value.SchemaId.Id; content.IndexedSchemaId = value.SchemaId.Id;
content.NewStatus = null;
content.ScheduledAt = null;
content.ScheduleJob = null;
content.Version = newVersion; content.Version = newVersion;
return content; return content;

2
backend/tools/TestSuite/TestSuite.ApiTests/ContentUpdateTests.cs

@ -435,12 +435,14 @@ namespace TestSuite.ApiTests
var updated = await _.Contents.GetAsync(content.Id); var updated = await _.Contents.GetAsync(content.Id);
Assert.Equal(1, updated.Data.Number); Assert.Equal(1, updated.Data.Number);
Assert.Null(updated.NewStatus);
// STEP 4: Get the unpublished version // STEP 4: Get the unpublished version
var unpublished = await _.Contents.GetAsync(content.Id, QueryContext.Default.Unpublished()); var unpublished = await _.Contents.GetAsync(content.Id, QueryContext.Default.Unpublished());
Assert.Equal(2, unpublished.Data.Number); Assert.Equal(2, unpublished.Data.Number);
Assert.Equal("Draft", unpublished.NewStatus);
} }
finally finally
{ {

Loading…
Cancel
Save