aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorAnupam Kumar <kyteinsky@gmail.com>2024-08-01 13:10:40 +0530
committerAnupam Kumar <kyteinsky@gmail.com>2024-08-01 13:36:37 +0530
commitcf4326539e57a61d25167a907ac4a985a4073495 (patch)
treec41cb0e2e1c860f0ea247fbe56faf818dfb8f972 /apps
parentc52b7e5ebc6736de2d9991af379e4ed9885aab7b (diff)
downloadnextcloud-server-cf4326539e57a61d25167a907ac4a985a4073495.tar.gz
nextcloud-server-cf4326539e57a61d25167a907ac4a985a4073495.zip
fix(AdminSettings/AI): show pref list of only the enabled translation providers
Signed-off-by: Anupam Kumar <kyteinsky@gmail.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/settings/lib/Settings/Admin/ArtificialIntelligence.php7
1 files changed, 6 insertions, 1 deletions
diff --git a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
index 9a291243949..57cd555f1f2 100644
--- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
+++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
@@ -148,7 +148,12 @@ class ArtificialIntelligence implements IDelegatedSettings {
$value = array_merge($defaultValue, $value);
break;
case 'ai.translation_provider_preferences':
- $value += array_diff($defaultValue, $value); // Add entries from $defaultValue that are not in $value to the end of $value
+ // Only show entries from $value (saved pref list) that are in $defaultValue (enabled providers)
+ // and add all providers that are enabled but not in the pref list
+ if (!is_array($defaultValue)) {
+ break;
+ }
+ $value = array_values(array_unique(array_merge(array_intersect($value, $defaultValue), $defaultValue), SORT_STRING));
break;
default:
break;