mirror of https://github.com/zulip/zulip.git
user_groups: Track acting user for do_update_user_group_name.
This is a prep-commit for populating RealmAuditLogs for changes made to UserGroup. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
f55717d34d
commit
eae0ef4c0e
|
@ -134,7 +134,9 @@ def do_send_user_group_update_event(user_group: UserGroup, data: Dict[str, str])
|
|||
send_event(user_group.realm, event, active_user_ids(user_group.realm_id))
|
||||
|
||||
|
||||
def do_update_user_group_name(user_group: UserGroup, name: str) -> None:
|
||||
def do_update_user_group_name(
|
||||
user_group: UserGroup, name: str, *, acting_user: Optional[UserProfile]
|
||||
) -> None:
|
||||
try:
|
||||
user_group.name = name
|
||||
user_group.save(update_fields=["name"])
|
||||
|
|
|
@ -1286,7 +1286,9 @@ class NormalActionsTest(BaseAction):
|
|||
|
||||
# Test name update
|
||||
backend = UserGroup.objects.get(name="backend")
|
||||
events = self.verify_action(lambda: do_update_user_group_name(backend, "backendteam"))
|
||||
events = self.verify_action(
|
||||
lambda: do_update_user_group_name(backend, "backendteam", acting_user=None)
|
||||
)
|
||||
check_user_group_update("events[0]", events[0], "name")
|
||||
|
||||
# Test description update
|
||||
|
|
|
@ -71,7 +71,7 @@ def edit_user_group(
|
|||
user_group = access_user_group_by_id(user_group_id, user_profile)
|
||||
|
||||
if name != user_group.name:
|
||||
do_update_user_group_name(user_group, name)
|
||||
do_update_user_group_name(user_group, name, acting_user=user_profile)
|
||||
|
||||
if description != user_group.description:
|
||||
do_update_user_group_description(user_group, description)
|
||||
|
|
Loading…
Reference in New Issue