Skip to content

Commit

Permalink
Fix logic in the settings view
Browse files Browse the repository at this point in the history
  • Loading branch information
ayanaar committed Nov 22, 2023
1 parent 5fd7cf0 commit 05e8dbd
Showing 1 changed file with 8 additions and 17 deletions.
25 changes: 8 additions & 17 deletions pontoon/contributors/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -310,14 +310,9 @@ def settings(request):
all_locales = list(Locale.objects.all())
all_locales.insert(0, default_homepage_locale)

# Set default for custom homepage locale based on name
custom_homepage_locale_object = get_locale_or_redirect(profile.custom_homepage)
custom_homepage_locale_name = custom_homepage_locale_object.name

if custom_homepage_locale_name:
custom_homepage_locale = Locale.objects.filter(
name=custom_homepage_locale_name
).first()
# Set default for custom homepage locale based on code
if profile.custom_homepage:
custom_homepage_locale = get_locale_or_redirect(profile.custom_homepage)
else:
custom_homepage_locale = default_homepage_locale

Expand All @@ -326,15 +321,11 @@ def settings(request):
preferred_locales = list(Locale.objects.all())
preferred_locales.insert(0, default_preferred_source_locale)

# Set preferred source locale based on name
preferred_source_locale_object = get_locale_or_redirect(
profile.preferred_source_locale
)
preferred_source_locale_name = preferred_source_locale_object.name
if preferred_source_locale_name:
preferred_source_locale = Locale.objects.filter(
name=preferred_source_locale_name
).first()
# Set preferred source locale based on code
if profile.preferred_source_locale:
preferred_source_locale = get_locale_or_redirect(
profile.preferred_source_locale
)
else:
preferred_source_locale = default_preferred_source_locale

Expand Down

0 comments on commit 05e8dbd

Please sign in to comment.