Commit Graph

2056 Commits

Author SHA1 Message Date
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
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
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
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
c7610f359a improve range of params email page can take
Can now deal with no query params and has a
default format of the GOV.UK branding.
2018-08-07 16:56:37 +01:00
Tom Byers
a2a02a5185 Add preview step to branding selection flow
Gives platform admins a chance to preview the
combination of brand type and custom brand
(coloured banner and logo) set for service before
saving.
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
1073b8f178 Merge pull request #2178 from alphagov/cache-has-jobs
Check if any jobs exist before querying jobs
2018-07-31 11:17:42 +01:00
Chris Hill-Scott
1304561a70 Use service model to look up service attributes
This is better than just keying into the JSON because it means you get
an exception straight away when looking up a key that doesn’t exist
(which via mocking you could ordinarily miss).
2018-07-30 14:56:36 +01:00
Chris Hill-Scott
036923c382 Make a service model and use for permissions
Having the service floating about as JSON is a bit flakey. Could easily
introduce a mistake where you mistype the name of a key and silently
get `None`.

Also means doing awkward things like `if 'permission' in
current_service['permissions']`, whereas for users we can do the
much cleaner `user.has_permission()`.

So this commit:
- introduces a model
- adds a `.has_permission` method similar to the one we have for users
2018-07-30 14:56:36 +01:00
Chris Hill-Scott
2070314cb1 Fix missing organisation services from user search
The list of services this page was looking at only included those not
belonging to an organisation.

On production this excludes services we’ve added to organisations to
make the management of those services easier (eg ‘GDS’ and ‘DVLA’).
2018-07-30 11:31:52 +01:00
Chris Hill-Scott
19632ea4ab Add option to copy existing template when adding
Sometimes when setting up a service you might have a few very similar
templates, in which only a small amount of content. Or you might even
have a few of services, which are used by different teams but have
similar templates.

Copy and pasting, especially from one service to another, is a pain.
This commit makes it easier by allowing users to copy an existing
template when choosing to add a new one, instead of starting from
scratch.
2018-07-30 11:31:51 +01:00
Chris Hill-Scott
505de52d38 Check if any jobs exist before querying jobs
At the moment the dashboard does two API calls to find out if a service
has:

1. Scheduled jobs
2. Normal jobs

API calls are slow because they are synchronous, go over the network and
touch the database. We can’t cache these API calls because:
- a scheduled job could become a normal job at any time
- the statistics on a normal job are constantly updating

However there are plenty of services which don’t have any jobs, and
probably never will. And finding out if a service has any jobs is
reliably cacheable (because as soon as a service creates its first job
it has some jobs).

So this commit:
- refactors the way we get scheduled/normal jobs into the job_api_client
  to make the view a bit slimmer
- makes an additional, Redis-wrapped call to find out if any jobs exist
  before trying to get the jobs

This should result in a speedup on the dashboard, and can be used in the
future if there’s anywhere else we want to show or hide something
depending on whether a service has created any jobs (I have some ideas).
2018-07-30 11:14:01 +01:00
Rebecca Law
e806cf036e [WIP]
New service_api_client to get stats for variable days
2018-07-25 10:47:29 +01:00
Pea Tyczynska
72e8303987 Remove view displaying data form monthly_billing table 2018-07-24 14:32:33 +01:00
Chris Hill-Scott
7d535544db Merge pull request #2164 from alphagov/rename-basic-nav
Improve navigation in basic view
2018-07-20 14:54:15 +01:00
Rebecca Law
ce754be464 Addressing comments from PR review.
Update tests
Use a table to display the data retention data.
2018-07-18 15:31:34 +01:00
Rebecca Law
4b8b571a87 Adding views to view, add and edit service data retention policies.
Only visible to a platform admin.
A service can have a custom number of days to retain the notification data for each notification type.
2018-07-17 14:39:04 +01:00
Pea Tyczynska
b3d99507bd Fix displaying of services on User Information page 2018-07-16 17:37:26 +01:00
Chris Hill-Scott
ca9fe6c8f6 Rename ‘Send a message’ to ‘Templates’ in basic view
From Karl:

> Templates – this should be consistent with Admin view. Users may
> switch from Basic to Admin view (or vice versa), they will also
> interact with users who have a different view or permissions to them.
> Neither should have to learn new interfaces and language if possible.

> ‘Send a message’ was a nice, active label – but Notify options aren’t
> usually actions. If we’re going to change this we should be consistent
> across both Admin and Basic views.

> For the same reason, I have rejected ‘see’, ‘search’ and ‘view sent
> messages’. It will be interesting to see in user testing whether users
> read ‘sent messages’ as ‘send messages’.
2018-07-13 17:02:27 +01:00
Rebecca Law
13d05c5461 Allow a platform admin user to set flexible data retention for a service for a specified notification type.
Still a work in progress
2018-07-13 16:47:26 +01:00
Pea Tyczynska
4cd465753a Add view that displays user information, including:
- name
- email
- phone number
- services
- last login
- failed login attempts if any

The view can be accessed from results of find_users_by_email

logged_in_at added to User serialization on admin frontend as
a part of this work
2018-07-13 16:01:52 +01:00
Pea Tyczynska
57e9c1d6e6 Validate against empty form submission for find_users_by_email
This included:
- creating a new form SearchUsersByEmailForm with validation
on its search field

- introducing 400 status to the view  if the form does not validate

- fixing the POST request data structure in the tests (it was
incorrect before and uncaught due to lack of validation and mocking
the response from the API.
2018-07-13 11:58:29 +01:00
Pea Tyczynska
d1a05e2ec5 find_users_by_email view calls API and feeds results to template
Template then displays the results.

Page displays a message if no results found
2018-07-13 11:58:29 +01:00
Pea Tyczynska
ea6a5b6e7d find_users_by_email view loads a page with search form and is linked to 2018-07-13 11:58:28 +01:00
Katie Smith
a5124f4af1 Sanitise csv filenames before saving to S3
Commit 58cc1604a7 sanitises any non-ascii
characters in the headers. CSV filenames get used as a header value, so
this fixed a bug that occurred when non-ascii characters were used.

The CSV filename also gets used as part of the metadata when uploading
the file to S3. Since the S3 metadata can only contain ASII characters,
we also need to sanitise the filename before uploading it to S3.
2018-07-12 15:19:45 +01:00
Chris Hill-Scott
7f0a13e9aa Merge pull request #2136 from alphagov/guess-name
Guess people’s names when they’re invited
2018-07-11 16:11:58 +01:00
Katie Smith
3f117bd7b1 Merge pull request #2152 from alphagov/remove-old-platform-stats
Use new platform-admin page
2018-07-11 11:15:59 +01:00
Chris Hill-Scott
3683f99c3b Guess people’s names when they’re invited
Most people’s names, especially in government are in the format
firstname.lastname@department.gov.uk. This means that you can pretty
reliably guess that their name is ‘Firstname Lastname’.

When users are invited to Notify we know their email address already.

So this commit pre-populates the registration form based on this guess.

This is a nice little detail, but it should also stop the browser
pre-filling the name field with someone’s email address (which I think
happens because the browser assumes a registration form will have an
email field).
2018-07-11 10:35:25 +01:00
Chris Hill-Scott
ed9444b436 Fix org info in branding requests with known orgs
This wasn’t looking quite right in the case where an organisation is in
our list of domains.
2018-07-10 17:18:50 +01:00
Chris Hill-Scott
949bf6feea Add organisation info to branding requests
This will let us know which organisation the person asking for the
branding is from. This should reduce how often we have to go back to
them and ask.
2018-07-10 16:34:44 +01:00
Katie Smith
3bbc73dfd2 Use new platform-admin page
We had kept the original platform-admin page at `/platform-admin` and
created a new page, `/platform-admin-new` for the new platform admin
page. Now that the numbers on both pages look ok we no longer need both
pages, so can replace the original page.
2018-07-10 14:39:54 +01:00
Chris Hill-Scott
95d138b638 Add a preview of basic view
One of the big things we found in user research was that people were
uncertain what the effect of giving someone basic view was.

So in the spirit of ‘show don’t tell’, this commit adds a way for users
to preview basic view. They can go into the preview and click around as
much as they like, just as if they really had the basic view assigned to
them.

Once they have seen enough they can return to the settings page where
they can decide whether or not to switch basic view on for real.
2018-07-10 14:24:02 +01:00
Chris Hill-Scott
2f40ddae20 Remove platform admin toggle for basic view
Since platform admins can use the new settings page, this commit:
- links to that page
- removes the platform-admin-only endpoint that switches basic view on
  and off
2018-07-10 11:45:50 +01:00
Chris Hill-Scott
4d3a4ef9af Add form to let users switch basic view on and off
This commit adds radio buttons to the ‘basic view’ page. This will let
users choose whether basic view is on or off for their service.

As before, this page will only be linked to if a service already has
basic view, so this commit does not launch the new feature.
2018-07-10 11:44:40 +01:00
Chris Hill-Scott
a6662b3f59 Add basic view to the settings page
This commit adds:
- a row to the settings page…
- …which links to a page explaining what basic view is

The new row (and link) will only appear for services who already have
the feature switched on. This is because we are not launching the
feature yet, so it shouldn’t be available to just anyone.
2018-07-10 11:44:40 +01:00
Chris Hill-Scott
c30b86714e Merge pull request #2147 from alphagov/manage-not-modify
Relabel ‘modify service’ to ‘manage service’
2018-07-10 11:42:20 +01:00
Chris Hill-Scott
08dc248abc Relabel ‘modify service’ to ‘manage service’
We are not consistent about this. We use ‘manage service’ on:
- the page listing all the users
- the request to go live checklist

We use modify service on:
- the page where you edit a team member’s permissions
- the page where you invite a new team member

This commit changes the latter to be consistent with the former.
2018-07-09 10:58:35 +01:00
Chris Hill-Scott
5794a54385 Rename ‘caseworker’ to ‘basic view’
‘Caseworker’ was a bad name because it:
- suggested that Notify might be expanding into case management
- may or may not map to someone’s actual role, in a confusing way (this
  is why ‘manager’ is also a bad name)

‘Basic view’ is the best name we could come up with because:
- it describes the purpose of feature, not the user
- a ‘view’ changes what you can _see_ as much as it changes what you can
  do

Admin remains a good word – in research users self-describe their use
of Notify in using it. This commit makes the name ‘admin view’ to match
‘basic view’.

This also means we can hide the legend for this fieldset because the
choices are self-explanatory.
2018-07-09 10:39:09 +01:00
Chris Hill-Scott
b1aac841f4 Merge pull request #2042 from alphagov/allow-remove-callback
Allow callbacks to be removed
2018-07-06 14:52:07 +01:00
Leo Hemsted
4d4424657f allow you to remove URL without removing bearer token 2018-07-06 11:47:35 +01:00