Commit Graph

2234 Commits

Author SHA1 Message Date
Katie Smith
f78b3bff81 Add '/letter-branding' page to show all letter brands
This is a platform admin page which lists all letter brands and their
domain. Once the page to edit a letter brand has been created, each
brand will link to its edit page, but for now this is just a list of
brand names and domains.
2019-02-07 16:16:22 +00:00
Leo Hemsted
f87f89bfd2 Merge pull request #2734 from alphagov/set-letter-branding
Set letter branding for a service
2019-02-07 14:36:53 +00:00
Chris Hill-Scott
1efdf5e06c Merge pull request #2740 from alphagov/change-not-edit-postage
Say ‘Change’ not ‘Edit’ postage
2019-02-07 12:00:30 +00:00
Leo Hemsted
f83910599c remove option for branding to sometimes not show search
it wouldn't show search if there were under a certain amount of letter
or email branding options - however we know there will always be more
than that amount so lets remove some complexity.

Also, rename the SearchTemplatesForm because it can search anything -
it just prompts you to search by name is all.
2019-02-07 11:39:23 +00:00
Leo Hemsted
d5446774fa letter branding text fields should be optional 2019-02-07 11:38:20 +00:00
Leo Hemsted
5405c2e1be fix service settings letter branding tests
some tests are now expanded to handle the fact that letter branding
can be null
2019-02-07 11:38:20 +00:00
Chris Hill-Scott
e45024affd Say ‘Change’ not ‘Edit’ postage
To match the call to action on the template page.

Karl said:

> I feel good about it. You're not really editing it so much as choosing between 2 options. It feels more human.
>
> I think it only started out as edit to match all the other sections of the letter – it certainly wasn't given any real consideration.
2019-02-06 17:27:32 +00:00
Katie Smith
bbc5eaa12f Handle the database errors on name and domain fields
Form errors were being shown (such as a domain not being a valid), but
we weren't showing nicely formatted error messages if the database
failed to save a new row.
2019-02-06 17:26:58 +00:00
Katie Smith
529d7df5f5 Add page to create new letter branding
This has a form with 3 fields - the file upload field, logo name, and an
optional logo domain. Logos need to be uploaded in `.svg` format and we
then convert this to `.png` format and upload both file types to S3 as
well as saving the letter branding details in the database.
2019-02-06 17:26:58 +00:00
Katie Smith
446b9ccbb2 Add create_letter_branding method to letter branding client 2019-02-06 17:26:58 +00:00
Katie Smith
b68d0722bb Fix mocks in existing s3 client tests
Some of the tests were calling methods that didn't exist on MagicMock
objects, which meant that they were always passing. For example, tests
using the format of MagicMock.called_once_with(...) were always passing
since a MagicMock does not have the method `called_once_with`. Changing
this to `assert_called_once_with` ensures that the tests fail if they're
called with the wrong arguments.
2019-02-06 17:26:58 +00:00
Katie Smith
d654a87f5c Rename the current s3 logo client functions
We will be adding methods to deal with letter logos, so this adds 'email' to
the method names for email logos to avoid confusion later.
2019-02-06 17:26:58 +00:00
Katie Smith
f005d7a569 Refactor to split s3_client.py into multiple files
Separated s3_client.py into 3 files - for logos, CSV files and the MOU.
This helps to keep things clearer now that we need to add lots more logo
functions for letters.
2019-02-06 17:26:58 +00:00
Chris Hill-Scott
b98f73112d Remove existing display of postage
It’s redundant now we’re displaying it as part of the template.
2019-02-06 14:37:17 +00:00
Pea Tyczynska
b07f16b9a0 Don't use service default postage, but template postage instead 2019-02-06 11:40:50 +00:00
Pea Tyczynska
64aff0ba05 Remove choose_postage feature flag so everyone can choose postage 2019-02-05 17:21:15 +00:00
Chris Hill-Scott
d9e3a90123 Remove ‘You’ve’
It could be someone else who’s uploaded them.
2019-02-05 15:09:24 +00:00
Chris Hill-Scott
5a70587fe8 Refine wording of ‘already sent’ error 2019-02-05 14:59:21 +00:00
Chris Hill-Scott
27217f1ad1 Merge pull request #2731 from alphagov/fix-empty-message
Fix empty folder message
2019-02-05 14:55:26 +00:00
Chris Hill-Scott
ce04c9c45a Merge pull request #2725 from alphagov/job-sent-already
Warn if a file has been sent already
2019-02-05 14:55:08 +00:00
Chris Hill-Scott
34f509af11 Fix empty folder message
Sometimes, when filtering the view by template type, the message was
saying the folder was empty, when really it should have been saying that
there were no templates of the ‘type’ you’re looking for, eg:
> There are no email templates in this folder

This was because it was looking at the filtered list of templates, not
all templates to determine whether a folder was really empty.
2019-02-05 14:28:11 +00:00
Pea Tyczynska
fe6b73b8dc Remove service postage setting and choose_postage switch 2019-02-04 14:55:16 +00:00
Pea Tyczynska
20ae200de9 Remove choosing postage from edit template content flow 2019-02-04 14:45:33 +00:00
Pea Tyczynska
db5378bac2 Edit template postage from a separate view 2019-02-04 14:45:33 +00:00
Chris Hill-Scott
88f9d156c7 Warn if a file has been sent already
We have some teams who haver a series of files they have to send each
day. It’s easy to get muddled up and accidentally send the same file
again, if you think you haven’t already sent it.

This commit blocks you from sending the same combination of template
version and filename more than once on the same day[1].

This won’t affect teams who re-use the same template to give (for
example) updates on an incident for business continuity. These teams
edit the template between each send, thereby updating the version
number of the template.

1. This is based on how the `limit_days` argument to the API works - you
can dig into the code here: 2bd4f74ad0/app/dao/jobs_dao.py (L50)
2019-02-04 14:44:54 +00:00
Chris Hill-Scott
33f318afec Remove platform admin toggles for email/SMS
Users can do this themselves now.
2019-02-01 18:33:32 +00:00
Chris Hill-Scott
7905b29d64 Remove button to toggle folders on/off
We don’t need it now that everyone has folders.
2019-02-01 18:33:31 +00:00
Chris Hill-Scott
88ad982bf7 Improve display of folder path when deeply nested
It’s a bit rudimentary to only show the current place in the hierarchy
and the parent. You lose a sense of how deep you are.

But we can’t just show the full path, because it can be arbitrarily
long. So what this commit does is show the full path, but truncates the
display of any items. Further-up than the current folder or its parent.

This also helps disambiguate between folders and templates, because
folders are always shown with the folder icon.

This probably won’t affect many teams, because we don’t anticipate a lot
of deep nesting.
2019-02-01 10:28:29 +00:00
Chris Hill-Scott
7c59d7323b Merge pull request #2690 from alphagov/client-init-refactor
Refactor API client code to be less duplicative/repetitive
2019-01-30 14:06:38 +00:00
Chris Hill-Scott
2fae31a1ee Use 301 to redirect old URL
301 is a `permanent redirect`, which is semantically more accurate.
2019-01-30 13:36:01 +00:00
Chris Hill-Scott
3b15b04fc2 Let users switch channels on and off by themselves
We let people do this for letters already. We should let them do it for
emails and texts too, rather than have to email us.
2019-01-29 16:05:32 +00:00
Chris Hill-Scott
1d3a4e5043 Inherit don’t duplicate API client constructor
This removes some code which is duplicative and obscure (ie it’s not
very clear why we do `"a" * 73` even though there is a Very Good Reason
for doing so).
2019-01-29 12:11:27 +00:00
Katie Smith
5b77329e63 Validate name field on ServiceUpdateEmailBranding form
This introduces a validator to validate that the name field is not empty
on the ServiceUpdateEmailBranding form, but only if the form details are
being submitted. If a file is being uploaded, the name is allowed to be
empty.
2019-01-29 11:37:27 +00:00
Katie Smith
52acf890dd Stop persisting email branding logos if saving to db fails
We were previously persisting the logo for the email branding and
deleting the temp files that get created before trying to update the
database with the new email branding. This meant that if there was an
error when saving (e.g. the domain used was a duplicate) the final logo
was already in S3 and trying to go 'back' in the browser would give an
error since the temp files needed to display the create branding page
had already been deleted.

This changes the order we do things in, so that we try persisting the
email branding to the database first.
2019-01-29 11:37:27 +00:00
Katie Smith
0bf3a4b16d Refactor to add separate letter branding client
We were getting all letter logos from a method in the email branding
client. Since we will be adding more client methods to deal with
letters, it makes things clearer to separate the email and letter
branding clients.
2019-01-29 11:37:27 +00:00
Chris Hill-Scott
0d3dec1058 Merge pull request #2661 from alphagov/cant-choose-postage-if-can-choose-template
Don’t give postage choice on service and template
2019-01-29 09:48:39 +00:00
Chris Hill-Scott
44ebf1485d Merge pull request #2681 from alphagov/show-domains-against-brands
Show domains, not owners against brands
2019-01-29 09:48:27 +00:00
Chris Hill-Scott
88f868c57d Show domains, not owners against brands
The owner is often repetetive, eg

> *Hackney Council*
> Default for Hackney Council

Instead it’s more useful to reflect what the person setting up the brand
has entered – the domain.

This also adds an empty hint for non-default brands so that the page is
evenly spaced and nothing overlaps.
2019-01-23 14:16:44 +00:00
Katie Smith
c30d94bf5c Stop automatically resending email verification links
This commit stops a new email verification link from being sent to a
user if they click on an email link which has expired or which has
already been used. Instead, they will be see an error message with a
link to the sign in page. This stops the situation where someone could
log in indefinitely (without the needing to enter their password) by
trying to use a used / expired email verification link and receiving a
valid link automatically.
2019-01-22 13:59:16 +00:00
Chris Hill-Scott
a9effaa82e Merge pull request #2669 from alphagov/test-key-letters
Show if letters are sent using a test key
2019-01-22 11:36:13 +00:00
Chris Hill-Scott
085856e062 Revised wording to avoid negative contraction 2019-01-22 10:38:40 +00:00
Chris Hill-Scott
cfcdfcc38c Show if letters are sent using a test key
It’s inaccurate to have an estimated delivery date for letters sent
using a test key. We shouldn’t reassure people that:
- the letter won’t be printed
- (in the case of precompiled letters) that the letter has passed
  validation
2019-01-22 09:54:40 +00:00
Katie Smith
bbc7b173f0 Ensure non-gov invited users get added to services
We were adding invited users to services in the `main.add_service` view
function as the last step in the process of inviting users. Since this
view function is decorated with `@user_is_gov_user`, invited users with
non-governmental email addresses would never reach this point and would
be able to register an account but would not get linked to a service.

To fix this, we now add the invited user to the service at the point at
which the user gets activated and also ensure that non-gov users don't
get redirected to a page which they don't have permission to view.
2019-01-22 09:52:55 +00:00
Katie Smith
398aef6d4c Revert "Stop automatically resending email verification links" 2019-01-21 15:44:15 +00:00
Katie Smith
9095893e03 Stop automatically resending email verification links
This commit stops a new email verification link from being sent to a
user if they click on an email link which has expired or which has
already been used. Instead, they will be see an error message with a
link to the sign in page. This stops the situation where someone could
log in indefinitely (without the needing to enter their password) by
trying to use a used / expired email verification link and receiving a
valid link automatically.
2019-01-21 14:29:22 +00:00
Alexey Bezhan
ec0575009b Merge pull request #2667 from alphagov/template-and-notification-stats-use-one-api-call
Use single api call for service notification stats and template usage stats
2019-01-17 15:35:00 +00:00
Alexey Bezhan
20d5cdf6c3 Merge pull request #2663 from alphagov/adding_support_for_new_api_template_statistics_response
Add support for new template statistics API response
2019-01-17 13:42:43 +00:00
Pea Tyczynska
52526f2b9f Test aggregate_notifications_stats 2019-01-16 11:24:24 +00:00
Chris Hill-Scott
558ae87baa Hide ‘back to …’ link if it’s not your service
This can happen if you click a link for a service you don’t have access
to. We shouldn’t show the back to service link in this case because:
- you shouldn’t be able to find out the service’s name from just knowing
  the link
- if you click the link you only get a `403` anyway
2019-01-15 17:31:55 +00:00
Pea Tyczynska
e5647703b3 Remove support for old template statistics api response 2019-01-15 16:44:37 +00:00