home: Simplify and comment terms of service notice implementation.

This commit is contained in:
Tim Abbott
2022-01-28 13:45:56 -08:00
committed by Tim Abbott
parent 37d7d6ccd4
commit de411be576
2 changed files with 15 additions and 9 deletions

View File

@@ -44,21 +44,28 @@ def accounts_accept_terms(request: HttpRequest) -> HttpResponse:
else:
form = ToSForm()
email = request.user.delivery_email
first_time_terms_of_service_message_template = None
context = {
"form": form,
"email": request.user.delivery_email,
# Text displayed when updating TERMS_OF_SERVICE_VERSION.
"terms_of_service_message": settings.TERMS_OF_SERVICE_MESSAGE,
# HTML template used when agreeing to terms of service the
# first time, e.g. after data import.
"first_time_terms_of_service_message_template": None,
}
if (
request.user.tos_version is None
and settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE is not None
):
first_time_terms_of_service_message_template = settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE
context[
"first_time_terms_of_service_message_template"
] = settings.FIRST_TIME_TERMS_OF_SERVICE_TEMPLATE
return render(
request,
"zerver/accounts_accept_terms.html",
context={
"form": form,
"email": email,
"first_time_terms_of_service_message_template": first_time_terms_of_service_message_template,
},
context,
)