From 773bad1490504bcda346193ad4c93bf1d9610ab6 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Sun, 7 Mar 2021 12:26:33 +0300 Subject: [PATCH] prevent list of enabled plugins resetting if saved while in search results --- classes/pref/prefs.php | 2 +- js/PrefHelpers.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/classes/pref/prefs.php b/classes/pref/prefs.php index 592bdb705..7dc1e9a1f 100644 --- a/classes/pref/prefs.php +++ b/classes/pref/prefs.php @@ -1009,7 +1009,7 @@ class Pref_Prefs extends Handler_Protected { function setplugins() { $plugins = array_filter($_REQUEST["plugins"], 'clean') ?? []; - set_pref(Prefs::_ENABLED_PLUGINS, implode(",", $plugins)); + //set_pref(Prefs::_ENABLED_PLUGINS, implode(",", $plugins)); } function _get_plugin_version(Plugin $plugin) { diff --git a/js/PrefHelpers.js b/js/PrefHelpers.js index d9b17a698..04ee10a41 100644 --- a/js/PrefHelpers.js +++ b/js/PrefHelpers.js @@ -356,6 +356,7 @@ const Helpers = { ++results_rendered; + // only user-enabled actually counts in the checkbox when saving because system plugin checkboxes are disabled (see below) container.innerHTML += `
  • `; + } else { + // if plugin is outside of search scope, keep current value in case of saving (only user-enabled is needed) + container.innerHTML += App.FormFields.checkbox_tag("plugins[]", plugin.user_enabled, plugin.name, {style: 'display : none'}); } }); if (results_rendered == 0) { - container.innerHTML = `
  • ${__("Could not find any plugins for this search query.")}
  • `; + container.innerHTML += `
  • ${__("Could not find any plugins for this search query.")}
  • `; } dojo.parser.parse(container);