publishpress / PublishPress-Blocks

PublishPress Blocks adds the missing blocks and configuration you need to build professional websites. Take the control of the new Gutenberg editor with user edition profile configuration and 20+ new blocks and options.
14 stars 8 forks source link

Extended supported blocks is always activate, even when disabled on the Dashboard #1319

Closed andergmartins closed 9 months ago

andergmartins commented 9 months ago

Extended supported blocks it seems this feature is working despite being disabled after install; need more tests to confirm.

Related to #1318.

It is probably an issue with the logic on the conditional inside the settingsIsEnabled method: https://github.com/publishpress/PublishPress-Blocks/blob/dadcde6fb5ee9bce8ca5709ec39b2b0488358ec1/src/incl/advanced-gutenberg-main.php#L4136-L4143.

It will return true if the setting is not saved yet. It was probably coded that way so the features work by default before the user saves the settings for the first time with the actual setting. But even if the setting value is 0, or false it will still return true because when the setting exists (no matter its value) it satisfies the first check in the OR condition, returning true.

andergmartins commented 9 months ago

Test use case, check if Accordion Blocks is displayed or not, based on the state of that setting.

andergmartins commented 9 months ago

I think the fix for this one will fix the first issue reported on #1318