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

Avoid cloning the AutoroutePart pattern in the localized content #15810

Merged
merged 25 commits into from
Jan 26, 2025

Conversation

hishamco
Copy link
Member

@hishamco hishamco commented Apr 23, 2024

Fixes #15805

Summary by CodeRabbit

  • New Features

    • Enhanced content localization by automatically regenerating permalinks when localizing content.
    • Expanded service configurations to support new localization features across content culture pickers and sitemaps.
  • Refactor

    • Introduced new handlers and services for improved content localization management.
  • Documentation

    • Updated project references to support new localization functionalities.

@hishamco
Copy link
Member Author

There's might be a better solution, but this the quick one that I go with, @MichaelPetrinolis could you please try the PR

Copy link
Contributor

@MichaelPetrinolis MichaelPetrinolis left a comment

Choose a reason for hiding this comment

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

If adding a dependency to Autoroute Core is ok, clearing the autoroutepart path does the job. Either it is draftable or not, the localized version has empty path and the user is able to update eg. the localized title and create a localized route. Thanx!

@hishamco
Copy link
Member Author

I tried to avoid depending on OC.Autoroute module, but still looking for a better solution if there's

/cc @Skrypt

@hishamco
Copy link
Member Author

@coderabbitai review

Copy link
Contributor

coderabbitai bot commented Apr 24, 2024

Walkthrough

Walkthrough

The update involves improving the content localization process in OrchardCore by automatically regenerating permalinks when content is localized. This enhancement ensures that the autoroute path is correctly handled during localization, addressing a specific issue related to culture names in the path pattern.

Changes

File Path Change Summary
.../DefaultContentLocalizationManager.cs Added logic to clear AutoroutePart path for permalink regeneration during content localization.
.../OrchardCore.ContentLocalization.csproj Added a project reference to OrchardCore.Autoroute.Core.csproj to support the new localization functionality.
.../AutoPartContentLocalizationHandler.cs Introduced a new class AutoPartContentLocalizationHandler implementing IContentLocalizationHandler methods.
.../Startup.cs Various changes including namespace additions and method modifications to support content localization features.

Assessment against linked issues

Objective Addressed Explanation
Content Localization Autoroute problem with culture name in path (#15805) The changes address the issue by enhancing the content localization process to handle autoroute paths correctly.

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.

@hishamco
Copy link
Member Author

Seems coderabbitai ignores my PR :)

@Piedone
Copy link
Member

Piedone commented Apr 24, 2024

Hmm, it seems it didn't actually do a review. I've asked the CR team about this.

@hishamco
Copy link
Member Author

hishamco commented May 1, 2024

@MichaelPetrinolis the new update might much better

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

Out of diff range and nitpick comments (1)
src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/AutoPartContentLocalizationHandler.cs (1)

11-19: The logic to clear the AutoroutePart path is correctly implemented to support automatic permalink regeneration.

Consider adding a comment explaining why the path is set to null, for future maintainability.

@hishamco hishamco requested a review from Piedone May 2, 2024 10:49
@hishamco hishamco requested a review from Piedone May 2, 2024 16:49
@hishamco hishamco requested a review from Piedone May 2, 2024 17:42
@hishamco
Copy link
Member Author

I already tried many times without luck, and I will try one more time, otherwise let us accept this while it fixes a real issue then we could revise the places that we are using dynamic in the future

Copy link
Contributor

This pull request has merge conflicts. Please resolve those before requesting a review.

@MikeAlhayek
Copy link
Member

for instructions on how to resolve the merge conflicts due to #16572 please follow the step listed in this comment.

Copy link
Contributor

It seems that this pull request didn't really move for quite a while. Is this something you'd like to revisit any time soon or should we close? Please comment if you'd like to pick it up.

@github-actions github-actions bot added the stale label Oct 14, 2024
Copy link
Contributor

@gvkries gvkries left a comment

Choose a reason for hiding this comment

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

@hishamco I fixed a merge error in the startup. Also I think there has been some fixes, you can go with Alter now and we can finalize this.

@hishamco hishamco requested a review from gvkries January 25, 2025 00:51
@hishamco
Copy link
Member Author

Also I think there has been some fixes, you can go with Alter now and we can finalize this.

Do you mean the one that you suggested?

@hishamco
Copy link
Member Author

@Piedone, it seems we forgot this one, is there anything else we should add?

Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

Well, I was waiting for you to address the latest comments and request review again :).

Comment on lines 138 to 139
[RequireFeatures("OrchardCore.Autoroute")]
public class AutoPartStartup : StartupBase
Copy link
Member

Choose a reason for hiding this comment

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

I suppose this should rather be?

Suggested change
[RequireFeatures("OrchardCore.Autoroute")]
public class AutoPartStartup : StartupBase
[RequireFeatures("OrchardCore.ContentLocalization")]
public class LocalizationStartup : StartupBase

Copy link
Member Author

Choose a reason for hiding this comment

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

ContentLocalizationStartup will be better, to avoid the conflict between localization & content localization modules

Copy link
Member Author

Choose a reason for hiding this comment

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

BTW I didn't notice there was other feedback except your latest comments. Are there any?

Copy link
Member

Choose a reason for hiding this comment

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

ContentLocalizationStartup will be better, to avoid the conflict between localization & content localization modules

Sure.

BTW I didn't notice there was other feedback except your latest comments. Are there any?

No.

@hishamco
Copy link
Member Author

Well, I was waiting for you to address the latest comments and request review again :).

Frankly, I lost because there were many comments

@hishamco hishamco requested a review from Piedone January 25, 2025 23:32
Copy link
Member

@Piedone Piedone left a comment

Choose a reason for hiding this comment

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

@gvkries please merge if OK from your side too.

@gvkries gvkries merged commit bee9b18 into main Jan 26, 2025
17 checks passed
@gvkries gvkries deleted the hishamco/issue-15805 branch January 26, 2025 10:51
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.

Content Localization Autoroute problem with culture name in path
5 participants