Issue in contentQuery for contents with future publish date

Enonic version: 6.13.1
OS: macOS 10.13.1

Let me know how to handle this use case can be handled while querying for contents which are future publish dates. I have a list for the contents and when I try to query, the list also contains the contents with future publish date. To solve this issue, I specified the branch as “master”. However, after using Master we people won’t be able to test the same in ‘Draft’ branch. I mean we won’t be able to check the article before publishing it.

This is not a bug…

When querying, unless specified, you always query in the current user’s context. If the current user is in edit or preview mode, the query will always return matching content in the “draft” branch. The publishfrom/-to dates have no effect on this.

If you are in live mode, the query will not return content that is not currently published (either unpublished, expired or not published yet).

Maybe you could explain what you are trying to solve here? What is your use-case? Is it related to the preview in content studio?

I tested in live mode. It was displaying the unpublished contents (ie. contents with publish pending status).

I am trying to query the contents of particular content type to display in a list view. However, contents with status “publish pending” is also getting listed.

In Content Studio this would be natural behaviour - in order to preview things naturally. You could always add a check in your query for publish.from? > Now if you explicitly want to remove it from your preview (NB! Remember to only use this check if rendering mode is edit or preview.

1 Like