Skip to content

Missing Post Type supports in Options Modal - #12394

Merged
youknowriad merged 7 commits into
WordPress:masterfrom
imath:fix/options-modal-featured-image
Jan 18, 2019
Merged

youknowriad merged 7 commits into
WordPress:masterfrom
imath:fix/options-modal-featured-image

Conversation

@imath

@imath imath commented Nov 28, 2018 •

Copy link
Copy Markdown
Contributor
  • Featured Image is not only a Theme thing, it is possible for a custom post type to declare itself without supporting the thumbnail feature.
  • A custom post type can also register itself withour supporting comments and/or custom-fields.

As a result the corresponding Document panels in the editor sidebar are not displayed. The Options Modal should also avoid displaying the panel checkboxes if the custom post type does not support these 3 features

Description

To fix this issue, i've wrapped featured image, comments and custom fields checkboxes into <PostTypeSupportCheck/> components

How has this been tested?

I've tested the PR with the wp_block post type which only supports the title and editor features and check everything was still behaving the right way with the post post type.

Screenshots

Without the PR applied:

without

Checkboxes for featured image, comments, and custom fields are displayed although they shouldn't

With the PR applied:

with

The checkboxes for these 3 unsupported features are no more displayed.

Types of changes

Bug fix

Checklist:

  • My code is tested.
  • My code follows the WordPress code style.
  • My code follows the accessibility standards.
  • My code has proper inline documentation.

@ajitbohra ajitbohra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM 👍

@ajitbohra
ajitbohra requested a review from gziolo November 29, 2018 16:48
@gziolo gziolo added this to the 4.7 milestone Nov 30, 2018
@gziolo gziolo added [Feature] Extensibility The ability to extend blocks or the editing experience [Type] Enhancement A suggestion for improvement. [Type] Bug An existing feature does not function as intended and removed [Type] Enhancement A suggestion for improvement. labels Nov 30, 2018
@gziolo

gziolo commented Nov 30, 2018

Copy link
Copy Markdown
Member

Should we also wrap the permalink section with check? It Was added in #12132.

@imath

imath commented Dec 1, 2018

Copy link
Copy Markdown
Contributor Author

@gziolo Absolutely. Thanks for mentioning it. I've just updated the PR accordingly.

  • I've updated the Options Modal snapshots that were failing.

@noisysocks

Copy link
Copy Markdown
Member

It would be nice if we didn't display the section title when there are no options underneath it. This came up in #11802 (comment) as well.

@gziolo

gziolo commented Dec 3, 2018

Copy link
Copy Markdown
Member

It would be nice if we didn't display the section title when there are no options underneath it. This came up in #11802 (comment) as well.

Yes, I opened #11923 to track it.

@imath

imath commented Dec 5, 2018

Copy link
Copy Markdown
Contributor Author

@gziolo in 20d1669 I've succeeded to avoid the section title display, but I haven't find a better way than using a huge check 😫

Here's a screenshot:

nosections

@noisysocks

Copy link
Copy Markdown
Member

Let's tackle #11923 in a seperate PR. I don't think it's urgent.

@imath

imath commented Dec 6, 2018

Copy link
Copy Markdown
Contributor Author

Fine with me @noisysocks, should I revert 20d1669 @gziolo ?

@gziolo

gziolo commented Dec 14, 2018

Copy link
Copy Markdown
Member

Fine with me @noisysocks, should I revert 20d1669 @gziolo ?

Yes, I would put it in a follow-up PR so we could iterate on it 👍

Comment thread lib/client-assets.php Resolved

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's going to be a more tricky check. All those panels can be also removed programmatically :)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

😱

@imath

imath commented Dec 15, 2018

Copy link
Copy Markdown
Contributor Author

@gziolo I've just reverted the commit that was doing the huge check to try to solve #11923

@gziolo gziolo left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looks good after all changes made 👍

@gziolo

gziolo commented Dec 17, 2018

Copy link
Copy Markdown
Member

@noisysocks - do you want to perform another round of testing before we proceed? It's blocked by your review at the moment :)

@noisysocks
noisysocks dismissed their stale review December 19, 2018 04:36

No bandwidth to re-review right now

@noisysocks

Copy link
Copy Markdown
Member

@gziolo: Dismissed my stale review. Am doing a support rotation this week so best not wait for me 🙂

@youknowriad youknowriad removed this from the 4.8 milestone Dec 19, 2018
@youknowriad youknowriad added this to the 4.9 milestone Dec 19, 2018
@gziolo

gziolo commented Dec 19, 2018

Copy link
Copy Markdown
Member

@imath - can you rebase with master? Travis is back to normal :)

Featured Image is not only a Theme thing, it is possible for a custom post type to declare itself without supporting the `thumbnail` feature.
A custom post type can also register itself withour supporting `comments` and/or `custom-fields`.
As a result the corresponding Document panels in the editor sidebar are not displayed. The Options Modal should also avoid displaying the panel checkboxes if the custom post type does not support these 3 features
As recommanded by @noisysocks : make sure the behavior about custom fields is consistent between WordPress 5.0 RC and the Gutenberg plugin
It should fix the failing test.
@imath

imath commented Dec 19, 2018

Copy link
Copy Markdown
Contributor Author

@gziolo Sure, I've just rebased the PR 😉

@youknowriad
youknowriad merged commit e5f398c into WordPress:master Jan 18, 2019
Comment thread lib/client-assets.php Resolved
@imath

imath commented Jan 18, 2019

Copy link
Copy Markdown
Contributor Author

@youknowriad sorry i’ve clicked on the resolve button before posting this comment.

There’s no need to backport as it is already there these lines simply moved down a few lines. You should see the removed lines highlighted in red into the changes.

@imath

imath commented Jan 18, 2019

Copy link
Copy Markdown
Contributor Author

And btw thanks a lot for the merge 😍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Extensibility The ability to extend blocks or the editing experience [Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants