SciPost Code Repository

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

Slight edits

parent 666395ed
No related branches found
No related tags found
No related merge requests found
...@@ -31,16 +31,16 @@ class CommentFactory(factory.django.DjangoModelFactory): ...@@ -31,16 +31,16 @@ class CommentFactory(factory.django.DjangoModelFactory):
class CommentaryCommentFactory(CommentFactory): class CommentaryCommentFactory(CommentFactory):
commentary = factory.SubFactory(VettedCommentaryFactory) content_object = factory.SubFactory(VettedCommentaryFactory)
class SubmissionCommentFactory(CommentFactory): class SubmissionCommentFactory(CommentFactory):
submission = factory.SubFactory(EICassignedSubmissionFactory) content_object = factory.SubFactory(EICassignedSubmissionFactory)
class ThesislinkCommentFactory(CommentFactory): class ThesislinkCommentFactory(CommentFactory):
thesislink = factory.SubFactory(VettedThesisLinkFactory) content_object = factory.SubFactory(VettedThesisLinkFactory)
class ReplyCommentFactory(CommentFactory): class ReplyCommentFactory(CommentFactory):
in_reply_to_comment = factory.SubFactory(SubmissionCommentFactory) content_object = factory.SubFactory(SubmissionCommentFactory)
...@@ -38,6 +38,9 @@ class Comment(TimeStampedModel): ...@@ -38,6 +38,9 @@ class Comment(TimeStampedModel):
nested_comments = GenericRelation('comments.Comment', related_query_name='comments') nested_comments = GenericRelation('comments.Comment', related_query_name='comments')
# -- U/S
# These fields will be removed in the future.
# They still exists only to prevent possible data loss.
commentary = models.ForeignKey('commentaries.Commentary', blank=True, null=True, commentary = models.ForeignKey('commentaries.Commentary', blank=True, null=True,
on_delete=models.CASCADE, help_text=US_NOTICE) on_delete=models.CASCADE, help_text=US_NOTICE)
submission = models.ForeignKey('submissions.Submission', blank=True, null=True, submission = models.ForeignKey('submissions.Submission', blank=True, null=True,
...@@ -45,12 +48,15 @@ class Comment(TimeStampedModel): ...@@ -45,12 +48,15 @@ class Comment(TimeStampedModel):
help_text=US_NOTICE) help_text=US_NOTICE)
thesislink = models.ForeignKey('theses.ThesisLink', blank=True, null=True, thesislink = models.ForeignKey('theses.ThesisLink', blank=True, null=True,
on_delete=models.CASCADE, help_text=US_NOTICE) on_delete=models.CASCADE, help_text=US_NOTICE)
is_author_reply = models.BooleanField(default=False)
in_reply_to_comment = models.ForeignKey('self', blank=True, null=True, in_reply_to_comment = models.ForeignKey('self', blank=True, null=True,
related_name="nested_comments_old", related_name="nested_comments_old",
on_delete=models.CASCADE, help_text=US_NOTICE) on_delete=models.CASCADE, help_text=US_NOTICE)
in_reply_to_report = models.ForeignKey('submissions.Report', blank=True, null=True, in_reply_to_report = models.ForeignKey('submissions.Report', blank=True, null=True,
on_delete=models.CASCADE, help_text=US_NOTICE) on_delete=models.CASCADE, help_text=US_NOTICE)
# -- End U/S
# Author info
is_author_reply = models.BooleanField(default=False)
author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE) author = models.ForeignKey('scipost.Contributor', on_delete=models.CASCADE)
anonymous = models.BooleanField(default=False, verbose_name='Publish anonymously') anonymous = models.BooleanField(default=False, verbose_name='Publish anonymously')
......
...@@ -131,13 +131,6 @@ def reply_to_comment(request, comment_id): ...@@ -131,13 +131,6 @@ def reply_to_comment(request, comment_id):
# ThesisLink # ThesisLink
is_author = comment.content_object.author == request.user.contributor is_author = comment.content_object.author == request.user.contributor
# if comment.submission and not is_author:
# is_author = comment.submission.authors.filter(id=request.user.contributor.id).exists()
# if comment.commentary and not is_author:
# is_author = comment.commentary.authors.filter(id=request.user.contributor.id).exists()
# if comment.thesislink and not is_author:
# is_author = comment.thesislink.author == request.user.contributor
form = CommentForm(request.POST or None, request.FILES or None) form = CommentForm(request.POST or None, request.FILES or None)
if form.is_valid(): if form.is_valid():
newcomment = form.save(commit=False) newcomment = form.save(commit=False)
......
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