-
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
Open
hishamco
wants to merge
18
commits into
main
Choose a base branch
from
hishamco/issue-15805
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+34
−0
Open
Changes from 8 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
a491b55
Avoid cloning the AutoPart pattern in the localized content
hishamco 77d190b
Merge branch 'main' into hishamco/issue-15805
hishamco 4e8b6cb
Address feedback
hishamco 9abfd72
Merge branch 'main' into hishamco/issue-15805
hishamco 96a224d
Merge branch 'main' into hishamco/issue-15805
hishamco 69793d2
Apply suggestions from code review
hishamco 143ec74
Merge branch 'main' into hishamco/issue-15805
hishamco 2f6f73b
Move AutorouteContentLocalizationHandler to Autoroute module
hishamco 11280d1
Address feedback
hishamco 62cc6b1
Merge branch 'main' into hishamco/issue-15805
hishamco c05564f
Merge branch 'main' into hishamco/issue-15805
hishamco 3c33271
Merge branch 'main' into hishamco/issue-15805
MikeAlhayek af0ab20
Merge branch 'main' into hishamco/issue-15805
hishamco cd4662e
Merge branch 'main' into hishamco/issue-15805
hishamco 7965e24
Merge branch 'main' into hishamco/issue-15805
hishamco bd997d0
Fix the build
hishamco 6246634
Don't use Alert<TPart>()
hishamco 0703ec2
Merge branch 'main' into hishamco/issue-15805
hishamco File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
...OrchardCore.Modules/OrchardCore.Autoroute/Handlers/AutorouteContentLocalizationHandler.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
using System.Threading.Tasks; | ||
using OrchardCore.Autoroute.Models; | ||
using OrchardCore.ContentManagement; | ||
|
||
namespace OrchardCore.ContentLocalization.Handlers; | ||
|
||
public class AutorouteContentLocalizationHandler : IContentLocalizationHandler | ||
Piedone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
{ | ||
public Task LocalizedAsync(LocalizationContentContext context) => Task.CompletedTask; | ||
|
||
public Task LocalizingAsync(LocalizationContentContext context) | ||
{ | ||
if (context.ContentItem.Has<AutoroutePart>()) | ||
{ | ||
// Clearing the AutoroutePart path to regenerate the permalink automatically. | ||
context.ContentItem.Content.AutoroutePart.Path = null; | ||
Piedone marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
|
||
return Task.CompletedTask; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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 whileLocalizingAsync()
should be the suited event for thatThere 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.
For that I alert the autoroute path without using
Alter()
just to solve the above issueThere 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