settings: Refactor callers of do_change_user_setting to pass acting_user.

This commit is contained in:
Sahil Batra
2021-09-08 16:55:50 +05:30
committed by Tim Abbott
parent f0ea002d94
commit 550d97a593
5 changed files with 21 additions and 9 deletions

View File

@@ -420,7 +420,7 @@ def accounts_register(
do_activate_mirror_dummy_user(user_profile, acting_user=user_profile)
do_change_password(user_profile, password)
do_change_full_name(user_profile, full_name, user_profile)
do_change_user_setting(user_profile, "timezone", timezone)
do_change_user_setting(user_profile, "timezone", timezone, acting_user=user_profile)
# TODO: When we clean up the `do_activate_mirror_dummy_user` code path,
# make it respect invited_as_admin / is_realm_admin.

View File

@@ -266,7 +266,7 @@ def json_change_settings(
}
for k, v in list(request_settings.items()):
if v is not None and getattr(user_profile, k) != v:
do_change_user_setting(user_profile, k, v)
do_change_user_setting(user_profile, k, v, acting_user=user_profile)
req_vars = {
k: v for k, v in list(locals().items()) if k in user_profile.notification_setting_types
@@ -277,7 +277,7 @@ def json_change_settings(
do_change_notification_settings(user_profile, k, v, acting_user=user_profile)
if timezone is not None and user_profile.timezone != timezone:
do_change_user_setting(user_profile, "timezone", timezone)
do_change_user_setting(user_profile, "timezone", timezone, acting_user=user_profile)
# TODO: Do this more generally.
from zerver.lib.request import RequestNotes