mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 13:33:24 +00:00
muting: Handle the case of a race muting the same user twice.
This commit is contained in:
committed by
Tim Abbott
parent
781107308d
commit
141b0c4cec
@@ -106,7 +106,11 @@ def mute_user(request: HttpRequest, user_profile: UserProfile, muted_user_id: in
|
||||
if get_mute_object(user_profile, muted_user) is not None:
|
||||
raise JsonableError(_("User already muted"))
|
||||
|
||||
do_mute_user(user_profile, muted_user, date_muted)
|
||||
try:
|
||||
do_mute_user(user_profile, muted_user, date_muted)
|
||||
except IntegrityError:
|
||||
raise JsonableError(_("User already muted"))
|
||||
|
||||
return json_success(request)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user