-
Notifications
You must be signed in to change notification settings - Fork 4.3k
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
Ensure contributors can create tags and manage categories #6761
Changes from all commits
89efbff
c4e4875
fa464ea
fd531a0
39b61b5
a25c474
0c9c329
9a96bed
ac803ad
04aa6e5
92a1945
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,12 @@ class FlatTermSelector extends Component { | |
} | ||
|
||
render() { | ||
const { slug, taxonomy } = this.props; | ||
const { slug, taxonomy, hasAssignAction } = this.props; | ||
|
||
if ( ! hasAssignAction ) { | ||
return null; | ||
} | ||
|
||
const { loading, availableTerms, selectedTerms } = this.state; | ||
const termNames = availableTerms.map( ( term ) => term.name ); | ||
const newTermPlaceholderLabel = get( | ||
|
@@ -202,7 +207,10 @@ export default compose( | |
}; | ||
} ), | ||
withSelect( ( select, ownProps ) => { | ||
const { getCurrentPost } = select( 'core/editor' ); | ||
return { | ||
hasCreateAction: get( getCurrentPost(), [ '_links', 'wp:action-create-' + ownProps.restBase ], false ), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this logic be its own selector? Something like Minor: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
See #6655 |
||
hasAssignAction: get( getCurrentPost(), [ '_links', 'wp:action-assign-' + ownProps.restBase ], false ), | ||
terms: select( 'core/editor' ).getEditedPostAttribute( ownProps.restBase ), | ||
}; | ||
} ), | ||
|
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.
Instead of adding a new reducer/selectors/actions, we could just leverage the new entities abstraction to automatically generate those. https://github.com/WordPress/gutenberg/blob/master/core-data/entities.js#L6
Currently, the entities only support fetching by id
getEntityRecord
but we should definitely introduce a findAll/findQuery as wellgetEntityRecords( state, kind, entity, query )
If you think it's too much work, it's fine to do it separately.
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'd like to handle separately (and also include more tests within
core-data
). I've filed an issue #6780