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

Modify the is_configured check #361

Merged
merged 1 commit into from
Nov 9, 2022
Merged

Modify the is_configured check #361

merged 1 commit into from
Nov 9, 2022

Conversation

dkotter
Copy link
Contributor

@dkotter dkotter commented Nov 9, 2022

Description of the Change

At the moment, before loading any functionality related to content syncing, tracking or blocks, we call our is_configured utility function. If that function returns false, we don't load the aforementioned functionality and instead we output an admin notice (though only on the WP plugins screen).

The is_configured functions checks to see if any settings are blank and if so, returns false. This means if any settings aren't in place (like the override settings) no functionality gets loaded.

This PR fixes this by modifying our is_configured function to allow checking of each individual section of settings (collector, automation, override or all). We then utilize this to determine what functionality should be loaded as such:

  • If any Collector settings are blank, we don't load content syncing, tracking or the WP-CLI command
  • If any Automation settings are blank, we don't load our blocks or site automation functionality
  • If any Collector or Automation settings are blank, we continue to show our admin notice but we don't stop execution at that point anymore, due to the more strict checks mentioned above

Note: this doesn't change any of the validation, saving or output of error messages on the settings page. Those all remain the same.

Closes #356

Alternate Designs

None

Possible Drawbacks

Should be none but should verify all functionality loads as expected

Verification Process

Add and remove various settings and ensure everything works as expected

Checklist:

  • I have read the CONTRIBUTING document.
  • My code follows the code style of this project.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my change.
  • All new and existing tests passed.

Changelog Entry

Changed - Update our configured check to be smarter

Credits

Props @dkotter

…idually instead of checking for them all. Use this to more accurately load functionality
@dkotter dkotter self-assigned this Nov 9, 2022
@sonarcloud
Copy link

sonarcloud bot commented Nov 9, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 32 Code Smells

No Coverage information No Coverage information
0.0% 0.0% Duplication

@dkotter dkotter requested a review from jeffpaul November 9, 2022 17:11
@jeffpaul jeffpaul added this to the 1.3.1 milestone Nov 9, 2022
Copy link
Contributor

@jeffpaul jeffpaul 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, will merge, deploy & test; thanks!

@jeffpaul jeffpaul merged commit 8114c8f into develop Nov 9, 2022
@jeffpaul jeffpaul deleted the fix/356 branch November 9, 2022 18:27
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.

The whole plugin stops working even if any one of the setting is left empty
2 participants