-
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
Add GraphQL support to UserPickerField #15389
Conversation
hyzx86
commented
Feb 22, 2024
@@ -10,6 +10,6 @@ public class Startup : StartupBase | |||
public override void ConfigureServices(IServiceCollection services) | |||
{ | |||
services.AddSingleton<ISchemaBuilder, CurrentUserQuery>(); | |||
services.AddTransient<UserType>(); | |||
services.AddSingleton<UserType>(); |
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.
Hi @gvkries , Do you have any other suggestions on how to reuse this type, which would cause an error if you used Transient lifetime?
Could you help to Review this PR? Thanks!
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.
The UserType
is currently only populated by the CurrentUserQuery
schema builder. It is not individually registered as a type in GraphQL, so I guess that has to change. I need to think about this...
@hishamco Could you help to review this PR? Thanks! |
Not ready, Not ready, now the type updates will cause an error |
We will check once it's ready |
Now I have a sequence-dependent problem. When I implement However, if I migrate |
src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Startup.cs
Outdated
Show resolved
Hide resolved
@@ -10,6 +10,6 @@ public class Startup : StartupBase | |||
public override void ConfigureServices(IServiceCollection services) | |||
{ | |||
services.AddSingleton<ISchemaBuilder, CurrentUserQuery>(); | |||
services.AddTransient<UserType>(); | |||
services.AddScoped<UserType>(); |
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.
Are you sure you get the right instance of the UserType
in any circumstances? I think we should change the way the UserType
is build, what I did within the CurrentUserQuery
seems not enough anymore.
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.
Hi @gvkries , do you have any other suggestions? |
Hi @Skrypt , Can you help to review this PR? |
fixed: #15540 |
@MikeAlhayek And this PR 🫡 |
Sorry, I didn't have time for this. I take a look as soon as possible. |
Hi @hishamco , This PR is ready for review. |
Yes, that bug is fixed by both PRs, but this is more about the additional feature 🤗 |
OK, thanks. I'll review this once #15691 is merged, then. |
This pull request has merge conflicts. Please resolve those before requesting a review. |
It's merged |
Thanks! @hyzx86 please fix the merge conflict and let me know. |
Name = nameof(UserPickerField); | ||
|
||
Field<ListGraphType<StringGraphType>, IEnumerable<string>>("userIds") | ||
.Description("user ids") |
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 think all descriptions should be localizable.
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.
Done
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.
When addressing review feedback, please adhere to the following:
- Please update your pull request according to feedback until it is approved by one of the core team members.
- Apply suggested changes directly so the reviewer doesn't have to eyeball the changes. These resolve themselves after applying them, and that's fine.
- Don't resolve other conversations so it's easier to track for the reviewer. Then, the reviewer will resolve them.
- Feel free to mark conversations that you addressed to keep track of them with an emoji or otherwise, just don't resolve them.
- Please keep conversations happening in line comments in those convos, otherwise, communication will be a mess. If you have trouble finding them, see this video.
- When you're done addressing all feedback of a review, click "Re-request review" in the top-right corner for each reviewer when you're ready for another round of review, so they know that you're done.
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
…s/UserPickerFieldQueryObjectType.cs Co-authored-by: Zoltán Lehóczky <zoltan.lehoczky@lombiq.com>
…s/UserPickerFieldQueryObjectType.cs Co-authored-by: Zoltán Lehóczky <zoltan.lehoczky@lombiq.com>
WalkthroughWalkthroughThe recent update enriches the GraphQL module in OrchardCore by incorporating user picker capabilities. This enhancement enables seamless querying of user picker fields through specific GraphQL query types. Users can now retrieve user-related data such as user IDs and user items efficiently. Additionally, the update includes a project reference to OrchardCore.Users for streamlined dependency management. Changes
Recent Review DetailsConfiguration used: CodeRabbit UI Files selected for processing (1)
Files skipped from review as they are similar to previous changes (1)
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 Configration File (
|
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: 2
Out of diff range and nitpick comments (1)
src/OrchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs (1)
25-25
: Consider making the description localizable to support multiple languages.
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
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.
Beside what @Piedone said, LGTM. Whether we want to keep the firstUser
field or not is up to you guys, I'm fine with either decission.
...rchardCore.Modules/OrchardCore.ContentFields/GraphQL/Types/UserPickerFieldQueryObjectType.cs
Outdated
Show resolved
Hide resolved
…s/UserPickerFieldQueryObjectType.cs Co-authored-by: Georg von Kries <georg.von.kries@creativbox.net>
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.
Great, thank you!