Commit Graph

1859 Commits

Author SHA1 Message Date
Chris Hill-Scott
61b8e10fc0 Merge pull request #2765 from alphagov/folder-after-delete-template
Return to a template’s folder after deleting it
2019-02-18 13:22:27 +00:00
Katie Smith
862d077f66 Removed links to add_template_by_type_endpoint
The endpoint was removed, but was still linked to in a couple of
places. Some old links were no longer needed, so have been removed.

We do still need a link to `add_template_by_type` on the 'Choose reply'
page - this page is used to allow to let someone pick a template to
reply to inbound SMS with. Since the link only appears if they have no
SMS templates, we now link to `.choose_template` with the templates and
folders form already opened at the option to add a template.
2019-02-15 08:06:06 +00:00
Chris Hill-Scott
a7b090d287 Return to a template’s folder after deleting it
It’s disconcerting going back to the root if a template is in a deeply
nested folder. Especially if you’re trying to delete multiple templates.
2019-02-14 10:32:50 +00:00
Chris Hill-Scott
b2ed3e01b4 Merge pull request #2752 from alphagov/remove-folder-flag
Remove code that is redundant now that all users have folders
2019-02-13 17:10:24 +00:00
Chris Hill-Scott
77aba35c49 Add an ‘add logo’ button
Because some people don’t know they can put their own logo on letters:

> The HM Government Logo is at the top of the letter and we can't see
> a way of putting the [organisation] logo on

> We are intending to use the letter template feature for the first time
> and wondered whether the branding is configurable or whether the HM
> Government header is the standard default.

> Can we replace HM Government logo with our own in the letter? IF yes,
> then how?

> I don't seem to be able to set the branding on the letters to be
> [organisation]. it's always HM government. Is there something that
> needs enabling for this account?

No-one actually wants the HM Government logo (no-one is sending real
letters using it). So we should leave the space blank and put a button
there prompting people to add their own logo.
2019-02-13 15:12:36 +00:00
Katie Smith
31a1c1ca51 Pass service domain to api when adding a new service
We need to pass the domain to api when adding a service so that api can
link the domain of the service with a letter brand.
2019-02-12 14:59:29 +00:00
Katie Smith
1cb1ce310a Add update_letter_branding view function
This works in a similar way to the create_letter_branding view function,
but with a few minor differences:
* Since we already have a file, uploading a file is no longer required
(since we can just use the current file if a new one is not uploaded)
* We save the changes in the database, then upload the new files to S3.
If saving to S3 raises an error, we now rollback the database changes to
prevent any errors when trying to view letters with the original logo.
2019-02-12 14:59:29 +00:00
Chris Hill-Scott
8512e26d6f Remove add folder as a separate page
This has moved to the choose template page.
2019-02-11 17:55:58 +00:00
Chris Hill-Scott
7d7b790dc1 Remove add template as separate page
This has moved to the choose template page.
2019-02-11 17:55:58 +00:00
Chris Hill-Scott
3a5bfeb7aa Remove folders feature flag
Every service has this feature now[1] so we don’t need to check whether
or not it’s switched on any more.

1. https://github.com/alphagov/notifications-api/pull/2286
2019-02-11 17:55:57 +00:00
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
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
8266635a7a remove dvla_organisation and other unused things
dvla_organisation, branding_dict, a weird `branding` property on
update_service. all gone 💥
2019-02-07 11:38:20 +00:00
Leo Hemsted
a1caf77b0e use new letter branding instead of dvla organisation id
new code is copied stylistically from the email branding patterns.
Instead of `service.dvla_organisation`, there's now
`service.letter_branding` and `service.letter_branding_id`. However,
unlike email branding we're not currently showing a preview of the
logo. That can come later when we work out how we want to do it.
2019-02-07 11:30:18 +00:00
Leo Hemsted
0e20ca44a3 rename branding to email_branding
to help transition to having letter branding as well
2019-02-07 11:30:18 +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
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
cd70355db8 Display postage everywhere we display a letter
To avoid the problem of having confusing defaults, the postage is now
set explicitly on every template.

Putting the postage ‘inside’ the letter template makes the interaction
for changing it consistent with how other parts of the template are
added.

Plus everyone loves skeumorphism.
2019-02-06 14:37:16 +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
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
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
94ce9a76fe Merge pull request #2692 from alphagov/self-serve-channels
Let users switch channels on and off by themselves
2019-01-30 13:46:39 +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
b760703b26 Fix indentation 2019-01-30 12:02:45 +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
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
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
Pea Tyczynska
52526f2b9f Test aggregate_notifications_stats 2019-01-16 11:24:24 +00:00
Pea Tyczynska
06ab25665e Use single api call for service notification stats and template
usage stats.
2019-01-16 10:35:59 +00:00
Pea Tyczynska
e5647703b3 Remove support for old template statistics api response 2019-01-15 16:44:37 +00:00
Pea Tyczynska
4fe239abb2 Add support for new template statistics API response
The new API response for template statistics returns separate
count for each status. We get rid of template stats for cancelled
notifications and group the rest of the statuses together.
2019-01-15 16:22:27 +00:00
Alexey Bezhan
46bfb541c8 Group new template-statistics response by template
New API template-statistics response returns notification counts for
each template and status combination. This can be used for both
service statistics counts and template statistics by grouping the
counts either by status or by template.
2019-01-15 15:55:04 +00:00
Chris Hill-Scott
309de074c3 Don’t give postage choice on service and template
We are moving from the postage being set on the service to being set on
the template. Once a service has been migrated to have the new
permission they should no longer be able to set the postage at a service
level, only at the template level.
2019-01-15 12:06:56 +00:00