-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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: All Templates: Add filters to template author. #56338
Conversation
Warning: Type of PR label mismatch To merge this PR, it requires exactly 1 label indicating the type of PR. Other labels are optional and not being checked here.
Read more about Type labels in Gutenberg. Don't worry if you don't have the required permissions to add labels; the PR reviewer should be able to help with the task. |
This pull request changed or added PHP files in previous commits, but none have been detected in the latest commit. Thank you! ❤️ |
Size Change: +101 B (0%) Total Size: 1.7 MB
ℹ️ View Unchanged
|
23e13bf
to
5289030
Compare
Hi @ntsekouras, now that sorting is merged I guess this one is ready for review. |
packages/edit-site/src/components/page-templates/dataviews-templates.js
Outdated
Show resolved
Hide resolved
if ( | ||
filter.field === 'author' && | ||
filter.operator === OPERATOR_IN && | ||
filter.value !== '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to check explicitly for empty string?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I updated the condition to check if the filter has value instead of checking for an empty string.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thank you!
@@ -143,6 +145,20 @@ export default function DataviewsTemplates() { | |||
per_page: -1, | |||
} ); | |||
|
|||
const allAuthorElements = useMemo( () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could be named just authors
, I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggestion applied 👍
060846e
to
87a688d
Compare
Part of the follow-ups on #55848 (comment).
Adds an author filter to all templates view.
Screenshot
Testing
Go to the manage all templates page.
Verify it is possible to filter templates by author.