Skip to content

Commit

Permalink
#3675 adding missing logic from previous commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ajrbyers committed Dec 7, 2023
1 parent 6cb103f commit bdaed21
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/repository/logic.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,25 +162,40 @@ def raise_comment_event(request, comment):
def comment_manager_post(request, preprint):
if 'comment_public' in request.POST:
comment_id = request.POST.get('comment_public')
elif 'comment_reviewed' in request.POST:
comment_id = request.POST.get('comment_reviewed')
elif 'comment_delete' in request.POST:
comment_id = request.POST.get('comment_delete')
else:
comment_id = request.POST.get('comment_reviewed')
return

comment = get_object_or_404(
models.Comment,
pk=comment_id,
preprint=preprint,
repository=request.repository,
preprint__repository=request.repository,
)

if 'comment_public' in request.POST:
comment.toggle_public()
elif 'comment_delete' in request.POST:
comment.delete()
else:
elif 'comment_reviewed' in request.POST:
comment.mark_reviewed()

if 'comment_delete' in request.POST:
if request.user in request.repository.managers.all():
comment.delete()
messages.add_message(
request,
messages.SUCCESS,
'Comment deleted',
)
else:
messages.add_message(
request,
messages.WARNING,
'You do not have permission to delete this comment.',
)


# TODO: Update this implementation
def handle_author_post(request, preprint):
Expand Down

0 comments on commit bdaed21

Please sign in to comment.