Commit Graph

1476 Commits

Author SHA1 Message Date
Leo Hemsted
e99d3263cb fix issues with too many messages partial not branching correctly
branch for "has service sent anything today" was around the intial
paragraph, rather than around the "you can still send..." bit -
they should always see the first paragraph, especially the bit that
points out if they're in trial mode. They don't need to see how
many messages they have remaining today if it's the same amount as
their daily limit.
2016-07-25 10:41:50 +01:00
Leo Hemsted
17087e3530 move too many messages error to its own partial 2016-07-25 10:41:50 +01:00
Leo Hemsted
6ff77c995e add tests for service_api_client 2016-07-21 17:32:28 +01:00
Leo Hemsted
0cc2a90a1a add tests for get_dashboard_totals 2016-07-20 14:12:22 +01:00
Leo Hemsted
3ffd6c744c separate detailed and normal service_api_client.get_service
to make it easier to mock and control return values
2016-07-20 14:12:22 +01:00
Leo Hemsted
3e6eedd079 use new detailed service endpoint for dashboard totals
we don't want to use the old statistics endpoints any more
also a couple of quality of life changes
* moves some logic out of the _totals.html template
* tidies up statistics_utils
2016-07-20 14:12:22 +01:00
Leo Hemsted
4451a8634d add detailed flag to GET service api client
returns current (past 7 days) notification stats as well as service info
2016-07-20 14:12:22 +01:00
Chris Hill-Scott
8d7c37886c Merge pull request #795 from alphagov/delivery-info-specific-time
Make ‘Available for…’ text on job page relative
2016-07-20 12:01:06 +01:00
Chris Hill-Scott
f6bdef4ca3 Add tests for time_left
This commit extracts the code that works out the ‘Data available for…’
message so that it’s easy to unit test for.
2016-07-20 11:50:22 +01:00
Chris Hill-Scott
9a5fbca707 Make ‘Available for…’ text on job page relative
When we say ‘delivery information is available for 7 days’ you have to
infer _when_ the seven days starts. When you come back to the page it
still says ‘available for 7 days’ even if you only have a day left to
download it. This is confusing.

This commit changes the text to be relative to now, eg ‘available for 7
days’, ‘available for 1 day’.

The date is counted to midnight on the seventh day, which is when the
data is actually deleted.
2016-07-19 15:25:17 +01:00
Leo Hemsted
743a9d05d1 Merge pull request #794 from alphagov/refactior
Rename api_client to service_api_client
2016-07-19 13:26:34 +01:00
Chris Hill-Scott
86a4daa4e8 Don’t pass entire job thru to notifications page
It only needs the `id`, and it only needs that to generate the download
URL, so let’s just pass the URL through instead.
2016-07-19 12:47:06 +01:00
Chris Hill-Scott
55902d2927 Add a test for the ‘available for 7 days’ text
So that we can check it’s still correct when we make it dynamic.
2016-07-19 12:46:45 +01:00
Chris Hill-Scott
cfadead292 Make it clearer what you’re downloading
The previous text didn’t make it clear _what_ you were downloading as a
CSV file, you had to infer it from the context.

And the fact that it’s a CSV file is immaterial, it’s the data you care
about, not the format.
2016-07-19 12:46:20 +01:00
Chris Hill-Scott
83c1035f1b Really hide the ‘download CSV’ link in the tour
Tried to do this in
https://github.com/alphagov/notifications-admin/pull/743

Didn’t account for it reappearing when the AJAX fired, because the AJAX
request didn’t account for whether or not the user was in the tour.
2016-07-19 09:32:41 +01:00
Leo Hemsted
1cd2841c17 rename api_client to service_api_client 2016-07-15 15:23:23 +01:00
Chris Hill-Scott
1c8c86bd1c Merge pull request #781 from alphagov/template-previews
Adds previews of email templates
2016-07-15 10:35:15 +01:00
Adam Shimali
22601ab4f6 Increase daily message limit for unrestricted services.
This pr is for:

https://www.pivotaltracker.com/story/show/126230157
2016-07-14 11:38:54 +01:00
Chris Hill-Scott
9c83d559f3 Fix wonky tables on dashboard and activity page
Tables with a `layout` of `fixed` determine column widths from the
width of the column headings.

We weren’t setting the width of the first column heading, so our tables
were getting out of alignment.
2016-07-13 16:56:28 +01:00
Chris Hill-Scott
1f90a7eee0 Show full email template on single template page
There’s no point in collapsing […] the email on the single template
page because it’s the only thing on the page.

Users will probably be going back and forth quite a bit to edit their
template and see the changes; they shouldn’t have to expanded it evey
time to check they’ve got the heading syntax right, for example.
2016-07-13 08:55:59 +01:00
Chris Hill-Scott
c006b8748c Add conditional placeholder detection
Implements: https://github.com/alphagov/notifications-utils/pull/51

Copies the same regex.

Adds some CSS to display conditional placeholders differently to
normal placeholders (vertical rather that curved right-hand edge).
2016-07-12 17:11:52 +01:00
Chris Hill-Scott
d380eaf060 Allow images to be served from live domain
Currently images in our email template are hardcoded to be served from
the live domain[1].

In order for the admin app, running locally or in preview/staging, to be
able to load these images when previewing an email template, the CSP
headers need to allow this domain.

Also splits the header string up using string literal concatenation[2]
so that it’s easier to read.

1. https://notifications.service.gov.uk
2. https://docs.python.org/3/reference/lexical_analysis.html#string-literal-concatenation
2016-07-12 16:46:46 +01:00
Chris Hill-Scott
9f91694c71 Add a ‘private’ preview email template endpoint
This will make working on the email template easier.

Includes examples of features like lists, headings, blockquotes, etc.
2016-07-12 16:46:46 +01:00
Rebecca Law
43938936f3 If a user has already registered with the email they will get a different email when the register again.
The email includes likes to sign in and send feedback
2016-07-12 11:53:30 +01:00
Rebecca Law
b4525d0a64 Merge branch 'master' into email-registered-users 2016-07-12 11:05:16 +01:00
Pete Herlihy
488de1ce7c Removed 'states are the same for email and text' blurb. 2016-07-11 15:01:28 +01:00
Chris Hill-Scott
5f67560b1e Link to failure reasons from job/activity pages
If something has failed and you don’t know why, you should be able to
find out why. Let’s try adding a link to the page explaining why, so
it’s not just buried in the footer.
2016-07-11 14:01:42 +01:00
Chris Hill-Scott
d22b2f678d Make ‘message’ plural when talking about retries
In each of these cases the previous sentence talks about messages,
plural, so these lines should agree.
2016-07-11 13:57:05 +01:00
Chris Hill-Scott
90bdf51e3a Rename failure status on delivery page
…so that they agree with what we show in the interface/CSV, eg ‘phone
does not exist’ instead of ‘permanent failure’.
2016-07-11 13:55:02 +01:00
Chris Hill-Scott
8d59b51387 Use shorter sentences to describe sending state
It was running on a bit…
2016-07-11 13:54:37 +01:00
Chris Hill-Scott
50c20ce680 Add formatted notification status to CSV
This commit makes the CSV download use the same language for failure
reasons as the frontend.

It also adds a test around this stuff, which was patchily tested before.
2016-07-11 13:12:46 +01:00
Chris Hill-Scott
f9a9048579 Make ‘temporary failure’ error less cryptic
‘Phone number doesn’t exist’ as opposed to ‘Permanent failure’ has
tested well because it talks in terms of things people understand.

We should do the same for ‘Temporary failure’, because users are
unclear:
- why this is happening
- if it’s temporary, is Notify going to retry it (it’s not)

We think that ‘Phone/inbox not currently accepting messages’ answers
makes these things clearer.

I’ve reworded it slightly to:

- ‘Inbox not accepting messages right now’
- ‘Phone not accepting messages right now’
2016-07-11 11:18:01 +01:00
Chris Hill-Scott
d33c254fa5 Merge pull request #743 from alphagov/hide-delivery-download-tour
Hide download CSV link when in the tour
2016-07-08 16:31:16 +01:00
Rebecca Law
cdd666a23b Add api client call to email users that are already registered 2016-07-08 11:00:23 +01:00
Chris Hill-Scott
ec01eee7b9 Merge pull request #766 from alphagov/visual-refactor-team-page
Visual refactor team page
2016-07-08 09:02:20 +01:00
Chris Hill-Scott
5410fb2f64 Merge pull request #765 from alphagov/fix-large-file-uploads
Fix 500 being thrown when uploading large files
2016-07-07 15:33:31 +01:00
Leo Hemsted
a67fe56907 Merge pull request #763 from alphagov/api-key-types
Api key types
2016-07-07 14:58:31 +01:00
Chris Hill-Scott
7edff47410 Put email address on team page
Right now, a user can change their name and masquerade as someone else
and the service manager has no way of telling who is who.

This is also true for platform admins, where they can see the users of
a service but can’t identify which department they are from.

This commit adds a user’s email address next to their name to remedy
this.
2016-07-07 12:43:37 +01:00
Chris Hill-Scott
f9ebb337e3 Tidy layout of team page
The team page was a bit of a mess:

- invited and active tables didn’t line up
- lots of things were wrapping onto two lines
- the empty fields for when a user didn’t have permissions looked broken

This commit splits each row of the table (not actually a table any more)
onto two lines. First line has the user’s info, second has their
permissions and any associated actions.
2016-07-07 12:43:35 +01:00
Chris Hill-Scott
84a2862387 Fix 500 being thrown when uploading large files
This is re-fixing a bug which was re-introduced when adding the
`Spreadsheet` class in 1409ca36ca.

It was previously fixed in 19662d8329:

>  Fix bug with large file uploads
>
>  Depending on the size of the uploaded file, Flask will temporarily store
>  it in different ways. This means that it comes back as a `TempFile` if
>  the file is roughly <500k and as `BytesIO` if the file is larger.
>
>  `TempFile` supports the `.getvalue()` method, but `BytesIO` does not.
>  Both support the `.read()` method, so this commit changes to use that
>  instead.
2016-07-07 11:52:57 +01:00
Chris Hill-Scott
60f79afb6b Make the date take up less space 2016-07-07 09:18:49 +01:00
Chris Hill-Scott
8b9704df0e Restore API keys table to 2 columns
Because it get ugly when there’s 3 columns and everything is wrapping.
2016-07-07 09:03:20 +01:00
Leo Hemsted
aac3112274 mmg rates set to 1.65p
also moved a default parameter to a plain ol' local variable to reduce ambiguity about whether it is overriden by any callers (it's not)
2016-07-06 16:10:19 +01:00
Leo Hemsted
630b5df552 Save api_key.key_type from radio buttons 2016-07-06 15:10:36 +01:00
Chris Hill-Scott
c0c516ba7a Make documentation its own section of the page
This visually chunks the page up into three parts:
- keys
- service ID
- documentation

Also fixes the documentation link (because it’s not service-specific).
2016-07-06 10:12:20 +01:00
Chris Hill-Scott
01df039aab Indicate the type of key in the table of keys
When looking at your keys, it’s useful to know which are `test`/`team`.

Default (`normal`) keys don’t get a label.
2016-07-06 10:12:20 +01:00
Chris Hill-Scott
7fcd56dc02 Add radio buttons for choosing the API key type
Best-guess wording for what the labels and question should be.

Adds a macro for rendering radio buttons from a WTForms field.
2016-07-06 10:12:20 +01:00
Chris Hill-Scott
49d8e68589 Rename ‘Add a new API key’ page
‘Create’ matches the text of the button on the previous page.
2016-07-06 10:12:20 +01:00
Chris Hill-Scott
ddef996f34 Rename ‘API keys’ page to ‘API integration’
Since this page is more than just your API keys, it should be named
something else.

Hopefully the word ‘integration’ will give non-techical users a clue
that it’s possible to use Notify without doing the CSV dance.
2016-07-06 10:12:20 +01:00
Chris Hill-Scott
80e0832f7d Make a function for parsing help query param
Our templates are a littered with `request.args.get('help', '0')`.
This commit refactors these into a single helper method, which can be
used by the view functions, then passed to the template.

This makes the templates cleaner, and should make it easier to refactor
`help` out of the query parameters entirely in the future.
2016-07-05 17:29:41 +01:00