.ThatArePublished() Returns UnPublished pages
I expect the following to return the published pages that have a parent with a specific id, but it doesn't behave as expected. It returns unpublished pages along with published ones:
DataSet = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Parent.Id == currentNode.Id).ThatArePublished().Get().OrderBy(p => p.Ordinal).ToList();
DataSet = App.WorkWith().Pages().LocatedIn(PageLocation.Frontend).Where(p => p.Parent.Id == currentNode.Id && p.GetPageData().Visible).Get().OrderBy(p => p.Ordinal).ToList();
Is this expected? Is there a better method to get only published pages?
I would expect "ThatArePublished()" to only return pages "that are published".
Thanks in advance
Jonathan
Hello,
You should check whether the page is deleted the following way:
var newCulture =
new
CultureInfo(
"en"
);
var pagesFl = App.WorkWith().Pages()
.LocatedIn(PageLocation.Frontend)
.ThatArePublished()
.ThatAreForLanguage(newCulture)
.Get()
.Where(p => p.IsDeleted ==
false
)
.OrderByDescending(x => x.LastModified).ToList();
This will return the correct pages - the ones you expect excluding the deleted.
However, the api is actually really getting published items, though some of them are in the recycle bin and are deleted. The published state is part of the workflow and the visibility (Visible property for content items) or deleted is more part of the content lifecycle.
There is a feature request for a way to get the published and visible items with one method call. You can review it in our portal here.
Regards,
Nikola Zagorchev
Telerik
I don't think you read my post correctly. The problem is not that the query is returning *deleted* pages (which you address in your solution), the problem is that the query is returning *unpublished* pages, which I would not expect, as the method is titled "ThatArePublished()"
Hi
Please, excuse me for the misunderstanding.
I was able to reproduce the issue on my end. I am currently verifying it with our QAs and will share with the community whether this is a bug.
This issue is related:
http://feedback.telerik.com/Project/153/Feedback/Details/134445-filter-pages-does-not-work-correctly-when-using-published-filter
In the meantime, please, use the workaround you have found.
Regards,
Nikola Zagorchev
Telerik
Hi,
Here is the bug item in our portal:
http://feedback.telerik.com/Project/153/Feedback/Details/180295-fluent-api-pages-thatarepublished-returns-unpublished-and-draft-pages
I have updated your Telerik points.
Regards,
Nikola Zagorchev
Telerik