Skip to content

Commit

Permalink
Merge pull request #46949 from nextcloud/backport/46943/stable29
Browse files Browse the repository at this point in the history
[stable29] fix(AdminSettings/AI): show pref list of only the enabled translation providers
  • Loading branch information
kyteinsky committed Aug 1, 2024
2 parents 0d16ba6 + 092fbb2 commit 09bb34e
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion apps/settings/lib/Settings/Admin/ArtificialIntelligence.php
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,12 @@ public function getForm() {
$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;
Expand Down

0 comments on commit 09bb34e

Please sign in to comment.