nextcloud: Don't show incorrect phone region when it is not set

Tests:

- Install nextcloud and notice that the default phone region is 'Not set'.
Select phone region, it sets properly. Set it to 'Not set' and that works too.

Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org>
Reviewed-by: James Valleroy <jvalleroy@mailbox.org>
This commit is contained in:
Sunil Mohan Adapa authored and James Valleroy committed 2024-04-19 06:41:40 -04:00
1 parent 138cdd6e3f
commit 722da5b0d5
2 files changed
+6 -3

No files matched your search

+5 -2
View File
@@ -11,9 +11,12 @@ def _get_phone_regions():
from iso3166 import countries # type: ignore
phone_regions = [(country.alpha2, country.name)
for country in countries]
return sorted(phone_regions)
phone_regions = sorted(phone_regions)
except ImportError:
return [('US', 'United States of America')]
# Allow users to set a non-empty value
phone_regions = [('US', 'United States of America')]
return [('', _('Not set'))] + phone_regions
class NextcloudForm(forms.Form):
+1 -1
View File
@@ -25,7 +25,7 @@ class NextcloudAppView(AppView):
initial = super().get_initial()
initial.update({
'domain': privileged.get_domain(),
'default_phone_region': privileged.get_default_phone_region()
'default_phone_region': privileged.get_default_phone_region() or ''
})
return initial