From 35c264d1f86cd16ff183d57f2d9427b5d1cd9325 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 2 Apr 2016 05:55:15 +0200
Subject: [PATCH] Bug fixes in voting on comments links

---
 commentaries/views.py                         | 4 +---
 comments/views.py                             | 2 +-
 scipost/templates/scipost/comments_block.html | 6 +-----
 3 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/commentaries/views.py b/commentaries/views.py
index 0e596397c..bf0b2633f 100644
--- a/commentaries/views.py
+++ b/commentaries/views.py
@@ -166,8 +166,6 @@ def browse(request, discipline, nrweeksback):
     return render(request, 'commentaries/commentaries.html', context)
 
 
-#def commentary_detail(request, commentary_id):
-#    commentary = get_object_or_404(Commentary, pk=commentary_id)
 def commentary_detail(request, arxiv_or_DOI_string):
     commentary = get_object_or_404(Commentary, arxiv_or_DOI_string=arxiv_or_DOI_string)
     comments = commentary.comment_set.all()
@@ -193,7 +191,7 @@ def commentary_detail(request, arxiv_or_DOI_string):
             newcomment.save()
             author.nr_comments = Comment.objects.filter(author=author).count()
             author.save()
-            request.session['commentary_id'] = commentary_id
+            request.session['commentary_id'] = commentary.id
             return HttpResponseRedirect(reverse('comments:comment_submission_ack'))
     else:
         form = CommentForm()
diff --git a/comments/views.py b/comments/views.py
index cf12ec57d..071fb19d8 100644
--- a/comments/views.py
+++ b/comments/views.py
@@ -138,7 +138,7 @@ def express_opinion(request, comment_id, opinion):
     if comment.submission is not None:
         return HttpResponseRedirect('/submission/' + str(comment.submission.id) + '/#comment_id' + str(comment.id))
     if comment.commentary is not None:
-        return HttpResponseRedirect('/commentary/' + str(comment.commentary.id) + '/#comment_id' + str(comment.id))
+        return HttpResponseRedirect('/commentary/' + str(comment.commentary.arxiv_or_DOI_string) + '/#comment_id' + str(comment.id))
     if comment.thesislink is not None:
         return HttpResponseRedirect('/thesis/' + str(comment.thesislink.id) + '/#comment_id' + str(comment.id))
     else: 
diff --git a/scipost/templates/scipost/comments_block.html b/scipost/templates/scipost/comments_block.html
index 735b37643..3b2c427c8 100644
--- a/scipost/templates/scipost/comments_block.html
+++ b/scipost/templates/scipost/comments_block.html
@@ -53,11 +53,7 @@
     <div class="row">
       <div class="col-1"></div>
       <hr style="border-style: dotted;" />
-<!--
-      <div class="col-3">
-	{{ reply.print_identifier|safe }}
-      </div>
--->
+
       <div class="flex-container">
 	<div class="flex-commentbox">
           {{ reply.print_identifier|safe }}
-- 
GitLab