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

Settings pushing: merge, don't blanket override #317

Open
tw2113 opened this issue Apr 14, 2023 · 3 comments · May be fixed by #319
Open

Settings pushing: merge, don't blanket override #317

tw2113 opened this issue Apr 14, 2023 · 3 comments · May be fixed by #319

Comments

@tw2113
Copy link
Member

tw2113 commented Apr 14, 2023

I want to make it so any time someone clicks any of the "Push settings" buttons for any of the indexes, the settings are merged and pushed instead of outright overriding everything.

I am not convinced that it is known that the buttons override values manually set via the Algolia Dashboard with whatever defaults are set via the plugin. I am also certain that there are potential cases of teams mixing the two together, and that's a recipe for disaster.

So if at all possible we should fetch a given index's settings and do the necessary logic to determine which setting fields are not the default values within a fresh index, and merge those in to the local, to-be-pushed, settings values that are default.

Questions needing answered before we can start anything here, is how to handle situations where both remote AND local settings are not defaults, which value "wins" ? Perhaps retain current situation and let the local version override? Log the situation and inform the site owner? Prevent the submission of the settings push until they have made a decision and removed the conflict?

@tw2113
Copy link
Member Author

tw2113 commented Apr 17, 2023

This needs to be done in the extended get_settings() methods for each class that extends Algolia_Index which are listed in the indices folder.

The question is how to best fetch the settings. Need to get instance of SearchIndex with the appropriate index name and make use of getSettings() method.

@tomreed-ae
Copy link

Hi @tw2113, is there a filter to prevent the "Push Settings" button from doing anything?

Once we have pushed the settings from the codebase, we are now managing the config options from the Algolia dashboard due to the issues you raised above. Can we easily prevent the button from overriding what is in the dashboard?

@tw2113
Copy link
Member Author

tw2113 commented Jun 27, 2024

@tomreed-ae No on a filter, but you could use some quick CSS to visually hide at least in the meantime:

add_action('admin_head',function(){
?>
<style>
	.algolia-push-settings-button.button {
		display: none;
	}
</style>
<?php
});

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 a pull request may close this issue.

2 participants