.ThatArePublished() Returns UnPublished pages

Posted by Community Admin on 04-Aug-2018 17:53

.ThatArePublished() Returns UnPublished pages

All Replies

Posted by Community Admin on 06-Jan-2016 00:00

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

To only display published pages, I have to get into PageData instead:

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

Posted by Community Admin on 12-Jan-2016 00:00

Hello,

You should check whether the page is deleted the following way:

Copy Code
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
 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 13-Jan-2016 00:00

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()"

 

Posted by Community Admin on 14-Jan-2016 00:00

Hi Jonathan,

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

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

Posted by Community Admin on 14-Jan-2016 00:00

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

 
Do you want to have your say in the Sitefinity development roadmap? Do you want to know when a feature you requested is added or when a bug fixed? Explore the Telerik Sitefinity CMS Ideas&Feedback Portal and vote to affect the priority of the items
 

This thread is closed