audit_log: Log RealmAuditLog in do_set_realm_property.

Log RealmAuditLog in do_set_realm_property and do_remove_realm_domain.
Tests for the changes are written in test_events because it will save
duplicate code for test_change_realm_property.
This commit is contained in:
arpit551
2020-06-29 19:04:19 +05:30
committed by Tim Abbott
parent 6af337c07e
commit ba92666dbd
7 changed files with 38 additions and 14 deletions

View File

@@ -293,9 +293,10 @@ active users in a realm.
# zerver/lib/actions.py
def do_set_realm_property(realm: Realm, name: str, value: bool) -> None:
"""Takes in a realm object, the name of an attribute to update, and the
value to update.
def do_set_realm_property(realm: Realm, name: str, value: bool,
acting_user: Optional[UserProfile]=None) -> None:
"""Takes in a realm object, the name of an attribute to update, the
value to update and and the user who initiated the update.
"""
property_type = Realm.property_types[name]
assert isinstance(value, property_type), (

View File

@@ -266,7 +266,7 @@ def update_realm(
):
realm = user_profile.realm
# ...
do_set_realm_property(realm, k, v)
do_set_realm_property(realm, k, v, acting_user=user_profile)
# ...
```