comments: skip already deleted comments and make sure we don't raise unnecessary errors.

This commit is contained in:
Marcin Kuzminski 2017-01-11 14:02:34 +01:00
parent 62e22ad5de
commit caee47148f

View file

@ -428,6 +428,11 @@ class ChangesetController(BaseRepoController):
@jsonify
def delete_comment(self, repo_name, comment_id):
comment = ChangesetComment.get(comment_id)
if not comment:
log.debug('Comment with id:%s not found, skipping', comment_id)
# comment already deleted in another call probably
return True
owner = (comment.author.user_id == c.rhodecode_user.user_id)
is_repo_admin = h.HasRepoPermissionAny('repository.admin')(c.repo_name)
if h.HasPermissionAny('hg.admin')() or is_repo_admin or owner: