mirror of https://github.com/zulip/zulip.git
settings: Rename TOS_VERSION to TERMS_OF_SERVICE_VERSION.
The previous version was appropriate in a setting where it was only used for Zulip Cloud, but it's definitely clearer to spell it out.
This commit is contained in:
parent
90aa45a316
commit
4cb189fc63
|
@ -745,7 +745,7 @@ def do_activate_mirror_dummy_user(
|
|||
user_profile.is_mirror_dummy = False
|
||||
user_profile.set_unusable_password()
|
||||
user_profile.date_joined = timezone_now()
|
||||
user_profile.tos_version = settings.TOS_VERSION
|
||||
user_profile.tos_version = settings.TERMS_OF_SERVICE_VERSION
|
||||
user_profile.save(
|
||||
update_fields=["date_joined", "password", "is_mirror_dummy", "tos_version"]
|
||||
)
|
||||
|
@ -4438,7 +4438,7 @@ def do_change_tos_version(user_profile: UserProfile, tos_version: str) -> None:
|
|||
realm=user_profile.realm,
|
||||
acting_user=user_profile,
|
||||
modified_user=user_profile,
|
||||
event_type=RealmAuditLog.USER_TOS_VERSION_CHANGED,
|
||||
event_type=RealmAuditLog.USER_TERMS_OF_SERVICE_VERSION_CHANGED,
|
||||
event_time=event_time,
|
||||
)
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class Command(ZulipBaseCommand):
|
|||
raise error
|
||||
|
||||
# Only email users who've agreed to the terms of service.
|
||||
if settings.TOS_VERSION is not None:
|
||||
if settings.TERMS_OF_SERVICE_VERSION is not None:
|
||||
# We need to do a new query because the `get_users` path
|
||||
# passes us a list rather than a QuerySet.
|
||||
users = (
|
||||
|
|
|
@ -3846,7 +3846,7 @@ class AbstractRealmAuditLog(models.Model):
|
|||
USER_AVATAR_SOURCE_CHANGED = 123
|
||||
USER_FULL_NAME_CHANGED = 124
|
||||
USER_EMAIL_CHANGED = 125
|
||||
USER_TOS_VERSION_CHANGED = 126
|
||||
USER_TERMS_OF_SERVICE_VERSION_CHANGED = 126
|
||||
USER_API_KEY_CHANGED = 127
|
||||
USER_BOT_OWNER_CHANGED = 128
|
||||
USER_DEFAULT_SENDING_STREAM_CHANGED = 129
|
||||
|
|
|
@ -221,7 +221,7 @@ class TestRealmAuditLog(ZulipTestCase):
|
|||
do_change_tos_version(user, tos_version)
|
||||
self.assertEqual(
|
||||
RealmAuditLog.objects.filter(
|
||||
event_type=RealmAuditLog.USER_TOS_VERSION_CHANGED, event_time__gte=now
|
||||
event_type=RealmAuditLog.USER_TERMS_OF_SERVICE_VERSION_CHANGED, event_time__gte=now
|
||||
).count(),
|
||||
1,
|
||||
)
|
||||
|
|
|
@ -457,7 +457,9 @@ class HomeTest(ZulipTestCase):
|
|||
user.tos_version = user_tos_version
|
||||
user.save()
|
||||
|
||||
with self.settings(TERMS_OF_SERVICE="whatever"), self.settings(TOS_VERSION="99.99"):
|
||||
with self.settings(TERMS_OF_SERVICE="whatever"), self.settings(
|
||||
TERMS_OF_SERVICE_VERSION="99.99"
|
||||
):
|
||||
|
||||
result = self.client_get("/", dict(stream="Denmark"))
|
||||
|
||||
|
@ -495,7 +497,7 @@ class HomeTest(ZulipTestCase):
|
|||
user.save()
|
||||
|
||||
with self.settings(FIRST_TIME_TOS_TEMPLATE="hello.html"), self.settings(
|
||||
TOS_VERSION="99.99"
|
||||
TERMS_OF_SERVICE_VERSION="99.99"
|
||||
):
|
||||
result = self.client_post("/accounts/accept_terms/")
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
|
|
@ -29,10 +29,10 @@ def need_accept_tos(user_profile: Optional[UserProfile]) -> bool:
|
|||
if settings.TERMS_OF_SERVICE is None: # nocoverage
|
||||
return False
|
||||
|
||||
if settings.TOS_VERSION is None:
|
||||
if settings.TERMS_OF_SERVICE_VERSION is None:
|
||||
return False
|
||||
|
||||
return int(settings.TOS_VERSION.split(".")[0]) > user_profile.major_tos_version()
|
||||
return int(settings.TERMS_OF_SERVICE_VERSION.split(".")[0]) > user_profile.major_tos_version()
|
||||
|
||||
|
||||
@zulip_login_required
|
||||
|
@ -42,7 +42,7 @@ def accounts_accept_terms(request: HttpRequest) -> HttpResponse:
|
|||
if request.method == "POST":
|
||||
form = ToSForm(request.POST)
|
||||
if form.is_valid():
|
||||
do_change_tos_version(request.user, settings.TOS_VERSION)
|
||||
do_change_tos_version(request.user, settings.TERMS_OF_SERVICE_VERSION)
|
||||
return redirect(home)
|
||||
else:
|
||||
form = ToSForm()
|
||||
|
|
|
@ -446,7 +446,7 @@ def accounts_register(
|
|||
full_name,
|
||||
prereg_user=prereg_user,
|
||||
role=role,
|
||||
tos_version=settings.TOS_VERSION,
|
||||
tos_version=settings.TERMS_OF_SERVICE_VERSION,
|
||||
timezone=timezone,
|
||||
default_stream_groups=default_stream_groups,
|
||||
source_profile=source_profile,
|
||||
|
|
|
@ -465,7 +465,7 @@ class Command(BaseCommand):
|
|||
email = fname.lower() + "@zulip.com"
|
||||
names.append((full_name, email))
|
||||
|
||||
create_users(zulip_realm, names, tos_version=settings.TOS_VERSION)
|
||||
create_users(zulip_realm, names, tos_version=settings.TERMS_OF_SERVICE_VERSION)
|
||||
|
||||
iago = get_user_by_delivery_email("iago@zulip.com", zulip_realm)
|
||||
do_change_user_role(iago, UserProfile.ROLE_REALM_ADMINISTRATOR, acting_user=None)
|
||||
|
@ -787,13 +787,17 @@ class Command(BaseCommand):
|
|||
("Athena Consulting Exchange User (MIT)", "starnine@mit.edu"),
|
||||
("Esp Classroom (MIT)", "espuser@mit.edu"),
|
||||
]
|
||||
create_users(mit_realm, testsuite_mit_users, tos_version=settings.TOS_VERSION)
|
||||
create_users(
|
||||
mit_realm, testsuite_mit_users, tos_version=settings.TERMS_OF_SERVICE_VERSION
|
||||
)
|
||||
|
||||
testsuite_lear_users = [
|
||||
("King Lear", "king@lear.org"),
|
||||
("Cordelia, Lear's daughter", "cordelia@zulip.com"),
|
||||
]
|
||||
create_users(lear_realm, testsuite_lear_users, tos_version=settings.TOS_VERSION)
|
||||
create_users(
|
||||
lear_realm, testsuite_lear_users, tos_version=settings.TERMS_OF_SERVICE_VERSION
|
||||
)
|
||||
|
||||
if not options["test_suite"]:
|
||||
# To keep the messages.json fixtures file for the test
|
||||
|
|
|
@ -358,8 +358,8 @@ REALM_CREATION_LINK_VALIDITY_DAYS = 7
|
|||
# Version number for ToS. Change this if you want to force every
|
||||
# user to click through to re-accept terms of service before using
|
||||
# Zulip again on the web.
|
||||
TOS_VERSION: Optional[str] = None
|
||||
# Template to use when bumping TOS_VERSION to explain situation.
|
||||
TERMS_OF_SERVICE_VERSION: Optional[str] = None
|
||||
# Template to use when bumping TERMS_OF_SERVICE_VERSION to explain situation.
|
||||
FIRST_TIME_TOS_TEMPLATE: Optional[str] = None
|
||||
|
||||
# Hostname used for Zulip's statsd logging integration.
|
||||
|
|
Loading…
Reference in New Issue