From 2497ab3da6467618e84207fbffbd17523fec4a4c Mon Sep 17 00:00:00 2001
From: Todd Dembrey <todd.dembrey@torchbox.com>
Date: Fri, 3 Aug 2018 09:59:11 +0100
Subject: [PATCH] Updates from review

---
 opentech/apply/activity/messaging.py                        | 6 +++---
 opentech/apply/activity/migrations/0005_event.py            | 2 +-
 opentech/apply/funds/templates/funds/submission_sealed.html | 2 +-
 opentech/apply/funds/tests/test_views.py                    | 2 ++
 4 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/opentech/apply/activity/messaging.py b/opentech/apply/activity/messaging.py
index ac07d77b0..1c2df5844 100644
--- a/opentech/apply/activity/messaging.py
+++ b/opentech/apply/activity/messaging.py
@@ -23,7 +23,7 @@ class MESSAGES(Enum):
     NEW_REVIEW = 'New Review'
     COMMENT = 'Comment'
     PROPOSAL_SUBMITTED = 'Proposal Submitted'
-    OPENED_SEALED = 'Opened sealed application'
+    OPENED_SEALED = 'Opened Sealed Submission'
 
     @classmethod
     def choices(cls):
@@ -112,7 +112,7 @@ class ActivityAdapter(AdapterBase):
         MESSAGES.INVITED_TO_PROPOSAL: 'Invited to submit a proposal',
         MESSAGES.REVIEWERS_UPDATED: 'reviewers_updated',
         MESSAGES.NEW_REVIEW: '{user} submitted a review',
-        MESSAGES.OPENED_SEALED: '{user} opened the application while still sealed',
+        MESSAGES.OPENED_SEALED: '{user} opened the submission while still sealed',
     }
 
     def recipients(self, message_type, **kwargs):
@@ -161,7 +161,7 @@ class SlackAdapter(AdapterBase):
         MESSAGES.INVITED_TO_PROPOSAL: '<{link}|{submission.title}> by {submission.user} has been invited to submit a proposal',
         MESSAGES.NEW_REVIEW: '{user} has submitted a review for <{link}|{submission.title}>. Outcome: {review.outcome} Score: {review.score}',
         MESSAGES.READY_FOR_REVIEW: 'notify_reviewers',
-        MESSAGES.OPENED_SEALED: '{user} has opened the sealed application: <{link}|{submission.title}>'
+        MESSAGES.OPENED_SEALED: '{user} has opened the sealed submission: <{link}|{submission.title}>'
     }
 
     def __init__(self):
diff --git a/opentech/apply/activity/migrations/0005_event.py b/opentech/apply/activity/migrations/0005_event.py
index 2a863e33d..ffe2c1897 100644
--- a/opentech/apply/activity/migrations/0005_event.py
+++ b/opentech/apply/activity/migrations/0005_event.py
@@ -17,7 +17,7 @@ class Migration(migrations.Migration):
             fields=[
                 ('id', models.AutoField(auto_created=True, primary_key=True, serialize=False, verbose_name='ID')),
                 ('when', models.DateTimeField(auto_now_add=True)),
-                ('type', models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('NEW_SUBMISSION', 'New Submission'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened sealed application')], max_length=50)),
+                ('type', models.CharField(choices=[('UPDATE_LEAD', 'Update Lead'), ('NEW_SUBMISSION', 'New Submission'), ('TRANSITION', 'Transition'), ('DETERMINATION_OUTCOME', 'Determination Outcome'), ('INVITED_TO_PROPOSAL', 'Invited To Proposal'), ('REVIEWERS_UPDATED', 'Reviewers Updated'), ('READY_FOR_REVIEW', 'Ready For Review'), ('NEW_REVIEW', 'New Review'), ('COMMENT', 'Comment'), ('PROPOSAL_SUBMITTED', 'Proposal Submitted'), ('OPENED_SEALED', 'Opened Sealed Submission')], max_length=50)),
                 ('by', models.ForeignKey(on_delete=django.db.models.deletion.PROTECT, to=settings.AUTH_USER_MODEL)),
                 ('submission', models.ForeignKey(on_delete=django.db.models.deletion.CASCADE, to='funds.ApplicationSubmission', related_name='+')),
             ],
diff --git a/opentech/apply/funds/templates/funds/submission_sealed.html b/opentech/apply/funds/templates/funds/submission_sealed.html
index 22aba8dec..0323cd9e9 100644
--- a/opentech/apply/funds/templates/funds/submission_sealed.html
+++ b/opentech/apply/funds/templates/funds/submission_sealed.html
@@ -21,7 +21,7 @@
         <p>As an admin you are allowed to access the application. However, this action will be recorded.</p>
         <form method="post">
             {% csrf_token %}
-            <input class="button button--warning" type="submit" value="View application"></input>
+            <input class="button button--warning" type="submit" value="View application" />
         </form>
     {% endif %}
 </div>
diff --git a/opentech/apply/funds/tests/test_views.py b/opentech/apply/funds/tests/test_views.py
index 1087e98d3..039e0e929 100644
--- a/opentech/apply/funds/tests/test_views.py
+++ b/opentech/apply/funds/tests/test_views.py
@@ -253,6 +253,8 @@ class TestSuperUserSealedView(BaseSubmissionViewTestCase):
         response = self.post_page(submission, {}, 'sealed')
         url = self.url_from_pattern('funds:submissions:detail', kwargs={'pk': submission.id})
         self.assertRedirects(response, url)
+        self.assertTrue('peeked' in self.client.session)
+        self.assertTrue(str(submission.id) in self.client.session['peeked'])
 
     def test_not_asked_again(self):
         submission = SealedSubmissionFactory()
-- 
GitLab