How to update Published version of content when its current version is Draft?

I’m submitting a…

  • [ ] Question about possible implementation

Current behavior

I have a simple schema:

{
  conversations: []
}

It can be updated in two ways:

  • from the Squidex CMS (Content section)
  • from the Web site (UI for the Customer)

The flow is:

  • customer creates from the Web site the new conversation instance with some question
{
  status: "Published",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"}
  ]
}
  • I see this new conversation in Squidex CMS (Content section) and want to add an answer to this conversation
  • I change this conversation status from Published to Draft and add an answer (I need some time to add more information to my reply, which is why I keep it in Draft mode for a while)
{
  status: "Draft",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"},
     {source: "Developer", message: "Hello, this is my answer, to be continued...."}
  ]
}
  • meanwhile, the customer remembered that he/she forgot to add some details to the initial question and add a new reply to this conversation
{
  status: "Draft",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"},
     {source: "Developer", message: "Hello, this is my answer, to be continued...."},
     {source: "Customer", message: "Hello, I forget to add this clarification"}
  ]
}

The Squidex behavior tells us that in this case will be updated the Draft version of this conversation.
But on the Web site (for the Customer) we always get a Published version of the conversation. So, the result for this moment will be:
In the Draft copy, we have:

{
  status: "Draft",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"},
     {source: "Developer", message: "Hello, this is my answer, to be continued...."},
     {source: "Customer", message: "Hello, I forget to add this clarification"}
  ]
}

but in the Published copy of it, we still see:

{
  status: "Published",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"}
  ]
}

So user can’t see his/her clarification message until Developer changes the status of this conversation to Published.

Expected behavior

Here I have the question. Is there any convenient way to make the Published copy updated when it still has a Draft copy?

The result I expected
The Draft copy:

{
  status: "Draft",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"},
     {source: "Developer", message: "Hello, this is my answer, to be continued...."},
     {source: "Customer", message: "Hello, I forget to add this clarification"}
  ]
}

The Published copy:

{
  status: "Published",
  conversation: [
     {source: "Customer", message: "Hello, this is my question"},
     {source: "Customer", message: "Hello, I forget to add this clarification"}
  ]
}

Environment

App Name:

  • [ ] Self hosted with docker

Version: 13.0.0

Browser:

  • [ ] Chrome (desktop)

Sorry, this is not possible. You can only fetch the draft version with X-Unpublished header or you introduce a custom status field?

I’ve tried to play with only build-in Status. But I got your point if there is no instrument to do this, probably, the best way to solve this issue is to add a custom status to the item:

{
  status: "Published",
  conversation: [
     {source: "Customer", message: "Hello, this is my question", status: "Published"},
     {source: "Developer", message: "Hello, this is my answer, to be continued....", status: "Draft"},
     {source: "Customer", message: "Hello, I forget to add this clarification", status: "Published"}
  ]
}

then the Squidex status will be always Published, and I can just filter out the Draft items from the array.
Sound like the easiest and fastest way to solve the issue.

Thanks for the quick answer!
Have a good day!

1 Like