Commit Graph

1024 Commits

Author SHA1 Message Date
kentsanggds
04da9359ef Merge pull request #1223 from alphagov/letter-jobs-page
Letter jobs page
2017-04-11 17:30:40 +01:00
Ken Tsang
0f3131cf21 Refactor test_letter_jobs 2017-04-11 15:17:18 +01:00
Ken Tsang
9ce4ce8031 Add count and disabled checkbox until ready / dvla state 2017-04-11 15:02:20 +01:00
Ken Tsang
e5a377edd8 Add letter jobs page, client and test 2017-04-11 10:59:50 +01:00
Chris Hill-Scott
27d2e3a738 Merge pull request #1219 from alphagov/fix-back-link-check-page
Fix broken journey when going back from check page
2017-04-10 09:39:57 +01:00
Leo Hemsted
331b59eef8 Merge pull request #1220 from alphagov/letter-jobs-on-dashboard
Letter jobs on dashboard
2017-04-07 11:21:19 +01:00
Leo Hemsted
2bb0cba430 add new letter job statuses to job api client
add test to test_dashboard to confirm we're getting for the right queus
2017-04-07 11:08:40 +01:00
Leo Hemsted
c509d3d24f remove unused imports 2017-04-07 10:54:52 +01:00
Chris Hill-Scott
db37a16eda Fix broken journey when going back from check page
We’ve seen in letters usability testing that people get stuck in a
“no-man’s land” when trying to go back from the _Send yourself a test_
page.

This was broken for two reasons:
- we hadn’t considered that a letter template without placeholder still
  requires you to fill in
- we’ve changed subsequently made the _view template_ page the place
  where you do your actions, rather than the (old) page with all the
  templates shown

So this commit fixes it so that the back link always take you back to
the page you were previously on, and adds some more test cases so we
have all the scenarios accounted for.
2017-04-07 09:18:00 +01:00
Chris Hill-Scott
e34d981dda Fix no. of column headers on breaking change page
The breaking change page wasn’t properly accounting for the fact that
letter recipients span multiple columns – it was assuming they’d only
take up one column like they do for email and SMS.

This commit fixes:
- the number of column headers (A, B, C, …) to be correct
- the count of columns (you will need X columns in your file) to be
  correct

It then parameterises the test to look at a case where a recipient is
in one column (email) and multiple columns (letter).
2017-04-06 10:22:36 +01:00
Chris Hill-Scott
2ad9753de2 Add test for preview of CSV file 2017-04-04 09:46:57 +01:00
Leo Hemsted
a037cd53c8 move formatted_list to utils 2017-04-04 09:35:16 +01:00
Chris Hill-Scott
1f278bdd07 Go back to template after editing contact details
Users who go to edit the contact details for a letter from the template
page get very confused when they click save and are dumped on the
settings page. It doesn’t match the way editing other parts of
letter works, and you can’t see an accurate preview of the changes from
the settings page.

So this commit changes the flow to go from the _edit contact details_
page back to the _view template_ page when the user has got there by
clicking the blue _Edit_ button on the _view template_ page.
2017-04-03 10:49:15 +01:00
Leo Hemsted
85404f20db bump utils to 13.10.0
pass in the base URL - if not set in the environment this is set to
localhost, but on paas we can pull this out of vcap_services so that
letters render properly on paas
2017-03-27 17:59:06 +01:00
Pete Herlihy
4a59cae96c Added a route to the new Roadmap page 2017-03-24 13:52:25 +00:00
Chris Hill-Scott
d1d13c23c5 Fix broken links on template statistics page
Tests assumed that the API returns the template `id` as part of the
object. It doesn’t – it returns it as the key used to look up the
object. The `id` was missing from the transformation into the format
used by the front end.

For some reason Flask is fine building the URL with `template_id=None`,
but obviously this doesn’t generate a valid link.
2017-03-20 17:37:59 +00:00
Chris Hill-Scott
44a3a81305 Put template ID on the single template page
Not necessary to have it on its own page – it’s one line of stuff. And
definitely not as frequent use as the ‘Upload recipients’ or ‘Send
yourself a test’ links.
2017-03-20 11:55:48 +00:00
Chris Hill-Scott
dfcfe6a91e Add multiple ‘edit’ links for letter templates
Letter templates have (or will have) multiple different editable
regions. I think that the most intuitive way for this to work is to have
- an edit link for each of these areas
- positioned next to the thing to be edited

Again, this isn’t fully hooked up, but since no-one is using letters
live yet this is a good way of getting research feedback and pointing
towards where we want the feature to go.

Uses percentages for the positioning so that the alignment is maintained
on mobile.
2017-03-20 11:45:27 +00:00
Chris Hill-Scott
14bd05c8a5 Put actions at the top on single template page
The links to the right of the template take up valuable horizontal
space. This means that the preview of email and letter templates isn’t
as big as it could be. By making the letter preview bigger it removes
the need to click through to the PDF to see a preview.

Reuses the navigation style used on the API integration page, because I
think it damages consistency to create another new button style.
2017-03-20 11:43:17 +00:00
Chris Hill-Scott
1365265fc6 Make choose template a list of template names
When a team has lots of templates the choose template page gets very
long. It gets hard to find the template that you are looking for.

Our initial reckon was that teams would not be giving their templates
very useful names, and therefore a preview would be helpful. What we
have found is that:

- teams actually do give their templates useful names, and refer to
  these template names elsewhere

- the previews are less useful for emails and text messages, because
  they have so much content (which for emails also makes it harder to
  `ctrl` + `f` the template name)

The other problem we found was that this page presented the user with
a _lot_ of options. For each template there were 4 actions, plus the
click-to-preview action for letters, plus the ‘see previous version’
action for templates that had been edited multiple times. It was a very
busy page.

And the final problem (that we recently introduced) was that there was
no way, other than the visual cues, to know whether a template was a
letter, email, or text message.

So this commit strips back the choose template page to be very focused
on finding the right template, by only showing the template name and
type. The user can then click through to a page that shows just a single
template, and perform actions relevant to that template from that page.
2017-03-20 11:35:30 +00:00
Chris Hill-Scott
c122a5b3d7 Add unit tests for dashboard template functions
Although we integration test the pages that depend on these, it’s
probably a good idea to unit test them as well, to make sure, for
example, that all the different statuses are counted when working out
how many messages have been sent from a template.
2017-03-16 14:49:22 +00:00
Chris Hill-Scott
4a226a7a29 Show template usage broken down by month
This follows on from:
- https://github.com/alphagov/notifications-admin/pull/1094
- https://github.com/alphagov/notifications-admin/pull/1109

It depends on:
- [ ] https://github.com/alphagov/notifications-api/pull/829

A year is too long. Month-by-month is a better timeframe for making
decisions or seeing patterns in your usage.
2017-03-16 14:04:37 +00:00
Chris Hill-Scott
f2d0f75fce Only show back to service link if you have service
It doesn’t make sense to show the back to service link if, for example,
you are in the onboarding flow and haven’t created a service yet.
2017-03-15 14:26:04 +00:00
Chris Hill-Scott
72fa3713e8 Make example text message template priority
The tour teaches you how Notify works by letting you do a thing and then
showing you the effect of the thing you’ve just done – a text message on
your phone.

This is not as effective if you don’t get the text message quickly. It
breaks the association you make between what you’ve done on the computer
and what’s happening on your phone.

Slow text message delivery can happen if you’re doing a big job. We can
get around this by making your text message use the priority queue.

This was observed in the pilot research session yesterday.
2017-03-09 10:30:19 +00:00
imdadahad
2391410435 Merge pull request #1170 from alphagov/feat-add-who-updated-providers
Show who updated providers and provider history data
2017-03-08 16:43:07 +00:00
Leo Hemsted
deb959e835 welsh assembly emails - foo@assembly.wales 2017-03-08 14:08:57 +00:00
Chris Hill-Scott
7e185f67b1 Fix HTML showing up on breaking change page
The breaking change page temporarily holds the changes in hidden inputs
on the page. The messages content it gets from the `.content` property
on the subject. This is raw and not transformed in any way, so fine.

For the subject it gets the value from the `.subject` attribute on the
template. For email templates, this will be transformed to highlight
placeholders with `<span class='placeholder'>…`. This means that when
the change is confirmed, it’s this encoded version that gets sent to the
API. Which is bad, because we then save `<span class='placeholder'>` in
the database.

This commit changes the page to look at the `._subject` attribute
instead, which is the internal, untransformed version of the subject.
2017-03-07 15:11:37 +00:00
Chris Hill-Scott
56a282f2a0 Fix infinite loop in support flow
The support flow was using `yes` and `no` to mean emergency/not
emergency. But not in all places – in one place it was using
`True`/`False` instead.

We were treating anything other than `yes`/`no` as a non-answer, which
means ask the question again. Because of the `True`/`False` thing, there
was no way of the user providing a valid `yes`/`no` answer. Which means
that we just kept asking them the question again and again and they got
stuck in a loop.
2017-03-07 09:44:21 +00:00
Chris Hill-Scott
5081d83c19 Fix count of columns on breaking change page
For some reason we were rebuilding `new_template` as a dictionary,
without the `placeholders` attribute. This meant that we were never
actually counting the placeholders, just counting the length of `None`
and adding 1 to it.

So this commit fixes that, beefs up the tests, and makes sure that
everything is pluralised properly.
2017-03-06 13:17:37 +00:00
Chris Hill-Scott
536d091d85 Fix HTML showing up on the breaking change page
41fa158635 added a proper Jinja filter
for formatting lists, which was better than the previous macro-based
solution.

It didn’t, however, account for HTML properly. It  did the default Jinja
thing of escaping everything. Since we render lists of placeholders
by putting HTML before and after each item, this didn’t work (the HTML
got escaped and appeared on the page).

So this commit does the escaping of HTML outside Jinja, in the
user-submitted bits of the input only, then passes the whole thing
through as a `Markup` instance which doesn’t get escaped by Jinja.
2017-03-06 13:17:36 +00:00
Chris Hill-Scott
f54689a2b7 Merge pull request #1168 from alphagov/contact-letter-block
add letter_contact_block edit fields
2017-03-06 11:11:54 +00:00
Chris Hill-Scott
b3bb3aaf02 Merge pull request #1163 from alphagov/unified-template-page
Merge email, text message and letter templates pages
2017-03-06 10:42:08 +00:00
Leo Hemsted
1cacd92411 Merge pull request #1153 from alphagov/forget-me
Remove remember me cookie
2017-03-06 09:39:52 +00:00
Chris Hill-Scott
3dabd39c41 Add better error if user goes over line limit
Don’t make people count the number of lines themselves.
2017-03-03 16:30:18 +00:00
Leo Hemsted
5c3588445e add letter_contact_block edit fields
no actual template functionality yet - just the ability for services
that have letters enabled to edit a 10 line block that will go on the
top right hand side of their letters with contact information
2017-03-03 16:18:59 +00:00
Imdad Ahad
e20ac9bdc8 Refactor to have separate view for viewing and editing a provider with tests 2017-03-03 11:01:27 +00:00
Chris Hill-Scott
457249c0fa Put template name on preview page
We’ve had a couple of instances where teams have sent the wrong template
to a …number of users.

Sometimes templates can be very similar and only have slight variations
to tailor them to a specific subset of users. So identifying the right
template by sight can be difficult.

We know that teams do give their templates meaningful names, and use
these names in other tools (spreadsheets etc) to refer to the templates.

So putting the name of the template on the page where you’re about to
send all the messages seems like it’s gives people an easier way of
double checking that they’re doing the right thing.

I umm’d and ahh’d over the wording a bit, and think ‘Preview of…’ reads
the best. It looks a bit weird because most template names are Title
Case. I think it’s better than some ambiguous punctuation (eg ‘Preview:
Template name’ or ‘Template name – preview’).

Some examples of real template names:
- Preview of Example text message templates
- Preview of Online LPA payment application reminder
- Preview of Create user account
- Preview of Split journey - Unknown credentials
- Preview of Public user: application without supporting documents
- Preview of Renewal Survey – February
- Preview of CEX New adult
- Preview of Applications are closing tomorrow
- Preview of Your application result - if successful
2017-03-02 17:29:53 +00:00
Leo Hemsted
85efe0d117 remove flask's builtin remember me functionality
we don't need it cos we do it all ourselves
2017-03-02 16:55:10 +00:00
Chris Hill-Scott
54a666e8e9 Add Scottish Enterprise to list of gov domains
> Scottish Enterprise is Scotland's main economic development agency
> and a non-departmental public body of the Scottish Government.

– https://www.scottish-enterprise.com/about-us

For some reason their email domain is `scotent.co.uk` (but it redirects
to www.scottish-enterprise.com on the web for the some reason
¯\_(ツ)_/¯)
2017-03-02 10:18:19 +00:00
Chris Hill-Scott
43a922638b Merge email, text message + letter templates pages
Right now we have separate pages for email and text message templates.
In the future we will also have a separate page for letter templates.

This commit changes Notify to only have one page for all templates.

What is the problem?
---

The left-hand navigation is getting quite crowded, at 8 items for a
service that can send letters. Research suggests that the number of
objects an average human can hold in working memory is 7 ± 2 [1]. So
we’re at the limit of how many items the navigation should have.

In the future we will need to search/sort/filter templates by attributes
other than type, for example:
- show me the ‘confirmation’ templates
- show me the most recently used templates
- show me all templates containing the placeholder `((ref_no))`

These are hypothetical for now, but these needs (or others) may become
real in the future. At this point pre-filtering the list of templates
by type would restrict what searches a user could do. So by making this
change now we’re in a better position to iterate the design in the
future.

What’s the change?
---

This commit replaces the ‘Email templates’, ‘Text message templates’ and
‘Letter templates’ pages with one page called ‘Templates’.

This new templates page shows all the templates for the service, sorted
by most recently created first (as before).

To add a new template there is a new page with a form asking you what
kind of template you want to create. This is necessary because in the
past we knew what kind of template you wanted to create based on the
kind you were looking at.

What’s the impact of this change on new users?
---

This change alters the onboarding process slightly. We still want to
take people through the empty templates page from the call-to-action on
the dashboard because it helps them understand that to send a message
using Notify you need a template. But because we don’t have separate
pages for emails/text messages we will have to send users through the
extra step of choosing what kind of template to create. This is a bit
clunkier on first use but:

- it still gets the point across
- it takes them through the actual flow they will be using to create new
  templates in the future (ie they’re learning how to use Notify, not
  just being taken through a special onboarding route)

I’m not too worried about this change in terms of the experience for new
users. Furthermore, by making it now we get to validate whether it’s
causing any problems in the lab research booked for next week.

What’s the impact of this change on current services?
---

Looking at the top 15 services by number of templates[2], most are using
either text messages or emails. So this change would not have a
significant impact on these services because the page will not get any
longer. In other words we wouldn’t be making it worse for them.

Those services who do use both are not using as many templates. The
worst-case scenario is SSCS, who have 16 templates, evenly split between
email and text messages. So they would go from having 8 templates per
page to 16, which is still less than half the number that HMPO or
Digital Marketplace are managing.

References
---

1. https://en.wikipedia.org/wiki/The_Magical_Number_Seven,_Plus_or_Minus_Two

2. Template usage by service

Service name                           | Template count | Template types
---------------------------------------|----------------|---------------
Her Majesty's Passport Office          |             40 | sms
Digital Marketplace                    |             40 | email
GovWifi-Staging                        |             19 | sms
GovWifi                                |             18 | sms
Digital Apprenticeship Service         |             16 | email
SSCS                                   |             16 | both
Crown Commercial Service MI Collection |             15 | email
Help with Prison Visits                |             12 | both
Digital Future                         |             12 | email
Export Licensing Service               |             11 | email
Civil Money Claims                     |              9 | both
DVLA Drivers Medical Service           |              9 | sms
GOV.UK Notify                          |              8 | both
Manage your benefit overpayments       |              8 | both
Tax Renewals                           |              8 | both
2017-03-01 15:17:06 +00:00
Rebecca Law
9308e95b02 Merge pull request #1162 from alphagov/fix-user-login-flow
Fix user login flow
2017-02-28 16:50:11 +00:00
Rebecca Law
35f61125e8 Fix the user flow when the user account is locked.
The user has 10 tries at the password, after which the account is locked.
The same is true for the verify code, the user will have 10 tries before the user account is locked.
2017-02-28 14:41:31 +00:00
Chris Hill-Scott
90da5a35da Merge pull request #1160 from alphagov/11-or-fewer
Make long SMS sender name error accurate
2017-02-27 16:09:00 +00:00
Chris Hill-Scott
e909bce928 Make long SMS sender name error accurate
`<=11` not `< 11`
2017-02-27 15:56:58 +00:00
Leo Hemsted
9fda5d1847 remove remember_me cookie and related code 2017-02-27 15:18:18 +00:00
Chris Hill-Scott
888821d1b4 Don’t 500 when a CSV is missing rows
> When the CSV is missing the header row, we get an error and the user
> will see "Sorry, we are experiencing technical difficulties..."
>
> We should return a better error message for the user.

– https://www.pivotaltracker.com/story/show/140668615

This was caused by an attempt to access the `first_recipient` variable
before it was assigned. It would only be assigned when there was at
least one row in the file.

Fixing this means doing two things:
- defaulting `first_recipient` to be `None` before looking in the file
- adding an error message for when we can’t extract any rows out of the
  file (which is more nuanced than the file just being completely empty)

(There’s a nasty `sort` in the Jinja template because when there are no
rows in the file the order of the required column headers is not
deterministic.)
2017-02-27 14:46:01 +00:00
Chris Hill-Scott
e1f53760bf Fix wrong error message if file is missing columns
Accidentally got broken here:
41fa158635 (diff-bff3df90be0231a1e33e033fc51ba7f7L78)

This commit changes it back to how it was before (but keeping the new macro for formatting the list).
2017-02-27 12:43:20 +00:00
Leo Hemsted
4df12f5f4e ensure other 2FA pages also handle session id
specifically, the 2FA page when you first create an account is different to the login 2FA page
and also the 2FA page when you change your phone number is different as well
2017-02-24 16:32:59 +00:00
Leo Hemsted
f14a836baa check users' session id.
when a user enters their 2FA code, the API will store a random UUID
against them in the database - this code is then stored on the cookie
on the front end.

At the beginning of each authenticated request, we do the following
steps:
  * Retrieve the user's cookie, and get the user_id from it
  * Request that user's details from the database
  * populate current_user with the DB model
  * run the login_required decorator, which calls
    current_user.is_authenticated

is_authenticated now also checks that the database model matches the
cookie for session_id. The potential states and meanings are as follows:

 database | cookie | meaning
----------+--------+---------
 None     | None   | New user, or system just been deployed.
          |        | Redirect to start page.
----------+--------+---------
 'abc'    | None   | New browser (or cleared cookies). Redirect to
          |        | start page.
----------+--------+---------
 None     | 'abc'  | Invalid state (cookie is set from user obj, so
          |        | would only happen if DB is cleared)
----------+--------+---------
 'abc'    | 'abc'  | Same browser. Business as usual
----------+--------+---------
 'abc'    | 'def'  | Different browser in cookie - db has been changed
          |        | since then. Redirect to start
2017-02-22 17:31:13 +00:00
Imdad Ahad
2c51792ae5 Update two-factor to use new update password endpoint and refactor tests 2017-02-20 14:55:28 +00:00