.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();
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