Skip to content

Fix site handing after enabling user time zone feature - #17071

Merged
MikeAlhayek merged 3 commits into
mainfrom
hishamco/user-timezone
Nov 26, 2024
Merged

MikeAlhayek merged 3 commits into
mainfrom
hishamco/user-timezone

Conversation

@hishamco

@hishamco hishamco commented Nov 26, 2024 •

Copy link
Copy Markdown
Member

Fix #17069

@hishamco
hishamco requested a review from MikeAlhayek November 26, 2024 08:20
@hishamco
hishamco marked this pull request as draft November 26, 2024 08:34
@hishamco
hishamco marked this pull request as ready for review November 26, 2024 09:14
Comment thread src/OrchardCore.Modules/OrchardCore.Users/TimeZone/Handlers/UserEventHandler.cs Outdated
@MikeAlhayek

Copy link
Copy Markdown
Member

@hishamco the actual fix here is not to resolve UserManager<IUser> or UserStore in UserTimeZoneService. Have a look at PR #17073

@hishamco

Copy link
Copy Markdown
Member Author

@hishamco the actual fix here is not to resolve UserManager or UserStore in UserTimeZoneService

Did you try the PR? I already tested

@MikeAlhayek

Copy link
Copy Markdown
Member

Did you try the PR? I already tested

Yes. The reason why you PR works, is because you no longer resolve UserManager<> from the handler which is causing the circular dependency. So if instead of injecting UserManager<> to get user name, get the user using ISession this way we can keep the cache centralized in one place. settings the cache in one place and then invalid it using another service is not a good idea from maintenance perspective.

@hishamco

Copy link
Copy Markdown
Member Author

Nothing but I saw the you mix both the service & the handler which is against the standard

@MikeAlhayek

MikeAlhayek commented Nov 26, 2024 •

Copy link
Copy Markdown
Member

Nothing but I saw the you mix both the service & the handler which is against the standard

@hishamco

From design, what we have is perfectly fine. I am okay with this PR as long as you expose GetCacheKey internally and use the same method in both classes.

@MikeAlhayek
MikeAlhayek enabled auto-merge (squash) November 26, 2024 18:46
@MikeAlhayek
MikeAlhayek merged commit 1061902 into main Nov 26, 2024
@MikeAlhayek
MikeAlhayek deleted the hishamco/user-timezone branch November 26, 2024 18:50
@MikeAlhayek

Copy link
Copy Markdown
Member

/backport to release/2.1

@github-actions

Copy link
Copy Markdown
Contributor

Started backporting to release/2.1: https://github.com/OrchardCMS/OrchardCore/actions/runs/12037243179

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.

User Time Zone feature results in DI loop

3 participants