nextcloud: Add option to configure the default phone region

This setting is necessarry to pass the setup warning under
/nextcloud/settings/admin/overview

Note: during testing the field only becomes visible once
the freedombox-develop command is restarted

https://docs.nextcloud.com/server/latest/admin_manual/configuration_server/config_sample_php_parameters.html#default-phone-region

Signed-off-by: Benedek Nagy <contact@nbenedek.me>
[sunil: Add missing docstring]
[sunil: Update form label for consistency]
[sunil: Reduce number of success form messages]
Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: Sunil Mohan Adapa <sunil@medhas.org>
This commit is contained in:
Benedek Nagy authored and Sunil Mohan Adapa committed 2024-03-29 15:44:27 -07:00
1 parent 8ef680f450
commit b21af70510
4 files changed
+47 -2

No files matched your search

+10 -1
View File
@@ -23,7 +23,10 @@ class NextcloudAppView(AppView):
def get_initial(self):
"""Return the values to fill in the form."""
initial = super().get_initial()
initial.update({'domain': privileged.get_domain()})
initial.update({
'domain': privileged.get_domain(),
'default_phone_region': privileged.get_default_phone_region()
})
return initial
def form_valid(self, form):
@@ -49,6 +52,12 @@ class NextcloudAppView(AppView):
self.request,
_('Password update failed. Please choose a stronger '
'password.'))
if _value_changed('default_phone_region'):
privileged.set_default_phone_region(
new_config['default_phone_region'])
is_changed = True
if is_changed:
messages.success(self.request, _('Configuration updated.'))