Skip to content

Commit

Permalink
fix: restore redis lock API message
Browse files Browse the repository at this point in the history
  • Loading branch information
francesco-filicetti committed Mar 15, 2024
1 parent 0b623bb commit b07914d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/cms/api/views/locks.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,7 @@ def get(self, request, *args, **kwargs):
user_lock = get_lock_from_cache(content_type_id, object_id)
if user_lock and not user_lock == request.user.pk: # pragma: no cover
owner_user = get_user_model().objects.filter(pk=user_lock).first()
# return Response({'lock': lock,
# 'message': LOCK_MESSAGE.format(user=owner_user)})
# return Response({'message': LOCK_MESSAGE.format(user=owner_user)})
raise PermissionDenied(LOCK_MESSAGE.format(user=owner_user), 403)
return Response({})

Expand Down Expand Up @@ -191,8 +190,7 @@ def post(self, request, *args, **kwargs):
user_lock = get_lock_from_cache(content_type_id, object_id)
if user_lock and not user_lock == request.user.pk: # pragma: no cover
owner_user = get_user_model().objects.filter(pk=user_lock).first()
# return Response({'lock': lock,
# 'message': LOCK_MESSAGE.format(user=owner_user)})
# return Response({'message': LOCK_MESSAGE.format(user=owner_user)})
raise PermissionDenied(LOCK_MESSAGE.format(user=owner_user), 403)
if obj.is_lockable_by(request.user):
set_lock_to_cache(user_id=request.user.pk,
Expand Down

0 comments on commit b07914d

Please sign in to comment.