Skip to content

IBX-10854: Added ability to hide content item drafts#667

Merged
alongosz merged 3 commits into
4.6from
IBX-10854_Not_possible_to_hide_content_draft
Jul 20, 2026
Merged

IBX-10854: Added ability to hide content item drafts#667
alongosz merged 3 commits into
4.6from
IBX-10854_Not_possible_to_hide_content_draft

Conversation

@vidarl

@vidarl vidarl commented Oct 24, 2025

Copy link
Copy Markdown
Contributor
🎫 Issue IBX-10854

It is not possible to publish content in hidden state

For QA:

Note

Edited by @alongosz

Requires security testing, e.g., if user who doesn't have hide/reveal permissions is now able to do it.

Documentation:

@vidarl
vidarl changed the base branch from main to 4.6 October 24, 2025 12:22
Comment thread src/lib/Repository/ContentService.php Outdated

@alongosz alongosz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIR this is by-design. There's no purpose to hiding content drafts because content drafts can be read by people with versionread policy, the same as hidden content can be accessed. Are you trying to fix some fatal error or enable hiding drafts? TL;DR;.

@vidarl

vidarl commented Oct 27, 2025

Copy link
Copy Markdown
Contributor Author

There's no purpose to hiding content drafts because

yes, it is. If you don't want content to be visible at time of publishing.

Are you trying to fix some fatal error or enable hiding drafts?

@alongosz
I am trying to publish content as hidden. The use-case is:
Write a new article but translate it to multiple languages before making it visible. Since admin-ui cannot edit multiple languages for the same version, publish it as hidden would do the trick

edited....

@sonarqubecloud

Copy link
Copy Markdown

@vidarl
vidarl requested review from Steveb-p and alongosz October 29, 2025 07:32
@vidarl

vidarl commented Nov 18, 2025

Copy link
Copy Markdown
Contributor Author

ping @alongosz @Steveb-p : I have answered on your comments. Please have a look again

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn't this mean, with this change, that for drafts every user has ability to hide & reveal?

Because we won't be checking permission resolver for drafts.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. Fixed in ca2b306.
Unsure if it 100% safe to have $targets=[] in parameter to canUser() though, but seems to work fine for me when I test with limitation on content/hide policy

@Steveb-p

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Explanation of what happens when $targets=[] is addressed in #667 (comment)

@Steveb-p

@konradoboza

Copy link
Copy Markdown
Contributor

@vidarl please make sure #667 (comment) is addressed, PR is rebased and the CI lits green.

@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from acbb2d8 to ca2b306 Compare February 10, 2026 11:37
@vidarl

vidarl commented Feb 24, 2026

Copy link
Copy Markdown
Contributor Author

@vidarl please make sure #667 (comment) is addressed, PR is rebased and the CI lits green.

@konradoboza
Done. Only sonar complains now about duplicated code in Tests. Which should be considered as a false-positive

Comment thread src/lib/Repository/ContentService.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from e6a3f58 to 6671254 Compare March 6, 2026 12:42
@vidarl
vidarl requested a review from konradoboza March 9, 2026 14:59
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php
@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch 2 times, most recently from 91fd72c to af81e00 Compare March 11, 2026 10:40
@vidarl
vidarl requested a review from konradoboza March 11, 2026 11:33
@sonarqubecloud

Copy link
Copy Markdown

@vidarl

vidarl commented Mar 24, 2026

Copy link
Copy Markdown
Contributor Author

@alongosz, @konradoboza, @Steveb-p : Can you have a new look on this one. I think all review comments has been addressed

Comment thread src/lib/Repository/ContentService.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
@alongosz alongosz changed the title IBX-10854 not possible to hide content draft IBX-10854: Added ability to hide content item drafts Mar 24, 2026
Comment thread src/lib/Repository/ContentService.php Outdated
@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from 3e36e6e to ca88c8c Compare April 20, 2026 14:51
@vidarl
vidarl requested a review from alongosz April 21, 2026 11:12

@alongosz alongosz left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another round of review:

Comment thread src/lib/Repository/ContentService.php Outdated
Comment thread src/lib/Repository/ContentService.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php Outdated
Comment thread tests/integration/Core/Repository/ContentServiceTest.php
@sonarqubecloud

Copy link
Copy Markdown

@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from a8709d3 to c2ea69b Compare May 22, 2026 08:06
@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from c2ea69b to 80a7dc1 Compare June 2, 2026 13:15
@sonarqubecloud

sonarqubecloud Bot commented Jun 2, 2026

Copy link
Copy Markdown

@tomaszszopinski tomaszszopinski self-assigned this Jun 22, 2026
@tomaszszopinski

Copy link
Copy Markdown

Note from QA:
Hidden content item is created by the API, but there are some differences:

  • 'eye' icon is missing
  • hidden content item is not greyed out
Zrzut ekranu 2026-06-22 o 14 26 54 Zrzut ekranu 2026-06-22 o 14 26 59

@tomaszszopinski tomaszszopinski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding request changes, so it more visible (see my earlier comment).

@vidarl
vidarl force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch 2 times, most recently from 5b79d9c to d969b17 Compare July 3, 2026 11:09
@vidarl

vidarl commented Jul 3, 2026

Copy link
Copy Markdown
Contributor Author

Adding request changes, so it more visible (see my earlier comment).

@tomaszszopinski
Yes, I was aware of it, but had some issues with the new tests that was needed.
Your finding was correct, it was real bug you found. What happen was that the location was not marked as invisible if the draft was published as hidden.
Fixed this in d969b17
However, CI on core has some other problems now ( @alongosz is already working on it). Once that is fixed, I expect my new tests and the fix to work as well

@alongosz
alongosz force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from d969b17 to be60b87 Compare July 14, 2026 14:31
@alongosz
alongosz requested a review from tomaszszopinski July 15, 2026 08:31
@tomaszszopinski
tomaszszopinski force-pushed the IBX-10854_Not_possible_to_hide_content_draft branch from be60b87 to 9293a98 Compare July 20, 2026 06:26
@sonarqubecloud

Copy link
Copy Markdown

@tomaszszopinski tomaszszopinski left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QA approved on Ibexa DXP 4.6 exp.

@alongosz
alongosz merged commit 2204803 into 4.6 Jul 20, 2026
35 checks passed
@alongosz
alongosz deleted the IBX-10854_Not_possible_to_hide_content_draft branch July 20, 2026 10:24
@mnocon mnocon added the Doc needed The changes require some documentation label Jul 20, 2026
@mnocon

mnocon commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

Hi! Adding the Doc needed label, because the use case mentioned by Vidar is interesting and the best practices for handling this should to be documented:

The use-case is: Write a new article but translate it to multiple languages before making it visible. Since admin-ui cannot edit multiple languages for the same version, publish it as hidden would do the trick

Thinking about this right now, I'm not sure if I'd recommend hiding the draft to for all cases, I think it's:

Case 1: Article content doesn't have to remain a secret:

  1. Hide the draft
  2. Publish it
  3. Translate into multiple languages
  4. Reveal (unhide) it

Because hidden content is accessible through the REST API, this flow doesn't work for cases where the Article content has to remain a secret (for example, company merger announcement or anything that could move the stock market).

For content that has to remain a secret before being published in multiple languages, the flow would be:

Case 2: Article content has to remain a secret

  1. Create a section meant with rectricted read access (internal only)
  2. Create and publish an article there
  3. Translate it
  4. Move it to the intended (generally available) location

This way the content remains a secret until it can be oficially announced, and cannot be previewed by REST API before that.

The second case does not rely on "unsafe" hide/reveal, hide/reveal can be used as a simplified flow for not business critical content.

Does it make sense to you as a recommendation?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Doc needed The changes require some documentation QA approved

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants