From 1b0144e1d3cd3b2d93434b41f0b0796cfaf90fcb Mon Sep 17 00:00:00 2001
From: Jorran de Wit <jorrandewit@outlook.com>
Date: Wed, 4 Oct 2017 12:25:31 +0200
Subject: [PATCH] Fix public resubmissions_incoming references

---
 submissions/models.py                                 | 6 ++++++
 submissions/templates/submissions/editorial_page.html | 6 +++---
 2 files changed, 9 insertions(+), 3 deletions(-)

diff --git a/submissions/models.py b/submissions/models.py
index 401e6caef..e5fb47eb4 100644
--- a/submissions/models.py
+++ b/submissions/models.py
@@ -176,6 +176,12 @@ class Submission(models.Model):
 
     @cached_property
     def other_versions(self):
+        return Submission.objects.public().filter(
+            arxiv_identifier_wo_vn_nr=self.arxiv_identifier_wo_vn_nr
+        ).exclude(pk=self.id).order_by('-arxiv_vn_nr')
+
+    @cached_property
+    def other_versions_pool(self):
         return Submission.objects.filter(
             arxiv_identifier_wo_vn_nr=self.arxiv_identifier_wo_vn_nr
         ).exclude(pk=self.id).order_by('-arxiv_vn_nr')
diff --git a/submissions/templates/submissions/editorial_page.html b/submissions/templates/submissions/editorial_page.html
index 1119bd13f..6d29d4075 100644
--- a/submissions/templates/submissions/editorial_page.html
+++ b/submissions/templates/submissions/editorial_page.html
@@ -20,7 +20,7 @@
 <div class="ml-2 mt-2">
     <h3>- Go to the <a href="{% url 'submissions:submission' arxiv_identifier_w_vn_nr=submission.arxiv_identifier_w_vn_nr %}">Submissions Page</a> to view Reports and Comments</h3>
 
-    {% if submission.other_versions or not submission.is_current %}
+    {% if submission.other_versions_pool or not submission.is_current %}
         <ul class="mt-3 mb-1 list-unstyled pl-4">
             {% if not submission.is_current %}
                 <li>
@@ -28,10 +28,10 @@
                 </li>
             {% endif %}
 
-            {% if submission.other_versions %}
+            {% if submission.other_versions_pool %}
                 <li>Other versions of this Submission exist:</li>
                 <ul class="list-unstyled">
-                    {% for vn in submission.other_versions %}
+                    {% for vn in submission.other_versions_pool %}
                         <li>{% include 'submissions/_submission_version.html' with submission=vn editorial_page=1 %}</li>
                     {% endfor %}
                 </ul>
-- 
GitLab