Skip to content
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

Fixed validator when plugin is disabled #317

Merged
merged 3 commits into from
Oct 21, 2020

Conversation

drpayyne
Copy link
Contributor

@drpayyne drpayyne commented Oct 20, 2020

Description

This PR fixes the a bug present while saving the plugin settings.

In, the com.magento.idea.magento2plugin.project.validator.SettingsFormValidator#validate method, SettingsForm.getSettings() method is used to check if plugin is enabled. While this works, this returns only the saved values and not the current values of the form. SettingsForm.isBeingUsed() on the other hand, returns the current value of the checkbox for plugin enablement. Please go through the below steps to better understand the flow.

Steps to reproduce bug

  1. Open IntelliJ with plugin installed and navigate to the plugin settings
  2. Check the plugin enable checkbox and enter valid values for Magento path.
  3. Save. (this is successful)
  4. Uncheck the plugin enable checkbox and remove the value in Magento path field
  5. Save. (this is unsuccessful)

Actual result

Error is thrown as Magento path field is validated even though the checkbox is unchecked

Expected result

Able to save successfully with empty Magento path field as plugin enable checkbox is unchecked

Additional changes

  • Removed an extra colon introduced by previous PR
  • Added a better method description annotation
  • Refactored method with better structure to conditionals

Contribution checklist

  • Pull request has a meaningful description of its purpose
  • All commits are accompanied by meaningful commit messages
  • All new or changed code is covered with integration/functional tests (if applicable)
  • All automated tests passed successfully (all builds are green)

@drpayyne drpayyne force-pushed the bug/disabled-validator branch from 4486e9e to 855f359 Compare October 20, 2020 16:17
@VitaliyBoyko VitaliyBoyko self-requested a review October 21, 2020 15:31
Copy link
Contributor

@VitaliyBoyko VitaliyBoyko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good ✅

@VitaliyBoyko VitaliyBoyko merged commit a9c7c86 into magento:2.1.0-develop Oct 21, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants