-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
base: main
Are you sure you want to change the base?
Conversation
There's might be a better solution, but this the quick one that I go with, @MichaelPetrinolis could you please try the PR |
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.
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!
I tried to avoid depending on /cc @Skrypt |
src/OrchardCore.Modules/OrchardCore.ContentLocalization/DefaultContentLocalizationManager.cs
Outdated
Show resolved
Hide resolved
@coderabbitai review |
WalkthroughWalkthroughThe 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
Assessment against linked issues
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 (
|
Seems coderabbitai ignores my PR :) |
Hmm, it seems it didn't actually do a review. I've asked the CR team about this. |
@MichaelPetrinolis the new update might much better |
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: 0
Out of diff range and nitpick comments (1)
src/OrchardCore.Modules/OrchardCore.ContentLocalization/Handlers/AutoPartContentLocalizationHandler.cs (1)
11-19
: The logic to clear theAutoroutePart
path is correctly implemented to support automatic permalink regeneration.Consider adding a comment explaining why the path is set to null, for future maintainability.
...dCore.Modules/OrchardCore.ContentLocalization/Handlers/AutoPartContentLocalizationHandler.cs
Outdated
Show resolved
Hide resolved
...dCore.Modules/OrchardCore.ContentLocalization/Handlers/AutoPartContentLocalizationHandler.cs
Outdated
Show resolved
Hide resolved
...dCore.Modules/OrchardCore.ContentLocalization/Handlers/AutoPartContentLocalizationHandler.cs
Outdated
Show resolved
Hide resolved
Co-authored-by: Zoltán Lehóczky <zoltan.lehoczky@lombiq.com>
src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutorouteContentLocalizationHandler.cs
Show resolved
Hide resolved
src/OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutorouteContentLocalizationHandler.cs
Show resolved
Hide resolved
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.
This doesn't fix the issue:
2024-05-02_20h06_41.mp4
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.
Please try it without your last suggestion - Using Alter - I'm 100% percentage sure it was working as expected
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.
This is weird I don't know why the
context.ContentItem.Alter<AutoroutePart>(p => p.Path = null);
doesn't work as expected here?!! Do you have any idea or shall I revert the last change
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.
That's good, but please make it work in a statically typed way. We don't need dynamic for this.
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.
I don't know, sorry, I'd also need to get into debugging this to figure it out.
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.
We might need to revise this, using CloningAsync()
might resolve the issue but not make sense while LocalizingAsync()
should be the suited event for that
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.
if that is the case, then call _session.SaveAsync() after calling LocalizingAsync. But honestly, this sounds like a bad idea to me. IContentHandler should be the right event to hook into at that point. LocalizingAsync should not be used to alter the content item.
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.
LocalizingAsync should not be used to alter the content item.
For that I alert the autoroute path without using Alter()
just to solve the above issue
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.
Can you create a test case for the Alter method to make sure STJ isn't causing a problem? Alter should work.
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.
This is #15714 a recent PR that I merged, the Alter was working fine
This pull request has merge conflicts. Please resolve those before requesting a review. |
@hishamco is this something you want to finish up soon? The longer these PR's stay open the higher the change for conflicts (like the one I just fixed). Also, the longer this take, the less interest from reviewers you'll get in your PRs. I suggest addressing and following up on these PR, otherwise close them. |
AFAIK this is ready, but sometimes it happens due the review that's why I mentioned some points in the Discord, in the maintainer channel, seems you are not there yet |
This is waiting for you. I commented that the code, which is still the current one doesn't work: https://github.com/OrchardCMS/OrchardCore/pull/15810/files#r1588088481 Mike also had follow-up comments. Once you fix it, please re-request review. There are also build errors now BTW. |
I just noticed that, seems this happen after merging main |
FYI both of Mike's suggestions in the comment don't work, so the current implementation is working as expected |
Autoroute.mp4 |
We still shouldn't have to use |
We already use |
Yes, and we shouldn't use |
So what's the better option here? This PR stays long, let us finalize it before you go into your vacation :) |
|
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 |
This pull request has merge conflicts. Please resolve those before requesting a review. |
for instructions on how to resolve the merge conflicts due to #16572 please follow the step listed in this comment. |
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. |
Fixes #15805
Summary by CodeRabbit
New Features
Refactor
Documentation