Conversation
- Enhanced the index.js files for each block to register variations conditionally based on post types. - Improved localization by wrapping strings with __() for translation readiness. - Changed the order of queries in review-related blocks to descending for more recent reviews.
|
Caution Review failedThe pull request is closed. Warning CodeRabbit GitHub Action detectedThe repository is using both CodeRabbit Pro and CodeRabbit Open Source (via GitHub Actions), which is not recommended as it may lead to duplicate comments and extra noise. Please remove the CodeRabbit GitHub Action. Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. Note
|
| Cohort / File(s) | Summary |
|---|---|
Accommodation-related - Tour src/blocks/accommodation-related-tour/block.json, src/blocks/accommodation-related-tour/index.js |
Manifest updated (title → "Related Accommodations", description, icon, keywords, example). Example restructured to wide/constrained groups and a core/query for postType:"accommodation" (perPage:6, orderBy:title, order:asc). Inner content now core/post-template using pattern lsx-tour-operator/accommodation-card in a 3-column grid. index.js refactored to registerAccommodationRelatedTourVariation, conditional registration for tour, isActive added. |
Accommodation-related - Accommodation / Destination src/blocks/accommodation-related-accommodation/block.json, src/blocks/accommodation-related-accommodation/index.js, src/blocks/accommodation-related-destination/block.json, src/blocks/accommodation-related-destination/index.js |
Titles/metadata and examples adjusted; icons/keywords tweaked. index.js modules moved to named register functions, use registerForPostTypes / templates for conditional registration (accommodation/destination), inner templates converted to query+pattern grids, isActive added, className/layout normalized. |
Review-related (Accommodation / Destination / Tour) src/blocks/review-related-accommodation/block.json, src/blocks/review-related-accommodation/index.js, src/blocks/review-related-destination/block.json, src/blocks/review-related-destination/index.js, src/blocks/review-related-tour/block.json, src/blocks/review-related-tour/index.js |
Manifests enriched (textdomain, description, icon, keywords, examples). index.js files refactored to register...Variation functions, import registerForPostTypes, conditional registration per post type, i18n applied, isActive added, query ordering adjusted (often desc), pattern slugs changed to review-card. |
Tour-related (Accommodation / Destination / Tour) src/blocks/tour-related-accommodation/block.json, src/blocks/tour-related-accommodation/index.js, src/blocks/tour-related-destination/block.json, src/blocks/tour-related-destination/index.js, src/blocks/tour-related-tour/block.json, src/blocks/tour-related-tour/index.js |
Manifests augmented (textdomain/description/icon/keywords/examples). index.js files switched to named register functions, conditional post-type registration via registerForPostTypes, i18n applied, query defaults adjusted (perPage:6, orderBy:title), pattern slugs updated to tour-card, and isActive added. |
Cross-cutting / utilities @utils/conditional-block-registration.js (import usage across index.js) |
Multiple index.js files now import and use conditional registration helpers (registerForPostTypes, registerForPostTypesAndTemplates) to gate variation registration by post type/template and defer invocation to wp.domReady. |
Sequence Diagram(s)
sequenceDiagram
participant Editor as Block Editor
participant DOM as wp.domReady
participant Helper as registerForPostTypes(/Templates)
participant Blocks as wp.blocks
rect rgb(245,250,255)
Note over Helper,Blocks: Conditional, post-type/template-aware variation registration
DOM->>Helper: call conditionalRegister()
Helper->>Helper: detect current post type / template
alt match found
Helper->>Blocks: registerBlockVariation(variation with isActive)
Blocks->>Editor: variation appears in inserter/context
else no match
Helper-->>Blocks: skip registration
Blocks->>Editor: variation not available
end
end
Estimated code review effort
🎯 4 (Complex) | ⏱️ ~45 minutes
- Areas requiring extra attention:
- Correct postType/template lists passed into
registerForPostTypes/registerForPostTypesAndTemplates. - Consistency between block.json
textdomainand i18n__()usage in index.js. - Query block attributes (perPage, order, orderBy, postType) and alignment with desired behavior.
- Validity and availability of referenced pattern slugs (
accommodation-card,review-card,tour-card). - Block.json example structures conform to Block API v3 schema.
- Correct postType/template lists passed into
Possibly related issues
#694— Block audit for review/relationship blocks; these changes implement many of that audit’s metadata, example and conditional-registration recommendations.#583— Standardisation of block.json metadata and variation registration; this PR applies the same standardisation pattern.#695— Overlap on tour↔accommodation Query Loop and conditional availability; this PR updates those query/patterns and gating.
Possibly related PRs
- PR
#696— Introduces the conditional-block-registration utility and@utilsalias used by many changed index.js files (strong code-level link). - PR
#763— Performs the same conditional registerForPostTypes refactor and manifest enrichments across block variations (overlapping edits). - PR
#667— Related standardisation of block.json metadata, example scaffolding and conditional registration flow.
Suggested labels
comp:block-variations, comp:block-json, comp:block-editor, Tour Operator
Suggested reviewers
- ZaredRogers
Pre-merge checks and finishing touches
✅ Passed checks (5 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The PR title clearly and specifically describes the main changes: enhancement of review and cross-reference blocks with comprehensive metadata and conditional registration. |
| Description check | ✅ Passed | The PR description is comprehensive and covers objectives, key changes, technical implementation, testing, and block relationships. However, it deviates from the repository template structure and lacks explicit Test Notes checklist items and Risk & Rollback sections. |
| Linked Issues check | ✅ Passed | The PR substantially addresses the coding requirements in issue #694 by implementing Block API v3 metadata compliance, conditional registration using shared utilities, icon standardization, and comprehensive examples for nine relationship blocks across reviews, tours, accommodations, and destinations. |
| Out of Scope Changes check | ✅ Passed | All code changes remain focused on the scope defined in issue #694: JavaScript/block enhancements, block.json metadata standardization, icon integration, conditional registration, and localization. No extraneous backend changes or unrelated modifications are present. |
| Docstring Coverage | ✅ Passed | Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%. |
📜 Recent review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
build/blocks/accommodation-related-destination/index.jsis excluded by!build/**
📒 Files selected for processing (1)
src/blocks/accommodation-related-destination/index.js(4 hunks)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Uplevel your code reviews with CodeRabbit ProCodeRabbit ProIf you like this project, please support us by purchasing the Pro version. The Pro version has advanced context, superior noise reduction and several proprietary improvements compared to the open source version. Moreover, CodeRabbit Pro is free for open source projects. |
There was a problem hiding this comment.
Files selected (6)
- src/blocks/accommodation-related-tour/index.js (11)
- src/blocks/review-related-accommodation/index.js (6)
- src/blocks/review-related-destination/index.js (6)
- src/blocks/review-related-tour/index.js (5)
- src/blocks/tour-related-accommodation/index.js (6)
- src/blocks/tour-related-destination/index.js (6)
Files ignored due to filter (12)
- build/blocks/accommodation-related-tour/block.json
- build/blocks/review-related-accommodation/block.json
- build/blocks/review-related-destination/block.json
- build/blocks/review-related-tour/block.json
- build/blocks/tour-related-accommodation/block.json
- build/blocks/tour-related-destination/block.json
- src/blocks/accommodation-related-tour/block.json
- src/blocks/review-related-accommodation/block.json
- src/blocks/review-related-destination/block.json
- src/blocks/review-related-tour/block.json
- src/blocks/tour-related-accommodation/block.json
- src/blocks/tour-related-destination/block.json
Files not summarized due to errors (6)
- src/blocks/accommodation-related-tour/index.js (diff tokens exceeds limit)
- src/blocks/tour-related-accommodation/index.js (nothing obtained from openai)
- src/blocks/review-related-destination/index.js (nothing obtained from openai)
- src/blocks/tour-related-destination/index.js (nothing obtained from openai)
- src/blocks/review-related-accommodation/index.js (nothing obtained from openai)
- src/blocks/review-related-tour/index.js (nothing obtained from openai)
Files not reviewed due to errors (6)
- src/blocks/tour-related-destination/index.js (no response)
- src/blocks/accommodation-related-tour/index.js (no response)
- src/blocks/review-related-accommodation/index.js (no response)
- src/blocks/review-related-tour/index.js (no response)
- src/blocks/review-related-destination/index.js (no response)
- src/blocks/tour-related-accommodation/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (7)
src/blocks/tour-related-destination/block.json (1)
18-22: Standardise example metadata name. The example metadata still carries the old plural label, so previews will surface wording that no longer matches the block title. Please align the example name with the new singular title to keep localisation tidy.- "name": "Related Tours - Destinations" + "name": "Related Tours - Destination"src/blocks/review-related-destination/index.js (2)
1-11: Add @SInCE tags to JSDoc blocks. Both JSDoc headers are missing the required @SInCE annotation, which our coding guidelines mandate for new block code. Please add the correct version reference to each block comment.
118-118: Finish the inline comment with a period. The line comment should end with a full stop to satisfy the documented commenting rules.src/blocks/review-related-accommodation/index.js (2)
1-11: Add @SInCE tags to JSDoc blocks. Please include the mandated @SInCE annotation in both JSDoc headers so the documentation aligns with our standards.
117-117: Add the missing full stop to the comment. The inline comment should conclude with a period to stay consistent with our commenting rules.src/blocks/review-related-destination/block.json (1)
9-9: Correct the description grammar. The description should read “Displays …” to remain grammatical and consistent with the other blocks’ copy.- "description": "Display reviews related to destination posts.", + "description": "Displays reviews related to destination posts.",src/blocks/accommodation-related-tour/index.js (1)
114-208: Align the example content with accommodations.The inserter example still speaks about tours (“Related tours”, tour itineraries). Because this block surfaces accommodations, the preview should showcase accommodation-focused copy to avoid confusing editors. Consider updating the labels and sample cards, e.g.:
- metadata: { - name: __('Related tours', 'tour-operator'), + metadata: { + name: __('Related accommodations', 'tour-operator'), ... - content: __('Related tours', 'tour-operator'), + content: __('Related accommodations', 'tour-operator'), ... - ['core/heading', { content: __('African Safari Adventure', 'tour-operator'), level: 3 }], - ['core/paragraph', { content: __("Embark on an unforgettable 7-day safari experience through Kenya's most spectacular wildlife reserves.", 'tour-operator') }], + ['core/heading', { content: __('Savanna View Lodge', 'tour-operator'), level: 3 }], + ['core/paragraph', { content: __('Experience luxury suites overlooking the Mara savanna with guided wildlife excursions included.', 'tour-operator') }],…and update the remaining cards similarly to describe accommodations.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (18)
build/blocks/accommodation-related-tour/block.jsonis excluded by!build/**build/blocks/accommodation-related-tour/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-tour/index.jsis excluded by!build/**build/blocks/review-related-accommodation/block.jsonis excluded by!build/**build/blocks/review-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/review-related-accommodation/index.jsis excluded by!build/**build/blocks/review-related-destination/block.jsonis excluded by!build/**build/blocks/review-related-destination/index.asset.phpis excluded by!build/**build/blocks/review-related-destination/index.jsis excluded by!build/**build/blocks/review-related-tour/block.jsonis excluded by!build/**build/blocks/review-related-tour/index.asset.phpis excluded by!build/**build/blocks/review-related-tour/index.jsis excluded by!build/**build/blocks/tour-related-accommodation/block.jsonis excluded by!build/**build/blocks/tour-related-accommodation/index.asset.phpis excluded by!build/**build/blocks/tour-related-accommodation/index.jsis excluded by!build/**build/blocks/tour-related-destination/block.jsonis excluded by!build/**build/blocks/tour-related-destination/index.asset.phpis excluded by!build/**build/blocks/tour-related-destination/index.jsis excluded by!build/**
📒 Files selected for processing (12)
src/blocks/accommodation-related-tour/block.json(1 hunks)src/blocks/accommodation-related-tour/index.js(11 hunks)src/blocks/review-related-accommodation/block.json(1 hunks)src/blocks/review-related-accommodation/index.js(6 hunks)src/blocks/review-related-destination/block.json(1 hunks)src/blocks/review-related-destination/index.js(6 hunks)src/blocks/review-related-tour/block.json(1 hunks)src/blocks/review-related-tour/index.js(5 hunks)src/blocks/tour-related-accommodation/block.json(1 hunks)src/blocks/tour-related-accommodation/index.js(6 hunks)src/blocks/tour-related-destination/block.json(1 hunks)src/blocks/tour-related-destination/index.js(6 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
**/*.{js,mjs,ts,tsx}
📄 CodeRabbit inference engine (.github/instructions/performance.instructions.md)
Defer non-critical JavaScript and avoid synchronous blocking operations
Files:
src/blocks/accommodation-related-tour/index.jssrc/blocks/review-related-tour/index.jssrc/blocks/review-related-accommodation/index.jssrc/blocks/review-related-destination/index.jssrc/blocks/tour-related-accommodation/index.jssrc/blocks/tour-related-destination/index.js
**/*.{js,ts,tsx,jsx}
⚙️ CodeRabbit configuration file
**/*.{js,ts,tsx,jsx}: Perform a detailed review of the provided code with following key aspects in mind:
- Review the code to ensure it is well-structured and adheres to best practices.
- Verify compliance with WordPress coding standards and @wordpress/eslint-plugin rules.
- Ensure the code is well-documented with proper JSDoc comments.
- Check for security vulnerabilities and confirm the code is secure.
- Optimize the code for performance, removing any unnecessary elements.
- Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
- Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features.
- Follow WordPress JavaScript coding standards and use WordPress script localization.
- Use WordPress script dependencies and enqueue properly.
- Ensure React/JSX best practices for blocks and modern JavaScript/TypeScript patterns.
- Implement proper error handling and loading states.
- Use WordPress components and design system where applicable.
- For Tour Operator: Focus on tour booking interfaces, search functionality, and tour display components.
Files:
src/blocks/accommodation-related-tour/index.jssrc/blocks/review-related-tour/index.jssrc/blocks/review-related-accommodation/index.jssrc/blocks/review-related-destination/index.jssrc/blocks/tour-related-accommodation/index.jssrc/blocks/tour-related-destination/index.js
src/blocks/**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
src/blocks/**/*.{js,jsx,ts,tsx}: - Follow WordPress JavaScript coding standards and @wordpress/scripts configuration.
- Use WordPress components from @wordpress/components and design system.
- Implement proper React/JSX patterns for WordPress blocks.
- Ensure proper WordPress script dependencies and localization.
- Use WordPress data store patterns with @wordpress/data.
- Implement proper error boundaries and loading states.
- Follow modern JavaScript/TypeScript patterns with proper typing.
- Ensure accessibility in interactive block components.
- Use WordPress block editor APIs correctly (useBlockProps, InspectorControls, etc.).
- Implement proper block validation and save/edit functionality.
Files:
src/blocks/accommodation-related-tour/index.jssrc/blocks/review-related-tour/index.jssrc/blocks/review-related-accommodation/index.jssrc/blocks/review-related-destination/index.jssrc/blocks/tour-related-accommodation/index.jssrc/blocks/tour-related-destination/index.js
🧬 Code graph analysis (6)
src/blocks/accommodation-related-tour/index.js (2)
src/blocks/review-related-tour/index.js (1)
conditionalRegister(118-121)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/review-related-tour/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
conditionalRegister(213-216)src/blocks/review-related-accommodation/index.js (1)
conditionalRegister(118-121)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/review-related-accommodation/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
conditionalRegister(213-216)src/blocks/review-related-tour/index.js (1)
conditionalRegister(118-121)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/review-related-destination/index.js (3)
src/blocks/review-related-tour/index.js (2)
wp(6-6)conditionalRegister(118-121)src/blocks/tour-related-destination/index.js (2)
wp(6-6)conditionalRegister(118-121)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/tour-related-accommodation/index.js (2)
src/blocks/accommodation-related-tour/index.js (1)
conditionalRegister(213-216)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/tour-related-destination/index.js (3)
src/blocks/accommodation-related-tour/index.js (1)
conditionalRegister(213-216)src/blocks/review-related-destination/index.js (1)
conditionalRegister(119-122)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: review
- GitHub Check: Summary
There was a problem hiding this comment.
Actionable comments posted: 1
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (1)
build/blocks/review-related-accommodation/block.jsonis excluded by!build/**
📒 Files selected for processing (1)
src/blocks/review-related-accommodation/block.json(1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: Agent
- GitHub Check: Summary
🔇 Additional comments (2)
src/blocks/review-related-accommodation/block.json (2)
9-9: ✓ Past issue resolved: description typo fixed.The double full stop (..) from the previous review has been corrected to a single period. The description reads cleanly now.
10-10: Verify icon semantic alignment.The icon is set to
"admin-multisite"(globe/network), which typically represents multi-site relationships or network concepts. For a reviews/testimonials block, an icon like"star","comment", or"format-quote"may be more semantically appropriate and user-friendly in the inserter UI.Confirm whether this icon choice is intentional (e.g., part of a centralised icon strategy across related blocks in this PR), or consider adjusting it for better UX clarity.
There was a problem hiding this comment.
Pull Request Overview
This PR successfully enhances six relationship blocks (review-related and cross-reference blocks) with comprehensive Block API v3 metadata, proper icon integration, and conditional registration logic. The changes improve block discoverability, user experience, and maintainability by standardizing metadata, adding descriptive keywords, and implementing context-aware block registration using a shared utility.
Key improvements:
- Enhanced block metadata with descriptions, keywords, and comprehensive examples
- Implemented conditional registration for appropriate post type contexts
- Corrected pattern slug references (changed from
destination-cardto appropriatereview-card,tour-card, andaccommodation-card) - Added proper localization throughout all blocks
- Integrated Dashicons for consistent visual presentation
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated 8 comments.
Show a summary per file
| File | Description |
|---|---|
src/blocks/review-related-accommodation/block.json |
Added Block API v3 metadata with description, keywords, icon, and example configuration |
src/blocks/review-related-accommodation/index.js |
Implemented conditional registration for accommodation posts with proper localization |
src/blocks/review-related-destination/block.json |
Enhanced with comprehensive metadata and example structure for destination reviews |
src/blocks/review-related-destination/index.js |
Added context-aware registration for destination posts with corrected pattern slug |
src/blocks/review-related-tour/block.json |
Standardized metadata with icon, keywords, and detailed example configuration |
src/blocks/review-related-tour/index.js |
Implemented conditional registration for tour posts with proper pattern reference |
src/blocks/tour-related-accommodation/block.json |
Added comprehensive metadata for accommodation-related tours cross-reference |
src/blocks/tour-related-accommodation/index.js |
Enhanced with conditional registration and corrected tour-card pattern slug |
src/blocks/tour-related-destination/block.json |
Standardized with Block API v3 metadata and example structure |
src/blocks/tour-related-destination/index.js |
Implemented destination context registration with proper pattern reference |
src/blocks/accommodation-related-tour/block.json |
Updated metadata, icon, keywords, and restructured example configuration |
src/blocks/accommodation-related-tour/index.js |
Added conditional registration for tour posts with accommodation-card pattern |
build/blocks/* |
Compiled versions of all source changes with updated asset hashes |
There was a problem hiding this comment.
Actionable comments posted: 2
♻️ Duplicate comments (2)
src/blocks/review-related-tour/index.js (1)
1-3: Add@sincemetadata and tidy up comment punctuation.Both JSDoc blocks at the top of the file and above
registerReviewRelatedTourVariationare missing the required@sincetag, and the summary lines (as well as the inline comment at Line 266) do not end with a full stop. Project guidelines call for every JSDoc to include@since <next-plugin-version>and for line comments to end with a period. Please add an appropriate@sincetag to both docblocks and update the comment text to end in full stops. As per coding guidelines.Also applies to: 8-10, 266-270
src/blocks/tour-related-destination/index.js (1)
1-10: Add@sincetags to both JSDoc comments.The file‑level and function‑level docblocks are still missing the required
@sinceannotation. Please add an appropriate version (for example@since 2.1.0, or whatever version this will ship in) to both comments to comply with the project’s JSDoc / WordPress documentation rules.
🧹 Nitpick comments (1)
src/blocks/review-related-tour/index.js (1)
4-6: Consider importing__from@wordpress/i18ninstead of using the global.Using
const { __ } = wp.i18n;relies on the globalwpobject; modern WordPress block code typically imports from@wordpress/i18nand declareswp-i18nas a script dependency instead. If the build setup allows, consider:-import { registerForPostTypes } from '@utils/conditional-block-registration.js'; - -const { __ } = wp.i18n; +import { __ } from '@wordpress/i18n'; +import { registerForPostTypes } from '@utils/conditional-block-registration.js';to better align with @wordpress/scripts patterns.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (4)
build/blocks/review-related-tour/index.asset.phpis excluded by!build/**build/blocks/review-related-tour/index.jsis excluded by!build/**build/blocks/tour-related-destination/index.asset.phpis excluded by!build/**build/blocks/tour-related-destination/index.jsis excluded by!build/**
📒 Files selected for processing (2)
src/blocks/review-related-tour/index.js(5 hunks)src/blocks/tour-related-destination/index.js(5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx}
⚙️ CodeRabbit configuration file
**/*.{js,ts,tsx,jsx}: Perform a detailed review of the provided code with following key aspects in mind:
- Review the code to ensure it is well-structured and adheres to best practices.
- Verify compliance with WordPress coding standards and @wordpress/eslint-plugin rules.
- Ensure the code is well-documented with proper JSDoc comments.
- Check for security vulnerabilities and confirm the code is secure.
- Optimize the code for performance, removing any unnecessary elements.
- Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
- Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features.
- Follow WordPress JavaScript coding standards and use WordPress script localization.
- Use WordPress script dependencies and enqueue properly.
- Ensure React/JSX best practices for blocks and modern JavaScript/TypeScript patterns.
- Implement proper error handling and loading states.
- Use WordPress components and design system where applicable.
- For Tour Operator: Focus on tour booking interfaces, search functionality, and tour display components.
Files:
src/blocks/review-related-tour/index.jssrc/blocks/tour-related-destination/index.js
src/blocks/**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
src/blocks/**/*.{js,jsx,ts,tsx}: - Follow WordPress JavaScript coding standards and @wordpress/scripts configuration.
- Use WordPress components from @wordpress/components and design system.
- Implement proper React/JSX patterns for WordPress blocks.
- Ensure proper WordPress script dependencies and localization.
- Use WordPress data store patterns with @wordpress/data.
- Implement proper error boundaries and loading states.
- Follow modern JavaScript/TypeScript patterns with proper typing.
- Ensure accessibility in interactive block components.
- Use WordPress block editor APIs correctly (useBlockProps, InspectorControls, etc.).
- Implement proper block validation and save/edit functionality.
Files:
src/blocks/review-related-tour/index.jssrc/blocks/tour-related-destination/index.js
🧬 Code graph analysis (2)
src/blocks/review-related-tour/index.js (2)
src/blocks/tour-related-destination/index.js (1)
conditionalRegister(390-393)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
src/blocks/tour-related-destination/index.js (2)
src/blocks/accommodation-related-destination/index.js (1)
conditionalRegister(396-399)src/js/conditional-block-registration.js (1)
registerForPostTypes(135-141)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: review
- GitHub Check: Summary
🔇 Additional comments (5)
src/blocks/review-related-tour/index.js (1)
111-161: Example structure and tour-specific className look solid.The example layout mirrors the registered variation nicely and the
className: 'lsx-review-related-tour-query'on the example group now correctly matches the tour variant, which should keep selector‑based styling and previews consistent.src/blocks/tour-related-destination/index.js (4)
11-28: Variation registration, metadata, and i18n look solid.The variation registration for
lsx-tour-operator/tour-related-destinationis well‑structured: metadata is clear, all user‑facing strings (title, description, metadata name) are wrapped in__()with the correcttour-operatortext domain, and the wrapperclassName/layout attributes are coherent. No functional issues spotted here.
53-57: Query configuration aligns with the “tours for a destination” use‑case.Targeting
postType: 'tour'withperPage: 6, ascendingorderBy: 'title', and using thelsx-tour-operator/tour-cardpattern inside a three‑column grid is consistent with how a “Related Tours” listing should behave and matches the surrounding block family. This section looks good.Also applies to: 77-84, 91-101
111-375: Example structure is consistent and uses the correct destination className.The inserter example is comprehensive, fully localised, and its inner group now correctly uses
className: 'lsx-tour-related-destination-query', matching the live variation’s query template. This should give editors an accurate preview without styling surprises.
379-385:isActivematcher is appropriate for this wrapper class.Using
isActiveto check for the exact wrapper class and a defensiveincludesfallback is a reasonable way to detect existing instances of this variation. This should behave reliably when users duplicate or further customise the block.
There was a problem hiding this comment.
Files selected (3)
- src/blocks/accommodation-related-destination/index.js (4)
- src/blocks/review-related-destination/index.js (6)
- src/blocks/tour-related-destination/index.js (5)
Files not summarized due to errors (3)
- src/blocks/accommodation-related-destination/index.js (diff tokens exceeds limit)
- src/blocks/review-related-destination/index.js (diff tokens exceeds limit)
- src/blocks/tour-related-destination/index.js (diff tokens exceeds limit)
Files not reviewed due to errors (3)
- src/blocks/accommodation-related-destination/index.js (no response)
- src/blocks/review-related-destination/index.js (no response)
- src/blocks/tour-related-destination/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.
There was a problem hiding this comment.
Actionable comments posted: 1
♻️ Duplicate comments (5)
src/blocks/tour-related-destination/index.js (3)
376-378:supports.renamingon a variation will not actually disable renaming.The
supports: { renaming: false }on thisregisterBlockVariationcall does not affect the underlyingcore/groupblock’s supports, so it will not prevent renaming in the editor. Renaming behaviour can currently only be controlled at the block type level (e.g. viasupports.renaminginblock.json), not per variation.If you do not plan to register a dedicated block type with
supports.renaming = false, it is less confusing to remove this property:- supports: { - renaming: false, - },
389-389: Terminate the inline comment with a full stop.The line comment should end with a period to comply with the project’s commenting convention:
-// Register conditionally for destination post types and destination templates +// Register conditionally for destination post types and destination templates.
1-10: Add @SInCE tags and full stops to the JSDoc headers.Both JSDoc-style docblocks are missing the required
@sinceannotation, and the summary lines should end with a full stop to match the project’s documentation rules. Consider something along these lines (adjust the version to the actual release you are targeting):/** - * Register Tour Related Destination block variation + * Register Tour Related Destination block variation. + * + * @since 2.1.0 */ /** - * Register the tours related to destination block variation + * Register the tours related to destination block variation. + * + * @since 2.1.0 */src/blocks/review-related-destination/index.js (2)
1-3: Add required@sincetags and finish sentences in JSDoc.Both JSDoc-style comments at the top of the file and above
registerReviewRelatedDestinationVariation()are missing the required@sincetag, and their description lines don’t end with a full stop. Please add an appropriate@sinceversion (the next plugin release, e.g.@since 2.1.0) to each block and end the description lines with a period to match the project’s documentation standard.Also applies to: 8-10
254-263:supports.renamingon the variation is ignored by the Block Variations API.The
supports: { renaming: false }property on the variation object won’t have any effect:wp.blocks.registerBlockVariation()only recognises documented variation keys (name,title,icon,keywords,attributes,innerBlocks,example,scope,isDefault,isActive, etc.), andsupportsisn’t among them. (developer.wordpress.org)If preventing renaming is important, you’ll need to enforce it at the block type level (e.g. via
block.jsonor ablock_type_metadatafilter) rather than on the variation object. In this variation, I’d suggest removing thesupportsblock to avoid confusion and duplicating that logic where it actually applies.Does the WordPress Block Variations API support a `supports` key (e.g. `supports.renaming`) on variation objects passed to `wp.blocks.registerBlockVariation`, or is `supports` limited to the block type registration (`registerBlockType` / `block.json`)?
🧹 Nitpick comments (2)
src/blocks/accommodation-related-destination/index.js (2)
51-56: Consider aligning heading text capitalisation for consistency.The heading content in the live variation is
Related accommodations(lowercase “a”), while the example heading usesRelated Accommodations(capital “A”). For a slightly more polished editor experience, you might want to standardise these to the same casing in both places.Also applies to: 114-137
111-113: Remove the unusedsupportsblock from the variation definition.The
supportsproperty on a block variation definition is not used by the Block Variations API. Thesupportsproperty belongs only to block type registration (registerBlockType / block.json), and registerBlockVariation does not apply or override block supports. Dropping thesupportsblock at lines 111-113 will prevent implying behaviour that doesn't occur.
📜 Review details
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (6)
build/blocks/accommodation-related-destination/index.asset.phpis excluded by!build/**build/blocks/accommodation-related-destination/index.jsis excluded by!build/**build/blocks/review-related-destination/index.asset.phpis excluded by!build/**build/blocks/review-related-destination/index.jsis excluded by!build/**build/blocks/tour-related-destination/index.asset.phpis excluded by!build/**build/blocks/tour-related-destination/index.jsis excluded by!build/**
📒 Files selected for processing (3)
src/blocks/accommodation-related-destination/index.js(4 hunks)src/blocks/review-related-destination/index.js(6 hunks)src/blocks/tour-related-destination/index.js(5 hunks)
🧰 Additional context used
📓 Path-based instructions (2)
**/*.{js,ts,tsx,jsx}
⚙️ CodeRabbit configuration file
**/*.{js,ts,tsx,jsx}: Perform a detailed review of the provided code with following key aspects in mind:
- Review the code to ensure it is well-structured and adheres to best practices.
- Verify compliance with WordPress coding standards and @wordpress/eslint-plugin rules.
- Ensure the code is well-documented with proper JSDoc comments.
- Check for security vulnerabilities and confirm the code is secure.
- Optimize the code for performance, removing any unnecessary elements.
- Validate JSDoc comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Confirm every JSDoc comment includes a @SInCE tag indicating the next version of the plugin to include the code.
- Guarantee compatibility with the latest version of WordPress, avoiding deprecated functions or features.
- Follow WordPress JavaScript coding standards and use WordPress script localization.
- Use WordPress script dependencies and enqueue properly.
- Ensure React/JSX best practices for blocks and modern JavaScript/TypeScript patterns.
- Implement proper error handling and loading states.
- Use WordPress components and design system where applicable.
- For Tour Operator: Focus on tour booking interfaces, search functionality, and tour display components.
Files:
src/blocks/accommodation-related-destination/index.jssrc/blocks/review-related-destination/index.jssrc/blocks/tour-related-destination/index.js
src/blocks/**/*.{js,jsx,ts,tsx}
⚙️ CodeRabbit configuration file
src/blocks/**/*.{js,jsx,ts,tsx}: - Follow WordPress JavaScript coding standards and @wordpress/scripts configuration.
- Use WordPress components from @wordpress/components and design system.
- Implement proper React/JSX patterns for WordPress blocks.
- Ensure proper WordPress script dependencies and localization.
- Use WordPress data store patterns with @wordpress/data.
- Implement proper error boundaries and loading states.
- Follow modern JavaScript/TypeScript patterns with proper typing.
- Ensure accessibility in interactive block components.
- Use WordPress block editor APIs correctly (useBlockProps, InspectorControls, etc.).
- Implement proper block validation and save/edit functionality.
Files:
src/blocks/accommodation-related-destination/index.jssrc/blocks/review-related-destination/index.jssrc/blocks/tour-related-destination/index.js
🧬 Code graph analysis (3)
src/blocks/accommodation-related-destination/index.js (2)
src/blocks/review-related-destination/index.js (1)
conditionalRegister(268-272)src/js/conditional-block-registration.js (1)
registerForPostTypesAndTemplates(170-177)
src/blocks/review-related-destination/index.js (1)
src/js/conditional-block-registration.js (1)
registerForPostTypesAndTemplates(170-177)
src/blocks/tour-related-destination/index.js (3)
src/blocks/accommodation-related-destination/index.js (1)
conditionalRegister(396-400)src/blocks/review-related-destination/index.js (1)
conditionalRegister(268-272)src/js/conditional-block-registration.js (1)
registerForPostTypesAndTemplates(170-177)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: review
- GitHub Check: Summary
🔇 Additional comments (7)
src/blocks/tour-related-destination/index.js (3)
11-375: Variation definition, i18n, and example content look good.The
registerTourRelatedDestinationVariationsetup is coherent: all user-facing strings (title, description, metadata names, headings, and example copy) are correctly wrapped in__with thetour-operatortext domain, the query configuration for tours is sensible, and the detailedexampletree will provide a clear inserter preview of the related-tours grid. No functional issues spotted in this variation definition.
379-385:isActivepredicate correctly matches the wrapper class.The
isActivefunction safely handles missingclassNameand correctly treats the variation as active when the wrapper class either matches exactly or is one of multiple classes. This should behave reliably for both newly inserted and existing blocks.
390-396: Conditional registration setup aligns with other relationship blocks.Using
registerForPostTypesAndTemplates( ['destination'], ['destination', 'country', 'region'], registerTourRelatedDestinationVariation )and invoking it viawp.domReady(conditionalRegister);mirrors the conditional-registration pattern shown for the other destination-related blocks, so registration should only occur in the intended destination contexts.src/blocks/review-related-destination/index.js (2)
12-111: Variation definition, i18n, and example structure look solid.The variation registration, innerBlocks configuration, and rich
exampledata are well put together: strings are correctly wrapped in__()with thetour-operatortextdomain, metadata and class names are consistent, and the query uses sane defaults for related reviews. This should give editors a clear inserter preview and a good starting layout.Also applies to: 112-253
267-274: Conditional registration for destination post types/templates is correctly wired.Using
registerForPostTypesAndTemplateswith['destination']post types and['destination', 'country', 'region']templates and hooking the resulting function intowp.domReadymatches the shared conditional-registration pattern and should ensure this variation only appears in relevant contexts.src/blocks/accommodation-related-destination/index.js (2)
12-110: Variation configuration, query, and example content are well structured.The accommodation-related destination variation is nicely put together: i18n is handled correctly, the query targets the
accommodationpost type with a sensible grid layout, and theexampletree provides rich, themed preview content that should make the inserter preview very helpful for editors.Also applies to: 114-383
395-402: Conditional registration mirrors the shared destination pattern correctly.The conditional registration via
registerForPostTypesAndTemplates(['destination'], ['destination', 'country', 'region'], registerAccommodationRelatedDestinationVariation)andwp.domReady(conditionalRegister);looks correct and consistent with the other relationship blocks, so this variation should only appear where it’s contextually relevant.
| /** | ||
| * Register Accommodation Related Destination block variation | ||
| */ |
There was a problem hiding this comment.
Add @since tags and end JSDoc description lines with a full stop.
The file-level and function-level JSDoc comments are missing @since annotations and their description lines don’t end with a period. Please add an appropriate @since version (the next plugin release, e.g. @since 2.1.0) to each block and terminate the description sentences with a full stop to comply with the project’s documentation rules.
Also applies to: 8-10
🤖 Prompt for AI Agents
In src/blocks/accommodation-related-destination/index.js lines 1-3 (and also
apply the same change to lines 8-10), the file-level and function-level JSDoc
descriptions are missing terminal periods and lack @since tags; update each
JSDoc block to end the description sentence with a full stop and add an @since
2.1.0 annotation to the file-level and function-level comments so they comply
with the project's documentation rules.
krugazul
left a comment
There was a problem hiding this comment.
Thanks for the changes, ive tested and they are working nicely.
There was a problem hiding this comment.
Files selected (1)
- src/blocks/accommodation-related-destination/index.js (4)
Files not summarized due to errors (1)
- src/blocks/accommodation-related-destination/index.js (diff tokens exceeds limit)
Files not reviewed due to errors (1)
- src/blocks/accommodation-related-destination/index.js (no response)
Review comments generated (0)
- Review: 0
- LGTM: 0
Tips
Chat with
CodeRabbit Bot (@coderabbitai)
- Reply on review comments left by this bot to ask follow-up questions. A review comment is a comment on a diff or a file.
- Invite the bot into a review comment chain by tagging
@coderabbitaiin a reply.
Code suggestions
- The bot may make code suggestions, but please review them carefully before committing since the line number ranges may be misaligned.
- You can edit the comment made by the bot and manually tweak the suggestion if it is slightly off.
Pausing incremental reviews
- Add
@coderabbitai: ignoreanywhere in the PR description to pause further reviews from the bot.


pr: '#694'
blocks:
post_types:
author: '@tibibuzdu'
labels: ['enhancement', 'blocks', 'frontend']
Summary
This PR implements GitHub issue #694 by enhancing review system and cross-referencing blocks with comprehensive Block API v3 metadata standardization, centralized icon integration, and conditional registration logic. The changes focus on relationship blocks (review-related and cross-reference blocks) while ensuring consistent user experience and proper Block Editor integration.
The conditional registration logic utilizes the reusable utility module introduced in PR #697 for better developer experience and easier maintainability across the codebase.
Key Changes
• Block API v3 Compliance: Enhanced metadata with comprehensive descriptions, keywords, and examples
• Icon System Integration: Replaced hardcoded icons with appropriate Dashicons for consistent visual presentation
• Conditional Registration: Implemented context-awareness for appropriate block visibility based on post types
• Enhanced Block Metadata: Added detailed descriptions, keywords, and comprehensive example configurations
• Improved User Experience: Applied consistent formatting and proper localization throughout
• Cross-Reference System: Improved relationship handling between tours, accommodations, destinations, and reviews
• Reusable Utilities: Leveraged shared conditional registration system for better maintainability
Files Modified
src/blocks/review-related-accommodation/block.json- Enhanced with full API v3 metadata and comprehensive supportssrc/blocks/review-related-accommodation/index.js- Improved with conditional registration for accommodation contextssrc/blocks/review-related-destination/block.json- Standardized metadata with enhanced descriptions and examplessrc/blocks/review-related-destination/index.js- Added conditional registration for destination contextssrc/blocks/review-related-tour/block.json- Comprehensive metadata with supports object and keywordssrc/blocks/review-related-tour/index.js- Enhanced registration with tour-context detectionsrc/blocks/tour-related-accommodation/block.json- API v3 compliance with detailed example configurationssrc/blocks/tour-related-accommodation/index.js- Improved with conditional registration and cross-reference logicsrc/blocks/tour-related-destination/block.json- Enhanced metadata and comprehensive supportssrc/blocks/tour-related-destination/index.js- Standardized with conditional registration and improved layoutsrc/blocks/accommodation-related-tour/block.json- Full metadata enhancement with keywords and examplessrc/blocks/accommodation-related-tour/index.js- Conditional registration with tour context awarenessScope
✅ PHP
✅ JS/Blocks
block.jsonupdates with descriptions and keywords✅ Styles
⏳ Tests
✅ Docs
Technical Implementation
Enhanced Block Metadata Structure
{ "apiVersion": 3, "description": "Display reviews related to accommodation posts.", "keywords": ["reviews", "accommodation", "related", "testimonials"], "example": { "attributes": { "metadata": { "name": "Related Reviews - Accommodation" } }, "innerBlocks": [/* Comprehensive example data */] } }Conditional Registration System
Cross-Reference Block Structure
Testing Notes
Related Issues
Closes #694
Block Relationships Enhanced
Review System Blocks
Cross-Reference Blocks
Summary by CodeRabbit
New Features
Refactor
Documentation
Summary by CodeRabbit
Release Notes
New Features
Documentation
Summary by CodeRabbit
New Features
Improvements