Conversation
Co-authored-by: ineagu <1849868+ineagu@users.noreply.github.com> Agent-Logs-Url: https://github.com/Codeinwp/feedzy-rss-feeds/sessions/299bd6bc-963c-4e8a-bd25-0226c2ab95ce
There was a problem hiding this comment.
Pull request overview
Updates Feedzy’s default “max items” setting to match the free-tier entitlement (10 items), reducing confusion when users don’t explicitly pass max in shortcodes/blocks.
Changes:
- Changed shortcode default
maxfrom5to10inget_short_code_attributes(). - Updated sanitization fallback for invalid/empty
maxvalues from5to10. - Aligned Gutenberg block attribute default and UI placeholder example to
10.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| includes/abstract/feedzy-rss-feeds-admin-abstract.php | Updates shortcode default and sanitization fallback for max to 10. |
| includes/gutenberg/feedzy-rss-feeds-gutenberg-block.php | Updates Gutenberg block max default to 10. |
| includes/admin/feedzy-rss-feeds-ui-lang.php | Updates UI placeholder example for max to 10. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'max' => array( | ||
| 'type' => 'number', | ||
| 'default' => '5', | ||
| 'default' => '10', | ||
| ), |
There was a problem hiding this comment.
max is registered with 'type' => 'number' but its default is set as a string ('10'). Using a numeric literal for the default keeps the attribute schema consistent and avoids subtle type/coercion differences during block parsing/serialization.
|
@claude[agent] can you fix the review items? |
Co-authored-by: ineagu <1849868+ineagu@users.noreply.github.com> Agent-Logs-Url: https://github.com/Codeinwp/feedzy-rss-feeds/sessions/828ac5aa-e7f4-42b5-8d1e-d452b83eb873
Fixed in 535919b - changed the Gutenberg block |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
Comments suppressed due to low confidence (1)
includes/gutenberg/feedzy-rss-feeds-gutenberg-block.php:111
offsetis declared as a Gutenberg attribute withtype: 'number', but its PHP schema setsdefaultto the string'0'. This violates the block attribute type contract and can lead to block validation warnings. Use a numeric literal (0) for the default to match the declared type (and align with the editor-side schema).
'offset' => array(
'type' => 'number',
'default' => '0',
),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| 'max' => array( | ||
| 'type' => 'number', | ||
| 'default' => '5', | ||
| 'default' => 10, |
There was a problem hiding this comment.
The Gutenberg block’s JS attribute schema still defaults max to 5 (see js/FeedzyBlock/attributes.js), while the PHP register_block_type() schema now defaults to 10. This mismatch can cause newly inserted blocks in the editor to still start at 5 items and may also trigger block validation/serialization inconsistencies. Update the editor-side attributes default (and rebuilt assets, if applicable) to keep the JS and PHP schemas in sync.
| 'default' => 10, | |
| 'default' => 5, |
| // comma separated feeds url. | ||
| 'feeds' => '', | ||
| // number of feeds items (0 for unlimited). | ||
| 'max' => '5', | ||
| 'max' => '10', | ||
| // display feed title yes/no. |
There was a problem hiding this comment.
This PR changes the shortcode default/fallback for max to 10, but there’s no unit test asserting the default behavior when max is omitted/empty/invalid. Since the repo already has PHPUnit coverage for the admin abstract, add a test that get_short_code_attributes([]) defaults max to 10 and that sanitize_attr() falls back to 10 for empty/non-numeric values (while preserving explicit numeric values like 5).
Original prompt