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_activate_user.

shanukunfafe1a31d747
diff --git a/analytics/tests/test_counts.py b/analytics/tests/test_counts.py
index 579391ed8ba..74e61340e0e 100644
--- a/analytics/tests/test_counts.py
+++ b/analytics/tests/test_counts.py
@@ -1325,7 +1325,7 @@ class TestLoggingCountStats(AnalyticsTestCase):
"value__sum"
],
)
- do_activate_user(user)
+ do_activate_user(user, acting_user=None)
self.assertEqual(
1,
RealmCount.objects.filter(property=property, subgroup=False).aggregate(Sum("value"))[
@@ -1659,7 +1659,7 @@ class TestActiveUsersAudit(AnalyticsTestCase):
"email4", "password", self.default_realm, "full_name", acting_user=None
)
do_deactivate_user(user2)
- do_activate_user(user3)
+ do_activate_user(user3, acting_user=None)
do_reactivate_user(user4)
end_time = floor_to_day(timezone_now()) + self.DAY
do_fill_count_stat_at_hour(self.stat, end_time)
diff --git a/corporate/tests/test_stripe.py b/corporate/tests/test_stripe.py
index 95e7ac95731..48b883d923f 100644
--- a/corporate/tests/test_stripe.py
+++ b/corporate/tests/test_stripe.py
@@ -2714,7 +2714,7 @@ class LicenseLedgerTest(StripeTestCase):
do_deactivate_user(user)
do_reactivate_user(user)
# Not a proper use of do_activate_user, but fine for this test
- do_activate_user(user)
+ do_activate_user(user, acting_user=None)
ledger_entries = list(
LicenseLedger.objects.values_list(
"is_renewal", "licenses", "licenses_at_next_renewal"
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py
index a39f83943f6..0d687f27207 100644
--- a/zerver/lib/actions.py
+++ b/zerver/lib/actions.py
@@ -672,7 +672,7 @@ def do_create_user(
return user_profile
-def do_activate_user(user_profile: UserProfile, acting_user: Optional[UserProfile] = None) -> None:
+def do_activate_user(user_profile: UserProfile, *, acting_user: Optional[UserProfile]) -> None:
user_profile.is_active = True
user_profile.is_mirror_dummy = False
user_profile.set_unusable_password()