Commit Graph

9857 Commits

Author SHA1 Message Date
Leo Hemsted
026d4af2ec Merge pull request #3457 from alphagov/redirect-preview-to-notifications
Redirect preview to notifications if the notification already exists in the db
2020-05-27 15:00:33 +01:00
Pea M. Tyczynska
33d749ab4c Merge pull request #3460 from alphagov/handle-session-expiring-name-change
Handle session expiring during service name change
2020-05-27 12:27:36 +01:00
David McDonald
699df9716e Merge pull request #3463 from alphagov/delete-cache-object-fix
Use redis_client rather than wrapper method
2020-05-27 12:05:17 +01:00
David McDonald
ee14ae33dc Use redis_client rather than wrapper method
Fixes a bug where we were calling a wrapper method when instead we
should have been calling the redis_client. This had resulted in no
actual calls to redis happening.
2020-05-27 11:56:07 +01:00
Pea Tyczynska
f997cc2801 Improve the error message following content review.
'Session expired' or similar makes it sound like a new error.
It could confuse the user and make them think the sign in didn't work
and that their session has expired again.

So we went with:
The change you made was not saved. Please try again.
2020-05-27 11:21:06 +01:00
Pea Tyczynska
8f8c250124 Handle session expiring during service name change 2020-05-27 11:21:06 +01:00
David McDonald
979eab92c7 Merge pull request #3459 from alphagov/delete-cache-on-archive
Delete cached users and templates when archiving a service
2020-05-27 10:19:48 +01:00
Leo Hemsted
d86070a7e8 redirect from upload preview to notifications if it already exists
the upload preview page has a file_id - this corresponds to the file in
the transient pdf uploads bucket. However, if the user already hit send
(and then navigated back) the file's no longer in that bcuket, it's been
moved to the regular letters-pdf bucket. So the s3 get request fails. To
avoid this, simply redirect to the notifications page if the file isn't
in the transient bucket. This is better for the user as it'll stop them
trying to submit it twice, and will provide more clarity on the status
of the notification too.
2020-05-26 14:07:47 +01:00
Leo Hemsted
90a6d6586e split test_uploads.py into three separate folders
one for the upload hub and list pages

one for contact list uploading/editing/viewing

one for sending a letter

no tests added/removed/changed
2020-05-26 14:07:46 +01:00
David McDonald
0fdda016e2 Refactor archive to do one sync delete of all keys rather than many
Otherwise we could be waiting on 50 sync calls to redis to happen. This
way we do it in one sync call and follow the pattern of
b98f4561fa/app/notify_client/organisations_api_client.py (L56)
2020-05-22 17:12:00 +01:00
David McDonald
a65ada0d7e Delete cached users and templates when archiving a service
When the admin app gets user objects from the API, these include a dict
of permissions by service for what the user can do to that services.
Permissions for inactive services are not included in the response as
per:
87cb6f2597/app/dao/permissions_dao.py (L66)

However, this causes a bug where a service is archived but cached user
data still tells us that the user has permissions to view the service.
This should not be the case and causes errors where users can still see
the archived service page, it's settings, and even request to go live
for it, because they are using old cached data for the user.

We solve this by deleting the users who are part of the service from the
cache.

We also delete the templates for this service from the cache as the
templates are also archived when we ask the API to archive the service
as per:
d95c0131e0/app/service/rest.py (L597)

Note, one decision I had to make was whether to delete the user cache
for just active team members or also invited users. Assuming an invited
user can't see the service until they've accepted their invite anyway, it
shouldn't make any difference whether we delete their cache or not.
2020-05-22 16:27:05 +01:00
Chris Hill-Scott
b98f4561fa Merge pull request #3455 from alphagov/remove-file_id-from-form
Don’t show postage choice for international letters
2020-05-22 15:01:32 +01:00
Chris Hill-Scott
04ce13ebfc Remove default argument for file_id
It’s always provided now.
2020-05-22 14:50:33 +01:00
David McDonald
fcc72925f5 Merge pull request #3456 from alphagov/admin-readme
Admin readme
2020-05-22 12:05:56 +01:00
David McDonald
c5d08c15fd Update README.md
Co-authored-by: Chris Hill-Scott <me@quis.cc>
2020-05-22 09:48:04 +01:00
Chris Hill-Scott
782f43059d Refactor to pass through whole postal address
It’s a bit cleaner to not be passing through multiple variables which
are properties of the same object.
2020-05-21 14:20:19 +01:00
Chris Hill-Scott
b2ad7ff3cb Replace format_recipient with PostalAddress.as_single_line
We’ve refactored the code to display an address on a single line with
commas into utils now.
2020-05-21 14:20:18 +01:00
Chris Hill-Scott
68191a93ef Don’t show postage choice for international letters
International letters don’t have a choice of postage. Under the hood
they are either `europe` or `rest-of-world`.

So, for letters that we detect are international, this commit:
- removes the radios buttons that give users the choice of postage
- passes through either `europe` or `rest-of-world` to the API,
  depending on what address we find in the letter

This will cause the API to 500 until it can accept `europe` or
`rest-of-world` as postage types, but this is probably OK because it’s
only our services that have international letters switched on at the
moment.
2020-05-21 14:20:18 +01:00
Chris Hill-Scott
08a701b70c Refactor to get metadata before validating form
Because we no longer need the form to get the `file_id`, we can get the
metadata before building the form.

This will, in subsequent commits, let us build the form differently
based on the recipient metadata.

Also removed some variables that were assigned to then only used once
and reformatted arguments for readability.
2020-05-21 14:20:18 +01:00
Chris Hill-Scott
3378dfe258 Remove letter sending route without file_id
All instances of the app will be posting to the URL with the `file_id`
parameter now, so we can remove the old route without the ID now.
2020-05-21 14:20:18 +01:00
Chris Hill-Scott
846510fa31 Merge pull request #3454 from alphagov/stop-posting-file-id
Stop posting file_id when sending an uploaded letter
2020-05-21 14:19:54 +01:00
Chris Hill-Scott
32f0c1127d Stop posting file_id when sending a letter
The endpoint works fine with it in the URL now instead, so we need stop
posting it. We can’t stop expecting it yet, because some old instances
will still be posting to the endpoint without the ID in the url.
2020-05-21 13:34:03 +01:00
Chris Hill-Scott
bead6a9ad6 Merge pull request #3453 from alphagov/accept-file-id-in-url
Accept file_id in URL instead of as form parameter when sending uploaded letter
2020-05-21 13:33:27 +01:00
karlchillmaid
d7739669a2 Merge pull request #3452 from alphagov/update-who-its-for-content
Update and move the 'who it's for' page
2020-05-21 12:22:07 +01:00
Chris Hill-Scott
4761b117b9 Use features nav on ‘Who can use Notify’ page
This page sits in the features section now, so it should have the same
navigation as the other pages in that section.
2020-05-21 12:05:03 +01:00
Chris Hill-Scott
de459e5709 Redirect old URL 2020-05-21 11:17:44 +01:00
karlchillmaid
1d9964ae0f Fix filename 2020-05-20 16:09:25 +01:00
karlchillmaid
08712bc7b9 Update file name 2020-05-20 16:07:35 +01:00
karlchillmaid
a171f964f9 Update who_can_use_notify 2020-05-20 16:06:57 +01:00
karlchillmaid
bae7adcae5 Update who_can_use_notify link 2020-05-20 16:04:45 +01:00
karlchillmaid
829e247f45 Update who_can_use_notify link 2020-05-20 16:03:58 +01:00
karlchillmaid
f06dfbafbc Update who_can_use_notify link 2020-05-20 15:59:30 +01:00
karlchillmaid
50ae629721 Update who_can_use_notify link 2020-05-20 15:58:36 +01:00
karlchillmaid
084992c66b Update who_can_use_notify link 2020-05-20 15:57:32 +01:00
karlchillmaid
67316679bb Update who_can_use_notify link 2020-05-20 15:56:09 +01:00
karlchillmaid
a823f3d77f Update who_its_for to who_can_use_notify 2020-05-20 15:54:15 +01:00
David McDonald
d14510c98c Further improvements to readme 2020-05-20 10:58:35 +01:00
Chris Hill-Scott
1c5e661264 Accept file id in URL, not as form parameter
In the future we need to get the metadata from the file in order to work
out what form validation rules should apply (postage is only required
for UK letters).

To start doing this we need all instances of the app accepting `post`
requests with the `file_id` in the URL, as well as in the form data (for
backwards compatibility).
2020-05-19 17:44:39 +01:00
karlchillmaid
2e48535fd0 Update page title and header 2020-05-19 16:25:01 +01:00
karlchillmaid
ca2d13023f Move 'who it's for' to the About subnav menu 2020-05-19 16:24:06 +01:00
karlchillmaid
a7b28161fb Move 'who it's for' to About menu 2020-05-19 15:39:46 +01:00
Katie Smith
930b565510 Merge pull request #3451 from alphagov/dont-deep-link-support
Don’t deep link to our support form
2020-05-19 14:16:31 +01:00
Katie Smith
03cc9f9c74 Merge pull request #3446 from alphagov/fix-invite-errors
Catch errors when user register from invite
2020-05-19 14:09:08 +01:00
karlchillmaid
b169d098a9 Move 'charities' section above 'public' section 2020-05-19 14:08:04 +01:00
Katie Smith
313d39415d Catch errors when user register from invite
API gives an error if it tries to add a user to a service and that user is
already a member of the service. This situation shouldn't occur - admin checks
if an invited user is a member of a service before calling API, but we
have seen this error occurring when there are two requests processing at
the same time.

This change catches the errors from API if a user is already a member of
a service and redirects the user to the service dashboard so that they
don't see an error page.
2020-05-19 13:49:17 +01:00
Chris Hill-Scott
ba41057679 Don’t deep link to our support form
By deep linking to the support form we skip the question that asks if
someone is a member of the public.

This seems like a helpful thing when we’re directing people to where
they can ask for document download to be switched on. But what I think
is happening (backed up from one example I can see in Kibana):

1. Someone searches for something like ‘email GOV.UK’
2. They land on https://www.notifications.service.gov.uk/features/email
3. They scan the page and think, hmm not sure what this is, I’m not
   seeing what I’m looking for here…
4. …but aha, there’s a link that says ‘contact us’
5. They click it and land on
   https://www.notifications.service.gov.uk/support/ask-question-give-feedback
   which has a nice big box to type in

This commit removes these deep links from non-logged-in pages, so that
everyone has to go through the ‘are you a member of the public’ question
before they get to the big typey box.
2020-05-19 12:03:11 +01:00
karlchillmaid
acb3ee08b5 Move charities to its own section 2020-05-19 12:00:02 +01:00
Katie Smith
dede87c95e Always add user to service using User.add_to_service
The `_add_invited_user_to_service` function was calling the
`user_api_client` directly to add a user to a service. It now calls the
`add_to_service` method on the User model instead so that there is only
one place in the code that calls the `user_api_client`.
2020-05-19 11:36:59 +01:00
David McDonald
84dedb9cae Merge pull request #3450 from alphagov/non-ascii-metadata
Non ascii metadata
2020-05-19 11:31:26 +01:00
David McDonald
3185505612 Add unit test for LetterMetadata class 2020-05-19 11:20:03 +01:00