aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnupam Kumar <kyteinsky@gmail.com>2024-08-01 17:01:48 +0530
committerGitHub <noreply@github.com>2024-08-01 17:01:48 +0530
commit0674f6316e03706f3b5070b73d8ba5907c4503f0 (patch)
tree7a6e152b0fc493bec8c162339066f77db322c09c
parentd84d55500e44eb3f2b10412ec3e48457acab5b2a (diff)
parentc2c117169fc16941a8463cb097563f5676307b8b (diff)
downloadnextcloud-server-0674f6316e03706f3b5070b73d8ba5907c4503f0.tar.gz
nextcloud-server-0674f6316e03706f3b5070b73d8ba5907c4503f0.zip
Merge pull request #46950 from nextcloud/backport/46943/stable28
[stable28] fix(AdminSettings/AI): show pref list of only the enabled translation providers
-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 7a4a3538267..e794be08b2f 100644
--- a/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
+++ b/apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
@@ -135,7 +135,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;