mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 09:27:43 +00:00
billing: Change do_change_plan_type to take a realm instead of a user.
More often than not, changes in plan type are not directly due to user action.
This commit is contained in:
@@ -3084,13 +3084,12 @@ def do_change_icon_source(realm: Realm, icon_source: str, log: bool=True) -> Non
|
||||
icon_url=realm_icon_url(realm))),
|
||||
active_user_ids(realm.id))
|
||||
|
||||
def do_change_plan_type(user: UserProfile, plan_type: int) -> None:
|
||||
realm = user.realm
|
||||
def do_change_plan_type(realm: Realm, plan_type: int) -> None:
|
||||
old_value = realm.plan_type
|
||||
realm.plan_type = plan_type
|
||||
realm.save(update_fields=['plan_type'])
|
||||
RealmAuditLog.objects.create(event_type=RealmAuditLog.REALM_PLAN_TYPE_CHANGED,
|
||||
realm=realm, acting_user=user, event_time=timezone_now(),
|
||||
realm=realm, event_time=timezone_now(),
|
||||
extra_data={'old_value': old_value, 'new_value': plan_type})
|
||||
|
||||
if plan_type == Realm.STANDARD:
|
||||
|
||||
Reference in New Issue
Block a user