-
Notifications
You must be signed in to change notification settings - Fork 463
fix: [2.0] update DisableIntrospection rule to pass the enabled/disabled state to class instead of being re-defined within the class #3290
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
Conversation
… to class instead of being re-defined within the class - update the DisableIntrospection error message to provide more clarity -
src/Request.php
Outdated
// By default, introspection is disabled for non-logged-in users and when debug is off | ||
$disable_introspection_rule_enabled = 0; | ||
if ( ! get_current_user_id() && ! \WPGraphQL::debug() && 'off' === get_graphql_setting( 'public_introspection_enabled', 'off' ) ) { | ||
$disable_introspection_rule_enabled = 1; | ||
} | ||
|
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 we do this in the DisableIntrospection
constructor instead of dirtying up request?
(Ref: I need a way to overload with this logic
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.
@justlevine pushed up some changes that handle it in the constructor and should allow for overloading like your example.
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.
Sorry my github is acting wonky: #3290 (comment)
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.
😍
What does this implement/fix? Explain your changes.
This determines whether the DisableIntrospection rule is enabled before instantiating the rule.
Does this close any currently open issues?
related: #3247 (comment)