Skip to content
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

Update version number and changelog for 3.16.2 release #2676

Merged
merged 5 commits into from
Jul 30, 2024

Conversation

vaurdan
Copy link
Contributor

@vaurdan vaurdan commented Jul 30, 2024

This PR updates the plugin's version number and changelog in preparation for the 3.16.2 release.

Fixed

  • PCH Smart Linking: Prevent suggesting links in unexpected blocks (#2673)
  • PCH Related Posts: Prevent Related Posts indefinite loading (#2666)
  • Permissions: Allow overriding of PCH feature permissions (#2663)
  • PCH Smart Linking: Fix bug causing ‘No smart links’ error despite valid API response (#2662)

Summary by CodeRabbit

  • New Features

    • Enhanced Smart Linking functionality to prevent unexpected link suggestions.
    • Improved Related Posts feature to eliminate indefinite loading issues.
    • Added customizable permissions for PCH features.
    • New setting for allowed blocks in Smart Linking.
  • Bug Fixes

    • Resolved 'No smart links' error when valid API responses are received.
  • Versioning

    • Updated project version from 3.16.1 to 3.16.2 in multiple places.

@vaurdan vaurdan requested a review from a team as a code owner July 30, 2024 09:44
@vaurdan vaurdan added this to the 3.16.2 milestone Jul 30, 2024
@vaurdan vaurdan self-assigned this Jul 30, 2024
Copy link
Contributor

coderabbitai bot commented Jul 30, 2024

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Base branches to auto review (4)
  • develop
  • add/.*
  • fix/.*
  • update/.*

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Walkthrough

The recent update to the Parse.ly WordPress plugin introduces version 3.16.2, featuring enhancements to the Personalized Content Hub (PCH) functionalities. Key improvements include refined Smart Linking capabilities, better handling of Related Posts loading issues, and an updated permissions system for increased user flexibility. Additional modifications bolster TypeScript definitions, improve error handling in smart linking, and provide new state management for enhanced user interactions across the editor interface.

Changes

File(s) Change Summary
CHANGELOG.md, README.md, package.json, wp-parsely.php Updated versioning details to indicate release of version 3.16.2, including bug fixes and enhancements across the plugin.
src/@types/assets/window.d.ts, src/class-permissions.php Introduced new TypeScript property for smart linking block permissions and added a filter for customizable PCH feature access permissions.
src/content-helper/editor-sidebar/related-posts/hooks.ts, src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php Enhanced post data loading states and refined Smart Linking functionality through new allowed blocks and inline script applications.
src/content-helper/editor-sidebar/smart-linking/component-settings.tsx, src/content-helper/editor-sidebar/smart-linking/component.tsx Improved handling of selected blocks in settings and clarified smart links processing with enhanced type safety and error handling.
src/content-helper/editor-sidebar/smart-linking/utils.ts Added functionality to check DOM context for smart links and refined link processing with condition checks on allowed blocks.
tests/e2e/utils.ts Updated the version constant without altering logic or functionality.
src/content-helper/editor-sidebar/smart-linking/smart-linking.scss Introduced new CSS styles for UI improvements in the smart linking component.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant Editor as Smart Linking Editor
    participant Plugin as Parse.ly Plugin
    participant API as External API

    User->>Editor: Selects a block
    Editor->>Plugin: Check if block is allowed
    Plugin-->>Editor: Returns allowed status
    Editor->>API: Fetch smart links
    API-->>Editor: Returns smart links
    Editor-->>User: Displays smart links
Loading

This diagram illustrates the interaction flow when a user selects a block in the Smart Linking Editor, showcasing how the plugin checks permissions and retrieves 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?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@vaurdan vaurdan changed the base branch from develop to prepare/3.16.2 July 30, 2024 09:48
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range, codebase verification and nitpick comments (1)
CHANGELOG.md (1)

8-8: Add release date for version 3.16.2.

Including the release date helps users understand when the changes were made.

- ## [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

Commits

Files that changed from the base of the PR and between 668e171 and ee0d77d.

Files ignored due to path filters (5)
  • build/content-helper/editor-sidebar-rtl.css is excluded by !build/**
  • build/content-helper/editor-sidebar.asset.php is excluded by !build/**
  • build/content-helper/editor-sidebar.css is excluded by !build/**
  • build/content-helper/editor-sidebar.js is excluded by !build/**
  • package-lock.json is excluded by !**/package-lock.json
Files selected for processing (14)
  • 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-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/utils.ts (1 hunks)
  • wp-parsely.php (3 hunks)
Files skipped from review due to trivial changes (4)
  • README.md
  • package.json
  • src/content-helper/editor-sidebar/smart-linking/smart-linking.scss
  • 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 (28)
src/@types/assets/window.d.ts (1)

34-34: LGTM!

The addition of the wpParselySmartLinkingAllowedBlocks property to the Window interface is well-structured and logically sound.

src/content-helper/editor-sidebar/smart-linking/smart-linking.tsx (4)

26-30: LGTM!

The DEFAULT_MAX_LINKS constant is well-documented and adheres to WordPress coding standards.


33-38: LGTM!

The ALLOWED_BLOCKS constant is well-documented and enhances the flexibility of the smart linking feature.


48-50: LGTM!

The withSettingsProvider function correctly checks if the block name is included in ALLOWED_BLOCKS, enhancing the functionality.


72-72: LGTM!

The SmartLinkingInspectorControlPanel function correctly checks if the block name is included in ALLOWED_BLOCKS and if the block is selected, ensuring proper functionality.

src/content-helper/editor-sidebar/related-posts/hooks.ts (3)

7-7: LGTM!

The import statement for useEffect and useState is correct and necessary for the added functionality.


Line range hint 12-41:
LGTM!

The PostData interface is well-defined and the documentation comments are clear and adhere to WordPress coding standards.


Line range hint 48-152:
LGTM!

The usePostData function is well-structured and the added state management for loading and resolution improves the reliability of the data handling. The code adheres to best practices.

src/class-permissions.php (2)

86-98: Ensure accurate and secure filter usage.

The new filter wp_parsely_current_user_can_use_pch_feature allows overriding the default permissions check. Ensure that this filter is used securely and that any custom implementations properly validate user capabilities to prevent unauthorized access.


99-109: LGTM! Verify the filter's impact on permissions.

The code changes are approved.

However, ensure that the filter's impact on permissions is thoroughly tested to prevent any security vulnerabilities.

src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php (2)

25-34: LGTM! Ensure the allowed blocks are appropriate.

The constant BLOCKS_ALLOWED is correctly defined. Ensure that the allowed blocks are appropriate for the Smart Linking feature and do not introduce any security risks.


186-205: LGTM! Verify the inline script's security.

The method add_inline_script is correctly implemented. Ensure that the inline script added is secure and does not introduce any vulnerabilities.

Verification successful

To ensure the security of the inline script added by the add_inline_script method, we need to verify the definition and sanitization of self::BLOCKS_ALLOWED and the usage of the apply_filters function.


To ensure the security of the inline script added by the add_inline_script method, we need to re-run the search for the usage of apply_filters with the correct syntax.


To ensure the security of the inline script added by the add_inline_script method, we need to inspect the definition of BLOCKS_ALLOWED and review its content.


Verification Complete: Inline Script Security Confirmed

The add_inline_script method is correctly implemented and secure. The BLOCKS_ALLOWED constant contains safe predefined block types, and the apply_filters function does not introduce any unsafe data.

  • The BLOCKS_ALLOWED constant is defined as:
    private const BLOCKS_ALLOWED = array(
        'core/paragraph',
    );
  • The apply_filters function is used directly with this constant, ensuring no unsafe modifications.
Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Verify the security of the inline script added by the `add_inline_script` method.

# Test: Search for the method usage and ensure proper testing of the inline script.
rg --type php 'add_inline_script'

Length of output: 1076


Script:

#!/bin/bash
# Description: Verify the definition and sanitization of `self::BLOCKS_ALLOWED` and the usage of `apply_filters`.

# Search for the definition of `BLOCKS_ALLOWED` in the codebase.
rg --type php 'const BLOCKS_ALLOWED'

# Search for the usage of `apply_filters` for the 'wp_parsely_smart_linking_allowed_blocks' filter.
rg --type php 'apply_filters( \'wp_parsely_smart_linking_allowed_blocks\''

Length of output: 243


Script:

#!/bin/bash
# Description: Verify the definition and sanitization of `self::BLOCKS_ALLOWED` and the usage of `apply_filters`.

# Search for the definition of `BLOCKS_ALLOWED` in the codebase.
rg --type php 'const BLOCKS_ALLOWED'

# Search for the usage of `apply_filters` for the 'wp_parsely_smart_linking_allowed_blocks' filter.
rg --type php "apply_filters\( 'wp_parsely_smart_linking_allowed_blocks'"

Length of output: 405


Script:

#!/bin/bash
# Description: Retrieve the definition of `BLOCKS_ALLOWED` to review its content.

# Display the definition of `BLOCKS_ALLOWED` in the codebase.
rg --type php --context 10 'const BLOCKS_ALLOWED' src/content-helper/editor-sidebar/smart-linking/class-smart-linking.php

Length of output: 512

src/content-helper/editor-sidebar/smart-linking/component-settings.tsx (6)

30-30: LGTM! Ensure the type change is correctly handled.

The selectedBlock prop type has been updated to BlockInstance | null. Ensure that this type change is correctly handled throughout the component.


53-54: LGTM! Ensure the new state variable is correctly used.

The new state variable selectedBlockId is correctly introduced. Ensure that it is correctly used throughout the component.


92-93: LGTM! Ensure the state initialization is correct.

The applyToValue state is correctly initialized based on the new selectedBlockId. Ensure that the state initialization is correct and does not introduce any issues.


94-107: LGTM! Ensure the useEffect hook handles the selected block correctly.

The useEffect hook has been updated to handle cases where the selected block is not allowed. Ensure that the hook handles the selected block correctly and does not introduce any issues.


144-169: LGTM! Ensure the moveButtonAndShowHint function is correctly implemented.

The moveButtonAndShowHint function has been modified to accept a hintText parameter. Ensure that the function is correctly implemented and does not introduce any issues.


178-186: LGTM! Ensure the useEffect hook handles unsupported blocks correctly.

The useEffect hook has been updated to handle cases where the selected block is not supported. Ensure that the hook handles unsupported blocks correctly and does not introduce any issues.

wp-parsely.php (3)

14-14: Version update approved.

The version number has been correctly updated to 3.16.2.


73-73: Version update approved.

The PARSELY_VERSION constant has been correctly updated to 3.16.2.


298-307: Conditional check for Editor_Sidebar initialization approved.

The added check ensures that the Editor_Sidebar object is only instantiated if it has not already been set, enhancing code robustness.

src/content-helper/editor-sidebar/smart-linking/component.tsx (4)

354-355: Return type specification approved.

The return type of processSmartLinks has been correctly specified as Promise<SmartLink[]>, improving type safety and clarity.


357-357: Filtering logic approved.

The function now correctly filters out links that have already been applied, preventing duplicates.


472-482: Error handling logic approved.

The updated error handling logic improves specificity by throwing a clear error code when no smart links are generated.


699-699: Rendering logic approved.

The selectedBlock prop is now passed directly to the SmartLinkingSettingsComponent, streamlining interactions with the selected block.

src/content-helper/editor-sidebar/smart-linking/utils.ts (2)

109-130: New function isInsideHeadingOrCaption approved.

The function enhances the ability to identify specific structural contexts in the DOM tree, improving the robustness of the smart linking feature.


380-394: Updates to calculateSmartLinkingMatches function approved.

The function now includes checks for allowed blocks and uses the isInsideHeadingOrCaption function to skip processing links in inappropriate contexts, improving the relevance and robustness of the smart linking feature.

CHANGELOG.md (1)

12-15: Ensure clarity and consistency in fix descriptions.

The descriptions are clear and accurately reflect the changes made. Ensure consistency in the formatting.

@vaurdan vaurdan merged commit 7b1d357 into prepare/3.16.2 Jul 30, 2024
35 checks passed
@vaurdan vaurdan deleted the update/wp-parsely-version-to-3.16.2 branch July 30, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant