New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow default MFA help text to be translated along with the rest of the application's translatable strings #4549
Conversation
…with the rest of the application's translatable strings
# It's terrible, but if you change this, you must also change | ||
# `MFA_DEFAULT_HELP_TEXT` in `static_lists.py` so that | ||
# translators receive the new string |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps a more sane approach would be to have superusers leave the default value empty when they do not want to override it. However, doing that would take away our ability to use the default string to show an instructional example. Copying and pasting the string seemed like the lesser evil 🙃
'mfa_localized_help_text': lambda i18n_texts: { | ||
lang: markdown(text) | ||
for lang, text in json.loads( | ||
constance.config.MFA_LOCALIZED_HELP_TEXT.replace( | ||
'##support email##', | ||
constance.config.SUPPORT_EMAIL | ||
) | ||
).items() | ||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops, it was impossible for this to fail. Always make sure your tests can fail! I'll take some blame here, too, because making values automatically get assertEqual()
ed while requiring callables to do their own assertions leaves some clarity to be desired.
@@ -33,41 +35,44 @@ def setUp(self): | |||
'community_url': constance.config.COMMUNITY_URL, | |||
'frontend_min_retry_time': constance.config.FRONTEND_MIN_RETRY_TIME, | |||
'frontend_max_retry_time': constance.config.FRONTEND_MAX_RETRY_TIME, | |||
'project_metadata_fields': lambda x: \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry about the quantity of formatting changes. The smallest unit of code that I could invoke python-black on was the dictionary.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who am I to complain about receiving few lines of new formatting changes in a review? 😇
queries = 19 | ||
queries = 20 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This query is being executed twice for some reason:
SELECT "constance_config"."id", "constance_config"."key", "constance_config"."value" FROM "constance_config" WHERE "constance_config"."key" = 'MFA_LOCALIZED_HELP_TEXT' LIMIT 21
I had to give up caring about this for now. I have another branch that I'm about to PR anyway that reduces (or at least was reducing) the number of queries from 19 to 18, so… 🤷
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Everyone should do it!
Clean up the environment (API endpoint)
No description provided.