Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DataViews: limit users to those who have published pages #55455

Merged
merged 2 commits into from
Oct 19, 2023
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/edit-site/src/components/page-pages/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export default function PagePages() {
} = useEntityRecords( 'postType', 'page', queryArgs );

const { records: authors } = useEntityRecords( 'root', 'user', {
who: 'authors',
has_published_posts: true,
Copy link
Member Author

Choose a reason for hiding this comment

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

I substituted who by has_published_posts because I'm no longer sure what who is about, see code.

Copy link
Contributor

Choose a reason for hiding this comment

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

That's interesting indeed. I'm wondering if @TimothyBJacobs can shed some light about the nuances with who.

Suggested change
has_published_posts: true,
has_published_posts: [ 'page' ],

We need to limit to pages though.

Copy link
Member Author

Choose a reason for hiding this comment

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

Oh, interesting. So it admits both a boolean and an array.

Copy link
Member

Choose a reason for hiding this comment

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

Yeah who is weird and not really recommended AFAIK.

Looking at the UI now, it seems like has_published_posts makes the most sense. But it does seem like this UI might want to display draft pages at some point? In which case, restricting to published posts would be incorrect.

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the feedback, Timothy. I'm addressing it at #55723

} );

const paginationInfo = useMemo(
Expand Down
Loading