mirror of https://github.com/zulip/zulip.git
user_settings: Send event on commit in do_change_full_name.
Earlier, we were using 'send_event' in 'do_change_full_name' which can lead to a situation, if any db operation is added after the 'send_event' in future, where we enqueue events but the action function fails at a later stage. Events should not be sent until we know we're not rolling back. Fixes part of #30489.
This commit is contained in:
parent
d2c7e7e94c
commit
7e03569495
|
@ -213,6 +213,7 @@ def do_change_password(user_profile: UserProfile, password: str, commit: bool =
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
@transaction.atomic(savepoint=False)
|
||||||
def do_change_full_name(
|
def do_change_full_name(
|
||||||
user_profile: UserProfile, full_name: str, acting_user: UserProfile | None
|
user_profile: UserProfile, full_name: str, acting_user: UserProfile | None
|
||||||
) -> None:
|
) -> None:
|
||||||
|
@ -232,13 +233,13 @@ def do_change_full_name(
|
||||||
extra_data={RealmAuditLog.OLD_VALUE: old_name, RealmAuditLog.NEW_VALUE: full_name},
|
extra_data={RealmAuditLog.OLD_VALUE: old_name, RealmAuditLog.NEW_VALUE: full_name},
|
||||||
)
|
)
|
||||||
payload = dict(user_id=user_profile.id, full_name=user_profile.full_name)
|
payload = dict(user_id=user_profile.id, full_name=user_profile.full_name)
|
||||||
send_event(
|
send_event_on_commit(
|
||||||
user_profile.realm,
|
user_profile.realm,
|
||||||
dict(type="realm_user", op="update", person=payload),
|
dict(type="realm_user", op="update", person=payload),
|
||||||
get_user_ids_who_can_access_user(user_profile),
|
get_user_ids_who_can_access_user(user_profile),
|
||||||
)
|
)
|
||||||
if user_profile.is_bot:
|
if user_profile.is_bot:
|
||||||
send_event(
|
send_event_on_commit(
|
||||||
user_profile.realm,
|
user_profile.realm,
|
||||||
dict(type="realm_bot", op="update", bot=payload),
|
dict(type="realm_bot", op="update", bot=payload),
|
||||||
bot_owner_user_ids(user_profile),
|
bot_owner_user_ids(user_profile),
|
||||||
|
|
Loading…
Reference in New Issue