From 0413fec5b3ee0cab260963545c1842b5c3f2ee09 Mon Sep 17 00:00:00 2001
From: George Katsikas <giorgakis.katsikas@gmail.com>
Date: Thu, 18 Jul 2024 12:15:30 +0300
Subject: [PATCH] remove referee indication step on resubmission

---
 .../templates/submissions/submit_steps.html    | 18 ++++++++++--------
 scipost_django/submissions/views/__init__.py   | 15 ++++++++++-----
 2 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/scipost_django/submissions/templates/submissions/submit_steps.html b/scipost_django/submissions/templates/submissions/submit_steps.html
index 86f6630ee..3c164abc9 100644
--- a/scipost_django/submissions/templates/submissions/submit_steps.html
+++ b/scipost_django/submissions/templates/submissions/submit_steps.html
@@ -33,13 +33,15 @@
       </td>
       <td>Fill in the submission details form</td>
     </tr>
-    <tr>
-      <td>Step&nbsp;5</td>
-      <td class="text-center">
-  {% if step == 5 %}<span class="text-warning">{% include 'bi/arrow-right-square-fill.html' %}</span>{% endif %}
-	{% if step > 5 %}<span class="text-success">{% include 'bi/check-square-fill.html' %}</span>{% endif %}
-      </td>
-      <td>Indicate potential referees</td>
-    </tr>
+    {% if not thread_hash %}
+      <tr>
+        <td>Step&nbsp;5</td>
+        <td class="text-center">
+          {% if step == 5 %}<span class="text-warning">{% include 'bi/arrow-right-square-fill.html' %}</span>{% endif %}
+          {% if step > 5 %}<span class="text-success">{% include 'bi/check-square-fill.html' %}</span>{% endif %}
+        </td>
+        <td>Indicate potential referees</td>
+      </tr>
+    {% endif %}
   </table>
 </div>
diff --git a/scipost_django/submissions/views/__init__.py b/scipost_django/submissions/views/__init__.py
index b486b098a..8e617f903 100644
--- a/scipost_django/submissions/views/__init__.py
+++ b/scipost_django/submissions/views/__init__.py
@@ -370,6 +370,7 @@ class RequestSubmissionView(LoginRequiredMixin, PermissionRequiredMixin, CreateV
         context["journal"] = get_object_or_404(
             Journal, doi_label=self.kwargs.get("journal_doi_label")
         )
+        context["thread_hash"] = self.request.GET.get("thread_hash")
         return context
 
     def get_form_kwargs(self):
@@ -423,10 +424,13 @@ class RequestSubmissionView(LoginRequiredMixin, PermissionRequiredMixin, CreateV
 
     def get_success_url(self):
         """Redirect to the indicate referees step."""
-        return reverse(
-            "submissions:submit_indicate_referees",
-            kwargs={"identifier_w_vn_nr": self.submission.preprint.identifier_w_vn_nr},
-        )
+
+        url_kwargs = {"identifier_w_vn_nr": self.submission.preprint.identifier_w_vn_nr}
+        if not self.submission.is_resubmission:
+            # First submission, redirect to indicate referees
+            return reverse("submissions:submit_indicate_referees", kwargs=url_kwargs)
+        else:
+            return reverse("submissions:submission", kwargs=url_kwargs)
 
 
 class RequestSubmissionUsingSciPostView(RequestSubmissionView):
@@ -518,7 +522,8 @@ def submit_indicate_referees(request, identifier_w_vn_nr):
     ):
         raise PermissionDenied("You are not the submitting author of this Submission.")
 
-    if submission.status != Submission.INCOMING:
+    # Redirect to main referee indications view if passed preassignment of is resubmission
+    if submission.status != Submission.INCOMING or submission.is_resubmission:
         return redirect(
             reverse(
                 "submissions:referee_indications",
-- 
GitLab