Commit Graph

2259 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
Pea (Malgorzata Tyczynska)
cdbbdda730 Merge pull request #2771 from alphagov/update_passowrds_blacklist
Update common passwords blacklist
2019-02-18 11:02:40 +00:00
Pea Tyczynska
3f6e0b6631 Update common passwords blacklist
I did the update following instructions from this commit:
https://github.com/alphagov/notifications-admin/
commit/136662bd309d986a9b7c3e0ee76588612c1ab761

Password repositiories I used were:
darkweb2017-top10000.txt
probable-v2-top12000.txt
twitter-banned.txt
2019-02-15 13:43:46 +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
6a66ee0a4f Merge pull request #2756 from alphagov/clean-up-domains
Clean up domains file
2019-02-14 11:27:34 +00:00
Pea (Malgorzata Tyczynska)
42990fe376 Merge pull request #2759 from alphagov/remove_all_service_postage_references
Remove all service postage references
2019-02-14 11:19:15 +00:00
Pea Tyczynska
f0b82e7d3b Remove all service postage references
Since service.postage field has been removed from our model
and database.
2019-02-14 11:05:39 +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
1ddf5b5176 Fix misaligned checkboxes
The template list wasn’t getting the right class applied because the
check was referring to an undefined variable (`can_manage_folders`) that
should have been removed when all other references to it were.
2019-02-13 17:25:06 +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
eae708a1bc Finesse wording on letter branding request page
Telling people to ask if they want a different logo doesn’t make sense
if they don’t have one at all.
2019-02-13 15:46:59 +00:00
Chris Hill-Scott
9bf92b2054 Only direct people to choosing a logo if they don’t have one
Once they have their logo set up people don’t typically need to change
it so we shouldn’t distract them with a button.
2019-02-13 15:12:36 +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
Leo Hemsted
0ca48cd1b3 Merge pull request #2753 from alphagov/template-preview-logo
use letter branding object instead of letter_logo_filename
2019-02-13 14:04:10 +00:00
Leo Hemsted
0e3d47bc08 use letter branding object instead of letter_logo_filename
This is part of migrating away from dvla organisations. This only
affects in-app previews and not actual letters printed by the api.
2019-02-13 13:52:06 +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
Katie Smith
53627fd1ba Add update letter branding method to letter branding client 2019-02-12 14:59:29 +00:00
Chris Hill-Scott
978719cd20 Ensure domains are canonicalised
So, each domain owner only has one entry in the file (but can still
have multiple domains).
2019-02-12 13:33:14 +00:00
Chris Hill-Scott
70ac96fed9 Make sure all domains are lowercased 2019-02-12 13:33:14 +00:00
Chris Hill-Scott
ba8d2ff1e3 Don’t let domains have none values 2019-02-12 13:33:13 +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
Tom Byers
d633bdbb6d Tidy up JS code for focusing & associated html
Makes sure the tabindex we add for focusing is
removed.

Also removes the outer fieldset from the radios
for new templates. We don't wrap form buttons in
fieldsets anywhere else and it doesn't add any
useful semantics to the form.
2019-02-11 15:24:09 +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
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