SciPost Code Repository

Skip to content
Snippets Groups Projects
Commit 1b1df745 authored by Jorran de Wit's avatar Jorran de Wit
Browse files

Fix comment on Report wrongly assigned as author reply

parent 8bdcac91
No related branches found
No related tags found
No related merge requests found
......@@ -129,12 +129,18 @@ def reply_to_comment(request, comment_id):
comment = get_object_or_404(Comment, pk=comment_id)
# Verify if this is from an author:
try:
# Submission/Commentary
is_author = comment.content_object.authors.filter(id=request.user.contributor.id).exists()
except AttributeError:
related_object = comment.content_object
if isinstance(related_object, Submission) or isinstance(related_object, Commentary):
is_author = related_object.authors.filter(id=request.user.contributor.id).exists()
elif isinstance(related_object, Report):
is_author = related_object.submission.authors.filter(
id=request.user.contributor.id).exists()
elif isinstance(related_object, ThesisLink):
# ThesisLink
is_author = comment.content_object.author == request.user.contributor
is_author = related_object.author == request.user.contributor
else:
# No idea what this could be, but just to be sure
is_author = related_object.author == request.user.contributor
form = CommentForm(request.POST or None, request.FILES or None)
if form.is_valid():
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment