Commit Graph

925 Commits

Author SHA1 Message Date
Chris Hill-Scott
65be12fa87 Remove pentesters from list of domains
Reverts https://github.com/alphagov/notifications-admin/pull/1071
2017-01-31 14:34:02 +00:00
Rebecca Law
f07de56b38 Merge pull request #1096 from alphagov/rename-deactive-service-endpoint
Changed deactivate service to archive service.
2017-01-31 13:51:26 +00:00
Leo Hemsted
2cd8304061 Merge pull request #1082 from alphagov/persist-letters
allow creation of letter jobs
2017-01-31 10:31:34 +00:00
Rebecca Law
6d883b59ad Changed deactivate service to archive service.
need to deploy https://github.com/alphagov/notifications-api/pull/808 first
2017-01-31 09:54:51 +00:00
Rebecca Law
49ce146790 Merge pull request #1091 from alphagov/fix-back-button
Fix back button on breaking-change.html
2017-01-25 08:57:41 +00:00
Rebecca Law
de94f369a7 A bug was reported on where editting a template with a breaking change.
The url was not being properly formed, missing the tempalte_id, meaning the back button on the page did not work.

This fixes that, includes a check of the url for the back button.
2017-01-24 17:42:18 +00:00
Chris Hill-Scott
c380b92104 Merge pull request #1083 from alphagov/removed-download-link
Removed download link on the notifications page.
2017-01-24 17:29:00 +00:00
Chris Hill-Scott
155fe70960 Merge pull request #1090 from alphagov/fix-trial-mode-error
Fix trial mode error message when uploading CSV
2017-01-24 17:17:05 +00:00
imdadahad
6817d84808 Merge pull request #1086 from alphagov/fix-sent-totals-on-platform-admin
Fix: Platform admin showing incorrect sent totals
2017-01-24 12:25:48 +00:00
Imdad Ahad
4d124a5711 Refactor test to use client fixture 2017-01-24 11:01:44 +00:00
Chris Hill-Scott
920ac6115c Fix trial mode error message when uploading CSV
Problem: it wasn’t saying ‘phone number’ or ‘email address’

Why: we renamed `Recipients.recipient_column_header` to
`Recipients.recipient_column_headers`, and made it return a list, not
a string.

The fix: take the first item of the list, and use that to decide whether
it’s phone numbers or email addresses that you’re not allowed to send
to.

N.B. This won’t work for letters, but we don’t know how trial mode is
going to work for letters anyway.
2017-01-23 22:42:08 +00:00
Chris Hill-Scott
97b02edbf9 Add introducer video to the product page
It’s always been the plan to put this video on the product page. Just
getting round to it now.

Watch the video here: https://www.youtube.com/watch?v=i2a2jiwYTd4

Uses the CSS developed by the service manual team, taken from here:
a5c613f07b/source/stylesheets/modules/_responsive-embed.scss
2017-01-23 16:25:11 +00:00
Imdad Ahad
343bf9ab98 Show delivered+failed on platform admin sent totals 2017-01-23 11:59:37 +00:00
Martyn Inglis
923d057787 Removed download link on the notifications page.
- This is a big download of unfettered data. This needs to be more nuanced to be useful
2017-01-20 16:40:49 +00:00
Leo Hemsted
51f3e0478a allow creation of letter jobs 2017-01-20 16:20:37 +00:00
Chris Hill-Scott
3b1c0c3e02 Merge pull request #1078 from alphagov/sanitize-html-in-templates-using-utils
Sanitize HTML in templates using utils
2017-01-20 13:44:52 +00:00
imdadahad
18b2936223 Merge pull request #1077 from alphagov/fix-row-number-issue-on-report-download
Fix issue where row_number starts from 3 on a job report download
2017-01-20 12:38:50 +00:00
imdadahad
f8cb5e59a9 Merge pull request #1074 from alphagov/show-last-updated-on-view-providers
Add last updated column (formatted) in view providers table
2017-01-20 12:38:29 +00:00
Leo Hemsted
ef91c374a5 send users back to beginning of tour if they hit back at end
(previously it would have sent them to the choose template page)
if the user has added new templates or deleted the example one,
they're clearly competent enough to use the app so don't worry
(we wouldn't know what URL the tour starts on since the UUID of
the example template is random)
2017-01-20 10:45:29 +00:00
Chris Hill-Scott
04966e4051 Test that template content passed to API is dirty
We don’t want sanitized content going into the database, because
sometimes we need the content unsanitised. The path from admin to the
API is where the template goes on it’s way to the database. So let’s
make sure we’re not sanitizing it at this stage.
2017-01-19 16:51:53 +00:00
Chris Hill-Scott
597c6da857 Sanitize HTML in templates using utils
We can no longer trust that the content of templates stored in the
database is safe.

Utils now has code to sanitise the content of templates.

This commit:
- updates utils to bring this code in
- modifies some integration tests to make sure everything is working
  (there are more extensive unit tests in utils)
2017-01-19 16:34:34 +00:00
Imdad Ahad
b7099ebb3c Modify stub providers with default values for consistency 2017-01-19 15:41:09 +00:00
Leo Hemsted
9e414ef3c0 when pressing back after sending CSV redirect properly
previously we were issuing a flask redirect (302) from the function,
which we then attempted to unpack as a dict further down the line.

raise a werkzeug.routing.RequestRedirect (301 MOVED PERMANENTLY)
instead. note: only use this pattern when the URL they attempted to
access will *NEVER* be valid, as 301s are cached by browsers.
2017-01-19 15:20:30 +00:00
Imdad Ahad
6a48325b3b Fix issue where row_number starts from 3 on a job report download 2017-01-19 10:42:58 +00:00
Rebecca Law
babafd8dc9 Change the drop down to read Use priority queue? yes|no 2017-01-18 16:03:30 +00:00
Rebecca Law
3dfb3806d2 Add a selectField to edit and create templates that is only visible for platform admins that makes the template a priority template.
There is a check that the template can not be created as priority if the user is not a platform admin.
There is a check that the template can not change the `priority` unless they are a platform admin.
2017-01-18 15:11:34 +00:00
Imdad Ahad
ac3467c1b5 Add last updated column (formatted) in view providers table 2017-01-17 15:21:05 +00:00
Leo Hemsted
88b848a4a3 bump utils to 13.1.0
brings in changes to allow logging json to sdout on cloudfoundry boxes
2017-01-17 11:44:42 +00:00
bandesz
10950bb8a6 Run on Paas 2017-01-17 11:44:42 +00:00
Martyn Inglis
d45484feb5 This PR allows the pentesters to operate as part of white listed root domains. Needed for full app testing. 2017-01-16 14:18:46 +00:00
imdadahad
b5cb34c368 Merge pull request #1070 from alphagov/return-streamed-csv
Fix timeout on download of large CSV reports
2017-01-16 10:34:25 +00:00
Imdad Ahad
e04dd02c14 Fix blank lines issue 2017-01-13 11:45:09 +00:00
Imdad Ahad
50e0227480 Fairly large refactor of tests related to getting/viewing notifications 2017-01-13 11:37:14 +00:00
Imdad Ahad
d170c97cec Refactor existing tests to expect csv stream with helper method 2017-01-06 17:49:20 +00:00
Imdad Ahad
1036f365fa Refactor generate csv test to expect a stream (generator) 2017-01-06 17:43:46 +00:00
Chris Hill-Scott
559433c5d2 Add remaining endpoints for PDFs and PNGs
Right now we can show what a letter template looks like as a PDF or PNG.

This commit completes the work so this is also possible when:

- showing a template with the placeholders replaced
- showing any version of a template

Also removes dependency on `Exception().message`, which was deprecated
in Python 2.6. See
97f82d565f
for full details.
2017-01-04 15:45:59 +00:00
Rebecca Law
ea73936f0b Merge pull request #1067 from alphagov/add-date-range-filter-to-platform-admin
Add date range filter to platform admin
2017-01-04 14:21:16 +00:00
Rebecca Law
8b89b7f911 Remove print statements. 2017-01-04 13:02:01 +00:00
Rebecca Law
21582cadb3 Get the BooleanField working in the form. 2017-01-03 16:14:25 +00:00
Leo Hemsted
f1feaaaccc add hmcts.net to email whitelist
(HM Courts & Tribunals Service)
2017-01-03 12:34:57 +00:00
Rebecca Law
5572d0f25f This commit renders the platform admin page with the given start and end date query params.
Need to add a form to the page to take these params.
2016-12-28 15:23:19 +00:00
Rebecca Law
df41da4860 [WIP] Attempt at adding a form to the platform admin page is not working well for me here. But I want to commit it so I can look at it again. 2016-12-28 14:44:53 +00:00
Rebecca Law
d0a5ef0247 Refactored the tests to use the client fixture, saves a couple lines of code per test. 2016-12-22 15:24:23 +00:00
Rebecca Law
7b54e0c463 After investigating a 500 in the admin app, I found an edge case in the invitation registration flow that can cause an error.
The flow is as follows:
If the invited user clicks on the /invitation/<token> link in the email (now on /register-from-invite),
then goes to another browser and registers for Notify.
Coming back to the other browser, submit the form for /register-from-invite.

This PR fixes that bug and adds a couple tests for register_from_invite
2016-12-22 11:43:11 +00:00
Chris Hill-Scott
1c679ae621 Make breaking change not use rendered template
The breaking change page was taking the rendered template and saving
that if the user confirmed the change. This meant that templates could
be saved with `<span class="placeholder">…</span>` in their subject line
for example.

This commit fixes it so that it uses whatever data the user submitted,
not the rendered version of this.
2016-12-14 14:32:07 +00:00
Chris Hill-Scott
dc63de0f4e Incorporate breaking utils changes
Brings in:
- [ ] https://github.com/alphagov/notifications-utils/pull/94
2016-12-14 14:32:07 +00:00
Chris Hill-Scott
43296469d6 Add endpoint for generating an image of a letter
The PDF preview is all good, but it’s hard, finickeity and feels dirty
to embed a PDF in a web page. It’s a more natural thing to embed an
image in a web page.

So this commit adds another endpoint to return an image of a letter
template. It generates this image from the PDF preview, so the stack
looks like:

1. `template.png` (generated in admin)
2. `template.pdf` (generated in admin)
3. HTML preview (generated by a `Renderer` in utils)
4. `Template` instance
5. serialised template from API
6. Template stored in database

The library used to convert the PDF to an image is Wand[1], which binds
to ImageMagick underneath. So in order to get this working locally on a
Mac you will probably need to do:
`brew install imagemagick ghostscript cairo pango`.

To get it working on Ubuntu/EC2 is an exercise left to the reader…

1. http://docs.wand-py.org/en/0.4.4/
2016-12-13 10:34:18 +00:00
Chris Hill-Scott
d0f90eac7e Add an endpoint for generating a PDF of a letter
Previewing a letter is different to previewing an email or text message
because:

- a letter has a layout
- the layout is fixed, ie it doesn’t depend on the user’s device
- the ‘send yourself a test’ feature won’t be as useful because it has
  a lead time, so the feedback loop will be much longer

For these reasons a HTML-only preview of the letter won’t be enough (we
don’t think). A PDF is more appropriate because:

- it can replicate the layout of the letter exactly
- it is a print format, so the user could even print themselves a copy
  locally to get a feel for how it will look

This commit makes use of Flask WeasyPrint [1] to take a HTML
representation of the letter, convert it to a PDF and serve it back to
the user.

The actual work to generate the HTML and specify the layout is done in
utils, same as we do for rendering other messages.

1. https://pythonhosted.org/Flask-WeasyPrint/
2016-12-13 10:34:18 +00:00
Leo Hemsted
466d0b10ac Merge pull request #1051 from alphagov/inactive-service
users can't edit inactive services
2016-12-12 14:59:30 +00:00
Leo Hemsted
2419f0d8a9 write tests for @minglis 's code 🙁 2016-12-09 16:09:47 +00:00