Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

refactor: Make acting_user a mandatory kwarg for do_set_realm_authentication_methods.

shanukun4dc62f962bc3
diff --git a/docs/tutorials/new-feature-tutorial.md b/docs/tutorials/new-feature-tutorial.md
index 7d68723ca51..94ca645890c 100644
--- a/docs/tutorials/new-feature-tutorial.md
+++ b/docs/tutorials/new-feature-tutorial.md
@@ -321,7 +321,9 @@ field and send an event. For example:
# zerver/lib/actions.py
- def do_set_realm_authentication_methods(realm: Realm, authentication_methods: Dict[str, bool]) -> None:
+ def do_set_realm_authentication_methods(
+ realm: Realm, authentication_methods: Dict[str, bool], *, acting_user: Optional[UserProfile]
+ ) -> None:
for key, value in list(authentication_methods.items()):
index = getattr(realm.authentication_methods, key).number
realm.authentication_methods.set_bit(index, int(value))
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index c74a7dbf905..0e8b6b0cc11 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -824,7 +824,7 @@ def do_set_realm_property(
def do_set_realm_authentication_methods(
- realm: Realm, authentication_methods: Dict[str, bool], acting_user: Optional[UserProfile] = None
+ realm: Realm, authentication_methods: Dict[str, bool], *, acting_user: Optional[UserProfile]
) -> None:
old_value = realm.authentication_methods_dict()
for key, value in list(authentication_methods.items()):
diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py
index 3737753267b..a47b1b07e6c 100644
--- a/zerver/tests/test_events.py
+++ b/zerver/tests/test_events.py
@@ -1068,7 +1068,7 @@ class NormalActionsTest(BaseAction):
with fake_backends():
events = self.verify_action(
lambda: do_set_realm_authentication_methods(
- self.user_profile.realm, auth_method_dict
+ self.user_profile.realm, auth_method_dict, acting_user=None
)
)