-
Notifications
You must be signed in to change notification settings - Fork 33
Merge trunk into develop after the wp-parsely 3.16.2 release #2680
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
Conversation
…ent_user_can_use_pch_feature` method.
Co-authored-by: Alex Cicovic <23142906+acicovic@users.noreply.github.com>
…-links PCH Smart Linking: Fix bug causing ‘No smart links’ error despite valid API response
…n-check Permissions: Add filter to override default permissions for PCH features
* Add timeout to `usePostData` hook * Improve documentation * Remove timeout and check if data has been resolved instead. * Fix spacing in JSDoc
* Filter out suggestions that are on headings or captions. * Fix minor CSS issue * Fix Editor Sidebar duplicated initialization * Prevent non allowed blocks from being selected in the UI * Prevent Smart Linking if the block is not in the ALLOWED_BLOCKS array. * Minor reorganization of the Smart_Linking class * Remove unneeded freeform block check. * Add block name to the Hint
* Update wp-parsely version number to 3.16.2 * Update CHANGELOG.md for version 3.16.2 * Remove empty line * Update wrong version number.
Release wp-parsely 3.16.2
WalkthroughWalkthroughThis update introduces version Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant Backend
participant Frontend
User->>Frontend: Interacts with smart linking feature
Frontend->>Backend: Request allowed blocks
Backend-->>Frontend: Returns allowed blocks
Frontend->>Frontend: Update UI based on allowed blocks
User->>Frontend: Selects a block
Frontend->>Backend: Process smart links for the selected block
Backend-->>Frontend: Returns processed smart links
Frontend-->>User: Display smart links
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configuration File (
|
|
My latest commit message contains a typo in the version number. However, the code is correct. |
|
Due to some issues, we used an intermediate branch to merge |
|
@vaurdan, this looks good to me, but just in case I'll let you review, approve and merge this. No urgency to merge this today, but let's have it merged before any new work is started against |
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.
Actionable comments posted: 1
Outside diff range, codebase verification and nitpick comments (3)
src/@types/assets/window.d.ts (1)
34-34: Add documentation for the new property.The new property
wpParselySmartLinkingAllowedBlocksshould have a JSDoc comment to explain its purpose and usage./** * The allowed blocks for Smart Linking. * * @since 3.16.2 */ wpParselySmartLinkingAllowedBlocks: string[];src/class-permissions.php (1)
86-98: Ensure the filter documentation is complete and accurate.The filter documentation is well-written, but ensure it includes all necessary details, such as the purpose and usage examples.
CHANGELOG.md (1)
8-8: Add missing punctuation to the version date.The date should be followed by a period for consistency.
- ## [3.16.2](https://github.com/Parsely/wp-parsely/compare/3.16.1...3.16.2) - 2024-07-30 + ## [3.16.2](https://github.com/Parsely/wp-parsely/compare/3.16.1...3.16.2) - 2024-07-30.
Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Files ignored due to path filters (5)
build/content-helper/editor-sidebar-rtl.cssis excluded by!build/**build/content-helper/editor-sidebar.asset.phpis excluded by!build/**build/content-helper/editor-sidebar.cssis excluded by!build/**build/content-helper/editor-sidebar.jsis excluded by!build/**package-lock.jsonis excluded by!**/package-lock.json
Files selected for processing (16)
- CHANGELOG.md (1 hunks)
- README.md (1 hunks)
- package.json (1 hunks)
- src/@types/assets/window.d.ts (1 hunks)
- src/class-permissions.php (1 hunks)
- src/content-helper/editor-sidebar/related-posts/hooks.ts (3 hunks)
- src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php (3 hunks)
- src/content-helper/editor-sidebar/smart-linking/component-block-overlay.tsx (1 hunks)
- src/content-helper/editor-sidebar/smart-linking/component-settings.tsx (8 hunks)
- src/content-helper/editor-sidebar/smart-linking/component.tsx (5 hunks)
- src/content-helper/editor-sidebar/smart-linking/smart-linking.scss (1 hunks)
- src/content-helper/editor-sidebar/smart-linking/smart-linking.tsx (3 hunks)
- src/content-helper/editor-sidebar/smart-linking/utils.ts (3 hunks)
- tests/e2e/specs/blocks/recommendations/settings.spec.ts (1 hunks)
- tests/e2e/utils.ts (1 hunks)
- wp-parsely.php (3 hunks)
Files skipped from review due to trivial changes (6)
- README.md
- package.json
- src/content-helper/editor-sidebar/smart-linking/component-block-overlay.tsx
- src/content-helper/editor-sidebar/smart-linking/smart-linking.scss
- tests/e2e/specs/blocks/recommendations/settings.spec.ts
- tests/e2e/utils.ts
Additional context used
Path-based instructions (9)
src/@types/assets/window.d.ts (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
src/content-helper/editor-sidebar/smart-linking/smart-linking.tsx (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
src/content-helper/editor-sidebar/related-posts/hooks.ts (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
src/class-permissions.php (1)
Pattern
**/*.{html,php}: "Perform a detailed review of the provided code with following key aspects in mind:
- Review the HTML and PHP code to ensure it is well-structured and adheres to best practices.
- Ensure the code follows WordPress coding standards and is well-documented.
- Confirm the code is secure and free from vulnerabilities.
- Optimize the code for performance, removing any unnecessary elements.
- Validate comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Verify code compatibility with the latest version of WordPress, avoiding deprecated functions or features."
src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php (1)
Pattern
**/*.{html,php}: "Perform a detailed review of the provided code with following key aspects in mind:
- Review the HTML and PHP code to ensure it is well-structured and adheres to best practices.
- Ensure the code follows WordPress coding standards and is well-documented.
- Confirm the code is secure and free from vulnerabilities.
- Optimize the code for performance, removing any unnecessary elements.
- Validate comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Verify code compatibility with the latest version of WordPress, avoiding deprecated functions or features."
src/content-helper/editor-sidebar/smart-linking/component-settings.tsx (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
wp-parsely.php (1)
Pattern
**/*.{html,php}: "Perform a detailed review of the provided code with following key aspects in mind:
- Review the HTML and PHP code to ensure it is well-structured and adheres to best practices.
- Ensure the code follows WordPress coding standards and is well-documented.
- Confirm the code is secure and free from vulnerabilities.
- Optimize the code for performance, removing any unnecessary elements.
- Validate comments for accuracy, currency, and adherence to WordPress coding standards.
- Ensure each line comment concludes with a period.
- Verify code compatibility with the latest version of WordPress, avoiding deprecated functions or features."
src/content-helper/editor-sidebar/smart-linking/component.tsx (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
src/content-helper/editor-sidebar/smart-linking/utils.ts (1)
Pattern
**/*.{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.
- Ensure the code is well-documented.
- 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."
Additional comments not posted (29)
src/content-helper/editor-sidebar/smart-linking/smart-linking.tsx (3)
38-38: LGTM!The new constant
ALLOWED_BLOCKSis correctly defined and documented.
50-52: LGTM!The updated logic for rendering the
BlockEditcomponent is correctly implemented and enhances the functionality.
72-74: LGTM!The updated logic for rendering the
SmartLinkingInspectorControlPanelcomponent is correctly implemented and enhances the functionality.src/content-helper/editor-sidebar/related-posts/hooks.ts (4)
40-41: LGTM!The new state variables
isLoadingandhasResolvedare correctly defined and documented.
104-110: LGTM!The updated logic for checking the loading state is correctly implemented and follows best practices.
111-119: LGTM!The updated logic for checking the resolution of data is correctly implemented and follows best practices.
131-150: LGTM!The updated logic for setting the post data is correctly implemented and follows best practices.
src/class-permissions.php (2)
99-105: Verify the default value for the filter.The default value for the filter is set to
false. Ensure this is the intended behavior and document any implications.
107-109: Check the conditional logic for the filter result.The conditional logic prioritizes the filtered result over the default logic. Ensure this does not introduce any unintended behavior.
src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php (2)
47-47: Ensure the script is enqueued correctly.The method
add_inline_scriptis hooked toadmin_enqueue_scripts. Verify this is the correct hook for the intended functionality.
186-205: Ensure the inline script is secure.The inline script sets a global variable. Ensure the data is sanitized and secure.
src/content-helper/editor-sidebar/smart-linking/component-settings.tsx (9)
4-5: Ensure all imports are necessary and correct.The imports include
BlockInstanceandgetBlockType. Verify these are necessary and used correctly.
30-30: Ensure the type definition is accurate.The type definition for
selectedBlockhas been updated. Verify this change is accurate and necessary.
53-54: Ensure the new state variableselectedBlockIdis used correctly.The new state variable
selectedBlockIdis introduced. Verify it is used correctly throughout the component.
92-93: Ensure the initial state ofapplyToValueis correct.The initial state of
applyToValueis set based onapplyToandselectedBlockId. Verify this logic is correct.
101-107: Ensure theuseEffecthook handles the selected block correctly.The
useEffecthook updatesapplyToValuebased on the selected block. Verify this logic is correct and handles all edge cases.
144-169: Ensure themoveButtonAndShowHintfunction is implemented correctly.The
moveButtonAndShowHintfunction is updated to be asynchronous and accept ahintTextparameter. Verify this implementation is correct and handles all edge cases.
178-186: Ensure theuseEffecthook handles block selection correctly.The
useEffecthook handles scenarios where no block is selected or the selected block is not allowed. Verify this logic is correct and handles all edge cases.
207-215: Ensure the workaround forToggleGroupControlis necessary and correct.The
useEffecthook includes a workaround for setting the value ofToggleGroupControl. Verify this workaround is necessary and implemented correctly.
225-225: Ensure the hint reset logic is correct.The
useEffecthook resets the hint when the selected block changes. Verify this logic is correct.wp-parsely.php (3)
14-14: Version update approved.The version number has been correctly updated to
3.16.2in the plugin header.
73-73: Version update approved.The version number has been correctly updated to
3.16.2in the constant declaration.
298-307: Conditional check for$GLOBALS['parsely_editor_sidebar']approved.The conditional check ensures that the
Editor_Sidebaris only instantiated if it is not already set, preventing unnecessary re-initialization.src/content-helper/editor-sidebar/smart-linking/component.tsx (3)
354-355: Return type forprocessSmartLinksapproved.The return type
Promise<SmartLink[]>enhances type safety and clarity.
Line range hint
357-433: Return statement inprocessSmartLinksapproved.The return statement ensures that the processed smart links are returned, which is essential for the calling context.
472-482: Updated error handling ingenerateSmartLinksapproved.The error handling has been updated to reflect the new processing logic, ensuring consistency.
src/content-helper/editor-sidebar/smart-linking/utils.ts (2)
109-130: New functionisInsideHeadingOrCaptionapproved.This function enhances the logic for determining the context of nodes during smart linking operations.
380-394: UpdatedcalculateSmartLinkingMatchesfunction approved.The updates ensure that links are only created in appropriate contexts, improving the overall robustness of the feature.
CHANGELOG.md (1)
10-15: Ensure consistency in the changelog format.The changelog entries are clear and consistent with the previous sections.
This PR merges the trunk branch into the develop branch after the release of wp-parsely 3.16.2.
Summary by CodeRabbit
New Features
Bug Fixes
Documentation
3.16.2.Chores
3.16.2.