Commit Graph

9849 Commits

Author SHA1 Message Date
Chris Hill-Scott
f12f0fae87 Remove robots.txt
Google’s documentation says:

> robots.txt is not a mechanism for keeping a web page out of Google. To
> keep a web page out of Google, you should use noindex directives

We’ve implemented a noindex directive now, so we don’t need to serve
robots.txt any more.
2020-05-27 10:20:07 +01:00
Chris Hill-Scott
f902205ef3 Remove email features page from search engines
Reimplements https://github.com/alphagov/notifications-aws/pull/796

Since deploying alphagov/notifications-utils#736 I’ve been looking at
how members of the public are ending up on our support page. The vast
majority are landing on https://www.notifications.service.gov.uk/features/email

Previously we thought that they were clicking the ‘contact us’ link in
the page, which deep linked into the support journey, so we removed
these deep links in alphagov/notifications-admin#3451

But the tickets are still coming in, so I think that people are still
landing on this page, then going directly to ‘support’ in the top
navigation. So the next measure we have available is to try to stop
people from landing on this page in the first place. All the examples
I’ve looked at show people coming from Google to this page. By putting
the page’s URL in our robots.txt it should stop Google (and other search
engines) listing it in search results.
2020-05-27 10:19:58 +01:00
Chris Hill-Scott
92ffe3a78c Use meta tag to tell search engines not to index
Google’s documentation says:

> robots.txt is not a mechanism for keeping a web page out of Google. To
> keep a web page out of Google, you should use noindex directives

A noindex directive means adding the following meta tag to pages that
shouldn’t be indexed:
```html
<meta name="robots" content="noindex" />
```

It’s also possible to set the directive as a HTTP header, but this seems
trickier to achieve on a per-view basis in Flask.

I’ve implemented this as a decorator so it can quickly be added to any
other pages that we decide shouldn’t appear in search results.
2020-05-27 10:19:48 +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
Chris Hill-Scott
9306bc3197 Merge pull request #3437 from alphagov/group-uploaded-letters
Group uploaded letters by printing date
2020-05-19 09:49:04 +01:00
David McDonald
387fcfda3f Move recipient decoding into LetterMetadata class
This is for consistency with how we do it for filenames in the previous
commit and moves the decoding into the `LetterMetadata` class for
abstracting this behaviour.

Small refactor of the LetterMetadata class needed to handle None case as
recipient can be None.
2020-05-18 16:13:31 +01:00
David McDonald
7923760345 Ensure pdf letter filename is ascii encoded and decoded
S3 can only handle ascii characters, therefore for filename which could
include non ascii characters, for example a filename with the character
'£' in it, we must encode these using urllib before saving it as s3
metadata. We then also make sure that it comes back decoded when
presenting it to the user.
2020-05-18 16:13:31 +01:00
David McDonald
1fb31a8861 Remove unused args in test
These args are not inputs to the function under test, neither as way of
named arguments or as GET query parameters. I assume this has been
leftover from a previous refactor of behaviour.
2020-05-18 16:13:31 +01:00
David McDonald
ba80d5b7cd Introduce abstraction for s3 metadata
S3 metadata only supports ascii characters. Whenever we save data to it
we need to make sure we encode it to save it and then decode it to
display it again to users. This abstraction will act as the place for
that decoding to happen so the rest of the code in our views doesn't
need to care about the encoding abstraction.
2020-05-18 16:13:31 +01:00
Chris Hill-Scott
6b93de1cb4 Merge pull request #3449 from alphagov/bump-utils-39.2.0
Bump utils to 39.2.0
2020-05-18 12:45:38 +01:00
Chris Hill-Scott
92f90d2ff4 Merge pull request #3445 from alphagov/handle-org-domain-exists-error
Catch error when organisation domain already in use
2020-05-18 12:45:23 +01:00
Chris Hill-Scott
064b1eb05a Bump utils to 39.2.0
This will start loggin Zendesk ticket IDs when people use the support
pages.
2020-05-18 11:08:54 +01:00