Commit Graph

2259 Commits

Author SHA1 Message Date
Chris Hill-Scott
7530fbf731 Fix the tests and catch a few more examples 2018-08-20 18:05:46 +01:00
Rebecca Law
3fda171f80 New columns for email branding
Added banner_colour, single_id_colour and domain to email branding view. Now able to set the fields.

However, the new fields are not being used yet.
2018-08-20 13:27:17 +01:00
Katie Smith
1b6c357dea Use new value of SMS_CHAR_COUNT_LIMIT from utils
Admin, API and utils were all defining a value for SMS_CHAR_COUNT_LIMIT.
This value has been updated in notifications-utils to allow text
messages to be 4 fragments long and notifications-admin now gets the value of
SMS_CHAR_COUNT_LIMIT from notifications-utils instead of defining it in
config.
2018-08-16 16:56:32 +01:00
Tom Byers
6249f4826b Merge pull request #2235 from alphagov/sort-branding-radios-alphabetically
Sort branding radios alphabetically
2018-08-16 16:49:12 +01:00
Alexey Bezhan
3a00574034 Merge pull request #2224 from alphagov/notifications-page-data-retention-period
Notifications page data retention period
2018-08-16 13:55:55 +01:00
Tom Byers
f85a9306a6 Move brandings sort into email_branding_client 2018-08-16 13:40:24 +01:00
Tom Byers
bdde98e9ba Add tests for sort order of branding radios 2018-08-15 16:13:28 +01:00
Tom Byers
93d3027d1f Make email_branding_mock results out of order
It's useful for testing that they will be put into
order in the interface and doesn't break any
existing tests.
2018-08-15 16:13:28 +01:00
Tom Byers
01089f4d8c Fix test for organisations in brand selection page
This test was a duplicate of that for branding
showing. This renames them both to better explain
what they do and makes the later one check for
branding styles.

This also removes the
`mock_get_letter_email_branding` param from the
first test as it wasn't being used.
2018-08-15 16:13:28 +01:00
Sakis
85ec7a28cb Merge pull request #2231 from alphagov/zipkin-headers
Both trace_id and span_id headers must be present
2018-08-15 16:10:09 +01:00
Tom Byers
6b0d79ad72 Stop email preview showing brand name
This is a leftover from when email brands didn't
have a 'text' field.

It also adds some tests to check the brand name
is displaying correctly.
2018-08-15 13:52:17 +01:00
Athanasios Voutsadakis
984e09cc6a Both trace_id and span_id headers must be present 2018-08-14 18:12:06 +01:00
Tom Byers
8ba8606963 Merge pull request #2230 from alphagov/add-branding-name-to-ui
Show the 'name' of the email branding in the adding and editing screens
2018-08-14 16:05:56 +01:00
Tom Byers
6375a1ac5e Make testing for 'text' value more specific
Just duplicting the 'name' field could produce a
false-positive.
2018-08-14 15:59:02 +01:00
Tom Byers
dcb9973f76 Fix the tests broken by the changes 2018-08-14 14:18:16 +01:00
Athanasios Voutsadakis
6786ff8fde Use the zipkin headers from utils version 30.0.0 2018-08-14 13:20:21 +01:00
Alexey Bezhan
e3a0adc293 Use per-service data retention period to display notifications page
Uses the configured service data retention page to display retention
period length, notification counts and fetch notifications from the
API on the notifications page.
2018-08-13 17:07:49 +01:00
Alexey Bezhan
52d48ad679 Add API client method to fetch service data retention by type 2018-08-13 17:06:16 +01:00
Alexey Bezhan
28b03fe748 Add limit_days argument to statistics API client method
Allows getting notification counts for a given number of days to
support services with custom data retention periods (admin
dashboard page should still display counts for the last 7 days,
while the notifications page displays all stored notifications).
2018-08-13 17:04:40 +01:00
Katie Smith
979fd9bbe4 Allow service contact details to be phone number, email or url
Service contact details are needed if the upload document permission is
enabled - this used to be a link but services can now choose to use a
link, email address or phone number. The form to add or change service
contact details now gives these options and validates the data according
to the type of contact details provided.

When validating phone numbers we can't use the existing validation
because we want to allow landlines too, so there is a basic check that
the phone number is the right length and doesn't include certain
characters.
2018-08-13 10:33:39 +01:00
Chris Hill-Scott
89795186ec Merge pull request #2217 from alphagov/remove-basic-view
Remove basic view setting and preview
2018-08-10 17:04:19 +01:00
Chris Hill-Scott
2573aacae8 Merge pull request #2216 from alphagov/fix-back-link-template-skip
Fix ‘Back’ link from first step of one off
2018-08-10 17:02:23 +01:00
Chris Hill-Scott
ec69aa6c39 Merge pull request #2214 from alphagov/sort-services-alpha-on-copy
Sort services alphabetically when copying template
2018-08-10 16:59:00 +01:00
Chris Hill-Scott
5a52eafb84 Fix ‘Back’ link from first step of fix one off
If you skip past the templates page (because you don’t have the edit
permission) but then click back you end up in a loop which redirects you
to the page you’re already on.

This commit makes sure that you’re sent back a step further, so you
don’t get stuck in that loop.
2018-08-10 09:16:18 +01:00
Chris Hill-Scott
fdf3670661 Remove basic view setting and preview 2018-08-09 17:51:34 +01:00
Chris Hill-Scott
61507fda8f Make the permission labels shorter
They were feeling a bit heavy on the _Team members_ page. We can remove
some words without losing any meaning.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
347912876c Relabel existing permissions
Since we have added a new, 5th permission the existing permissions
should be relabelled so that the five make sense as a coherent set.

We especially want to make sure that:
- the labels work against the checkboxes and against the tick/crosses on
  the manage users page (a long time ago this page was layed out
  differently so didn’t have space for full labels)
- there is no confusion between usage and reports

This commit also:
- re-adds a line about what all users can see (‘sent messages’) but
  continues to omit the additional bullet points about templates and
  team members (because we think this is clear enough from reading the
  permissions)
- refactors the `Form` subclass so that the content and order of the
  permissions only have to be defined once
- brings back the ‘permissions’ legend on the `fieldset`
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
5108187cab Show letters in basic view
We were taking letters away from basic view because there’s no one-off
sending of letters.

But now that basic view isn’t an opt-in thing but something we’re
rolling out to all users who only have the ‘send’ permission it feels
like too drastic a change to remove letters.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
3e14e5e52b Don’t skip template page for letters
It’s too jarring to go straight from the list of templates to the upload
addresses page. So while we don’t have sending a one-off letter as a
thing, let’s keep the template page.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
646ba6e8c3 Add a ‘See dashboard’ permission
Our research and prototyping around ‘basic view’ found that:
- a lot of users who send messages rarely or never look at the dashboard
  (yet it’s the first page they see when they sign in)
- team managers like the idea of taking away things that users don’t
  need in order to make the interface simpler

We’ve disentangled the simpler way of sending messages from being part
of ‘basic view’. This means we can give managers the option of taking
away the dashboard as an independent choice, not something that’s
wrapped up in a separate ‘view’.

I think that this checkbox is a more straightforward proposition than
‘basic view’ ever was (despite all the work we did to explain it and
develop the nested checkbox pattern). In research users would often
explain the feature back to us as being about hiding the dashboard – we
should try to make Notify operate in terms of concepts that come
naturally to people wherever possible.
2018-08-09 13:49:06 +01:00
Chris Hill-Scott
55d051d95a Sort services alphabetically when copying template
If you have a lot of services it’s hard to find the one you’re looking
for if the sort order is a mixture of `created_by` and which ones belong
to an organisation.

Since the templates within the services are sorted alphabetically it
makes sense to also sort the services alphabetically.
2018-08-09 13:33:08 +01:00
Chris Hill-Scott
bbdbe61cad Let users with empty permissions see certain pages
We’re going to make it possible for some users to be members of a
service, but not have any permissions (not even `view_activity`).

There are some pages that these users should still be able to see
These are the pages that a user with ‘basic view’ would have been able
to see, excluding those that let them send messages.
2018-08-09 11:56:15 +01:00
Chris Hill-Scott
e34ca2a8ee Make it clear which template you’re sending
The one downside of skipping the template page is that you no longer
get such strong confirmation that you’ve picked the correct template.
You still see the preview of the template, but it’s further down the
page, and the name of the template has disappeared.

This commit adds the name of the template to the page title, to:
- have some continuity from the previous page
- make it easier to double-check you’ve chosen the correct template
2018-08-09 11:56:15 +01:00
Chris Hill-Scott
147ea75177 Skip template page for users who only send
If you only send messages then there’s no longer much point in the
template page. It now, for you, only has one action – ‘Send’.

This commit changes the journey for these users so they go straight from
clicking the name of the template to the page where you enter the phone
number or email address.

This is better because it reduces the number of steps a user has to
click through to send a message.

This journey is what we were previously calling ‘basic view’. But this
changes makes it automatically available to anyone who would benefit
from it. It removes the complexity of:
- having to opt in to basic view at a service level
- having to choose on a per-user basis who has basic view
- understanding the nuance between basic view and only choosing the
  ‘Send messages’ permission

Users who will still see the template page are:
- those who can edit templates – they need the ‘edit’ link
- users with the manage API keys permission – they need a place to get
  the template ID
2018-08-09 11:56:15 +01:00
Chris Hill-Scott
bcf538fa10 Remove separation between upload and send
Now that you can access upload from within the send one off message
flow, it doesn’t need its own linkbutton on the template page.
2018-08-09 11:56:14 +01:00
Chris Hill-Scott
3bd62c2aef Offer link to upload
‘Upload recipients’ and ‘Send to one recipient’ have always been
slightly clunky phrases.

Now that basic view jumps straight into the ‘Send to one recipient’
flow there’s no way for users to get to the ‘Upload recipients’ flow.

By adding a link to it from the ‘Send to one recipient’ flow it’s
possible for users of basic view to access it.

But we don’t want to introduce too much inconsistency between basic view
and admin view because users will be migrating from one to another. They
might also be talking to their manager, who wouldn’t be able to tell
them where to click if they were looking at two completely different
interfaces.

This also means that we can keep the left-hand navigation in basic view
nice and simple with the two options (‘Templates’ and ‘Sent messages’),
rather than trying to introduce something like ‘Send one message’ and
‘Send lots of messages’ later on.
2018-08-09 11:56:13 +01:00
Chris Hill-Scott
015d656d34 Merge pull request #2208 from alphagov/label-message-type-search
Label the search box dependent on message type
2018-08-09 09:37:01 +01:00
Tom Byers
dcc0eb1e52 Change test on URL to use urllib methods
Checking the raw string was breaking the test
sometimes due to it expecting the query parameters
to be in a different order.
2018-08-08 16:24:52 +01:00
Chris Hill-Scott
214bfa9873 Label the search box dependent on message type
It doesn’t make sense to say ‘Search by email address or phone number’
when you’re only looking at emails.
2018-08-08 14:58:58 +01:00
Tom Byers
e7ead052ce Add tests for /_email page 2018-08-08 11:21:30 +01:00
Tom Byers
d8d48ea801 Add tests for preview step
Includes moving code that tests an API call to
update the service with the new branding to the
preview step submission.

Also includes a change to the HTTP params sent by
the set-email-branding step. Think it was missed
out of this PR:

https://github.com/alphagov/notifications-admin/pull/1843

...so was never changed to 'branding_style'.
2018-08-07 17:05:30 +01:00
Tom Byers
eb72f43b3f Fixes for tests broken by changes
- corrects target page for set_email_branding to
  new preview step instead of itself
- removed check for helper method being called in
  email page test
- updates expected result for test of global
  headers to include changes to `frame-src`
- updates navigation config with brand preview page
2018-08-07 16:56:37 +01:00
Rebecca Law
18750585c4 Reduced the size of the pull request by only dealing with adding the data retention form. 2018-08-06 16:04:31 +01:00
Rebecca Law
ae1f1c95d6 Merge branch 'master' into flexible-data-retention 2018-08-06 15:37:11 +01:00
Chris Hill-Scott
55054b81b5 Include test key data by default on platform admin
This is the existing behaviour. It’s broken by this issue in WTForms
2.2.1: https://github.com/wtforms/wtforms/issues/401

This commit hand-crafts the default value, because WTForms is ignoring
the `default` argument on the form object attribute.

Not really sure how this ever worked 🤔
2018-08-03 14:53:40 +01:00
Chris Hill-Scott
fc5f3ee132 Merge pull request #2192 from alphagov/jobs-one-off
Show uploaded files in basic view
2018-08-02 15:23:58 +01:00
Chris Hill-Scott
c551ce9a42 Show jobs in basic view
There are some teams who send jobs on a daily/weekly basis. They have
team members who only use Notify for this purpose. So they would
probably benefit from basic view, because they don’t need to see the
dashboard.

This commit:
- adds a new item (uploaded files) to the basic view navigation for
  teams that have sent at least one job
- makes the job pages visible to basic view users

I think we should do this now, rather than as a later enhancement to
basic view. We only have one chance to announce the feature, so teams
who do send jobs may otherwise discount it as not useful for them and
the opportunity to have them use it is lost.
2018-08-01 10:45:02 +01:00
Rebecca Law
d512f330cd Edit, don’t duplicate, existing templates 2018-07-31 16:23:46 +01:00
Chris Hill-Scott
b35f6e9d5f Merge pull request #2180 from alphagov/service-model
Make a service model
2018-07-31 13:31:09 +01:00
Chris Hill-Scott
45579c59cd Store boolean values in Redis as valid JSON
Calling `.set()` with `True` stores the byte string `'True'` which
cannot subsequently be decoded from JSON (because boolean values in
JSON are lowercase, ie `true`).
2018-07-31 12:17:28 +01:00