From e905daf28757b3d0193e8b7d461b10bb40b1bd3c Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Mon, 7 Jan 2019 09:04:52 +0100
Subject: [PATCH] Remove deprecated method volunteer_as_EIC

---
 .../pool/submission_info_table.html           |  2 +-
 submissions/urls.py                           |  2 -
 submissions/views.py                          | 66 -------------------
 3 files changed, 1 insertion(+), 69 deletions(-)

diff --git a/submissions/templates/partials/submissions/pool/submission_info_table.html b/submissions/templates/partials/submissions/pool/submission_info_table.html
index 3594325cb..cd0e04b4e 100644
--- a/submissions/templates/partials/submissions/pool/submission_info_table.html
+++ b/submissions/templates/partials/submissions/pool/submission_info_table.html
@@ -42,7 +42,7 @@
             {% elif perms.scipost.can_assign_submissions %}
                 <a href="{% url 'submissions:assign_submission' submission.preprint.identifier_w_vn_nr %}">Send a new assignment request</a>
             {% else %}
-                <strong class="text-danger">You can volunteer to become Editor-in-charge by <a href="{% url 'submissions:volunteer_as_EIC' submission.preprint.identifier_w_vn_nr %}">clicking here</a>.</strong>
+                <strong class="text-danger">You can volunteer to become Editor-in-charge by <a href="{% url 'submissions:editorial_assignment' submission.preprint.identifier_w_vn_nr %}">clicking here</a>.</strong>
             {% endif %}
         </td>
     </tr>
diff --git a/submissions/urls.py b/submissions/urls.py
index 5591c3ff0..443848c1d 100644
--- a/submissions/urls.py
+++ b/submissions/urls.py
@@ -92,8 +92,6 @@ urlpatterns = [
     url(r'^pool/{regex}/editorial_assignment/(?P<assignment_id>[0-9]+)/$'.format(
         regex=SUBMISSIONS_COMPLETE_REGEX), views.editorial_assignment,
         name='editorial_assignment'),
-    url(r'^volunteer_as_EIC/{regex}$'.format(regex=SUBMISSIONS_COMPLETE_REGEX),
-        views.volunteer_as_EIC, name='volunteer_as_EIC'),
     url(r'^assignment_failed/{regex}$'.format(regex=SUBMISSIONS_COMPLETE_REGEX),
         views.assignment_failed, name='assignment_failed'),
     # Editorial workflow and refereeing
diff --git a/submissions/views.py b/submissions/views.py
index 612307310..e33312b7e 100644
--- a/submissions/views.py
+++ b/submissions/views.py
@@ -726,72 +726,6 @@ def assignment_request(request, assignment_id):
     }))
 
 
-@login_required
-@fellowship_required()
-@transaction.atomic
-def volunteer_as_EIC(request, identifier_w_vn_nr):
-    """Single click action to take charge of a Submission.
-
-    Called when a Fellow volunteers while perusing the submissions pool.
-    This is an adapted version of the assignment_request method.
-    """
-    submission = get_object_or_404(Submission.objects.pool(request.user),
-                                   preprint__identifier_w_vn_nr=identifier_w_vn_nr)
-    errormessage = None
-    if submission.status == STATUS_ASSIGNMENT_FAILED:
-        errormessage = '<h3>Thank you for considering.</h3>'
-        errormessage += 'This Submission has failed pre-screening and has been rejected.'
-    elif submission.editor_in_charge:
-        errormessage = '<h3>Thank you for considering.</h3>'
-        errormessage += (submission.editor_in_charge.get_title_display() + ' ' +
-                         submission.editor_in_charge.user.last_name +
-                         ' has already agreed to be Editor-in-charge of this Submission.')
-    elif not hasattr(request.user, 'contributor'):
-        errormessage = (
-            'You do not have an activated Contributor account. Therefore, you cannot take charge.')
-
-    if errormessage:
-        messages.warning(request, errormessage)
-        return redirect(reverse('submissions:pool'))
-
-    contributor = request.user.contributor
-    # The Contributor may already have an EditorialAssignment due to an earlier invitation.
-    assignment, __ = EditorialAssignment.objects.get_or_create(
-        submission=submission, to=contributor)
-    # Explicitly update afterwards, since update_or_create does not properly do the job.
-    EditorialAssignment.objects.filter(id=assignment.id).update(
-        status=STATUS_ACCEPTED, date_answered=timezone.now())
-
-    # Set deadlines
-    deadline = timezone.now() + submission.submitted_to.refereeing_period
-
-    # Update Submission data
-    Submission.objects.filter(id=submission.id).update(
-        status=STATUS_EIC_ASSIGNED,
-        editor_in_charge=contributor,
-        open_for_reporting=True,
-        reporting_deadline=deadline,
-        open_for_commenting=True,
-        latest_activity=timezone.now())
-
-    # Deprecate old Editorial Assignments
-    EditorialAssignment.objects.filter(submission=submission).invited().update(
-        status=STATUS_DEPRECATED)
-
-    # Send emails to EIC and authors regarding the EIC assignment.
-    assignment = EditorialAssignment.objects.get(id=assignment.id)  # Update before use in mail
-    SubmissionUtils.load({'assignment': assignment})
-    SubmissionUtils.send_EIC_appointment_email()
-    SubmissionUtils.send_author_prescreening_passed_email()
-
-    # Add SubmissionEvents
-    submission.add_general_event('The Editor-in-charge has been assigned.')
-
-    messages.success(request, 'Thank you for becoming Editor-in-charge of this submission.')
-    return redirect(reverse('submissions:editorial_page',
-                            args=[submission.preprint.identifier_w_vn_nr]))
-
-
 @login_required
 @permission_required('scipost.can_assign_submissions', raise_exception=True)
 @transaction.atomic
-- 
GitLab