Commit Graph

5445 Commits

Author SHA1 Message Date
Katie Smith
0e370d511e Update service_api_client to use new endpoints
API now has separate endpoints to archive email reply-to addresses and
SMS senders, so we no longer need to use the endpoints for updating.
2018-05-01 08:38:54 +01:00
Chris Hill-Scott
965bc76c42 Allow delete email reply to address, SMS senders
For both SMS senders and email reply to addresses this commit adds:
- a delete link
- a confirmation loop

It doesn’t let users delete:
- default SMS senders or reply to addresses (they always have to have
  one)
- inbound numbers

It assumes that the API will allow updating of an attribute named
`active` on the respective database rows. It could work in a different
way. We can’t do complete deletion though because these will still be
keyed to notifications.
2018-05-01 08:38:54 +01:00
Chris Hill-Scott
63b17001e1 Merge pull request #2041 from alphagov/👑
Add some crown bodies who haven’t signed the MOU
2018-04-30 17:09:04 +01:00
Leo Hemsted
b3101a08b0 Merge pull request #2037 from alphagov/strip-obscure-whitespace
Strip obscure whitespace from form submissions
2018-04-30 14:41:31 +01:00
Leo Hemsted
57bc9469e0 Merge pull request #2052 from alphagov/pyup-update-gunicorn-19.7.1-to-19.8.0
Update gunicorn to 19.8.0
2018-04-30 14:40:13 +01:00
Leo Hemsted
f51042f176 Merge pull request #2051 from alphagov/pyup-update-httpretty-0.8.14-to-0.9.4
Update httpretty to 0.9.4
2018-04-30 14:40:05 +01:00
Leo Hemsted
cae4cd69be Merge pull request #2055 from alphagov/reply-to-anyone
allow non-gov reply to email addresses
2018-04-30 14:39:48 +01:00
Leo Hemsted
60202cf5af allow non-gov reply to email addresses
we reckon users will like to see gov reply-to email addresses because
it will improve their confidence in the email.

however, some services, for a few complex reasons, don't want a gov
reply to address. rather than add their specific domains to the
whitelist for signups etc, just make reply tos allowed from any domain.

We vet reply-tos before services go live anyway.
2018-04-30 14:03:57 +01:00
Chris Hill-Scott
4cd6de15b4 Merge pull request #2038 from alphagov/wigan.gov.uk
Note agreement signed by Wigan Council
2018-04-30 11:56:41 +01:00
Chris Hill-Scott
869e4607f4 Merge pull request #2054 from alphagov/more-metadata
Store original filename as S3 metadata
2018-04-30 11:52:06 +01:00
Chris Hill-Scott
ef4dd9d126 Add some breathing room to file name length limit
Because Amazon stores metadata keys prefixed with `x-amz-` which might
get counted as part of the size.
2018-04-30 11:44:00 +01:00
Chris Hill-Scott
bc8bc727f3 Limit length of filename
S3 has a limit of 2kb for metadata:

> the user-defined metadata is limited to 2 KB in size. The size of
> user-defined metadata is measured by taking the sum of the number of
> bytes in the UTF-8 encoding of each key and value.

– https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html#object-metadata

This means we have a limit of 1870 bytes for the filename:
```python
encoded = 'notification_count50000template_id665d26e7-ceac-4cc5-82ed-63d773d21561validTrueoriginal_file_name'.encode('utf-8')
sys.getsizeof(b)
>>> 130
2000-130
>>> 1870
```

Or, in other words, ~918 characters:
```python
sys.getsizeof(('ü'*918).encode('utf-8'))
>>> 1869
```
2018-04-30 11:44:00 +01:00
Chris Hill-Scott
735d5f0a29 Remove redundant call to get_template
We’re getting the template just to get back its `id`, which is the one
thing we do know in order to get it.

The call to get template is still happening inside `_check_messages`, so
we’ll still catch someone trying to look at this page for a template
that doesn’t exist.
2018-04-30 10:06:51 +01:00
Chris Hill-Scott
66e6538d95 Store original filename as S3 metadata
By doing this we no longer have to store it in the session. This is the
last thing that’s currently in the session, so removing it means we can
drop session storage for file uploads entirely.
2018-04-30 10:06:33 +01:00
pyup-bot
fbbc2de13e Update gunicorn from 19.7.1 to 19.8.0 2018-04-28 20:34:52 +01:00
pyup-bot
20deb54d14 Update httpretty from 0.8.14 to 0.9.4 2018-04-28 07:25:52 +01:00
Chris Hill-Scott
2774cf45f2 Merge pull request #2049 from alphagov/removed-endpoint
Remove reference to removed endpoints
2018-04-27 16:54:36 +01:00
Chris Hill-Scott
4cc8f39231 Remove reference to removed endpoints 2018-04-27 16:50:09 +01:00
Chris Hill-Scott
48114f1836 Merge pull request #2047 from alphagov/store-s3-metadata
Store info about files as S3 metadata
2018-04-27 16:43:52 +01:00
Chris Hill-Scott
a42ddc8936 Merge pull request #2045 from alphagov/new-template
Upgrade GOV.UK template to newest version
2018-04-27 16:38:57 +01:00
Chris Hill-Scott
47e3f676a6 Merge pull request #2044 from alphagov/north-to-north-east
Fix which Lincolnshire council signed agreement
2018-04-27 16:38:37 +01:00
Chris Hill-Scott
872d9ea62b Merge pull request #2033 from alphagov/selected-nav
Highlight selected navigation item
2018-04-27 16:38:27 +01:00
Chris Hill-Scott
e7e3b95fee Store info about files as S3 metadata
Storing things in the session is proving buggy – we still have one user
(that we know about) where the session data isn’t getting written, so
they’re blocked from uploading a file.

Since all the info we’re storing in the session is about the file, it
makes sense to store it with the file.

This commit only does the writing of the metadata, once we’re sure this
is working we can do subsequent work to read it back, and remove
reliance on the session.
2018-04-27 16:37:05 +01:00
Leo Hemsted
6e522cb87f Merge pull request #2046 from alphagov/go-live
fix go live link
2018-04-27 16:02:25 +01:00
Leo Hemsted
e8b0e83100 fix go live link 2018-04-27 15:47:47 +01:00
Leo Hemsted
2ceea61bb1 Merge pull request #2034 from alphagov/zendesk
send zendesk rather than deskpro tickets
2018-04-27 14:33:31 +01:00
Leo Hemsted
023c4121b3 separate urgent and p1 concepts in feedback.
p1 == "should notify team be alerted of this (via pagerduty)"
urgent == "should the user be told we'll look at it"

* If it's in office hours, it's always urgent. It's never a P1 because
  we'll notice it anyway
* If it's outside of office hours, it's urgent and P1 if it's severe,
  otherwise it's neither
2018-04-27 14:20:15 +01:00
Chris Hill-Scott
0b331f3e23 Upgrade GOV.UK template to newest version
Changes: https://github.com/alphagov/govuk_template/compare/v0.23.0...v0.24.0

Includes a new way of serving the font files which will:
- save us ~300kb on non-cachd requests
- speed up the parsing of the CSS file
2018-04-27 14:12:02 +01:00
Chris Hill-Scott
0fd13058ba Fix which Lincolnshire council signed agreement
North East Lincolnshire Council have signed the agreement, but we had
it down as North Lincolnshire Council.
2018-04-27 10:16:23 +01:00
Chris Hill-Scott
4847ee81a4 Merge pull request #2039 from alphagov/highland
Updating Highland Council MOU status
2018-04-26 16:53:03 +01:00
Chris Hill-Scott
0eb3efb28c Add some crown bodies who haven’t signed the MOU
These organisations are, to the best of my knowledge:
- crown
- without an MOU in place

Scavenged from:
- http://www.nationalarchives.gov.uk/information-management/re-using-public-sector-information/uk-government-licensing-framework/crown-copyright/uk-crown-bodies/
- https://www.gov.uk/government/organisations

And cross referenced with the Google Drive folder.

This should give us a better chance of being able to give people the the MOU to download, once it’s available.
2018-04-26 16:24:37 +01:00
Pete Herlihy
d2bd878a9a Updating Highland Council MOU status 2018-04-26 15:08:33 +01:00
Chris Hill-Scott
09cf529222 Note agreement signed by Wigan Council 2018-04-26 14:49:42 +01:00
Chris Hill-Scott
310b4ec0e0 Merge pull request #2036 from alphagov/pyup-update-notifications-python-client-4.8.1-to-4.8.2
Update notifications-python-client to 4.8.2
2018-04-25 16:14:37 +01:00
Chris Hill-Scott
555820bb15 Merge pull request #2035 from alphagov/pyup-update-pytest-3.5.0-to-3.5.1
Update pytest to 3.5.1
2018-04-25 16:14:20 +01:00
Chris Hill-Scott
9e78c5f575 Strip obscure whitespace from form submissions
We strip most whitespace as of:
https://github.com/alphagov/notifications-admin/pull/1701

However we are still getting some bad email addresses through, for
example one that had a leading zero-width space character. This means
that the user sees a validation error; really we should just deal with
the mess for them.

So this commit also includes characters without Unicode character
property "WSpace=Y" (which includes zero-width space) to those which are
stripped from form submissions.

List taken from here: https://en.wikipedia.org/wiki/Whitespace_character

See issue and discussion here: https://bugs.python.org/issue13391
2018-04-25 16:12:24 +01:00
Leo Hemsted
be038e345d define isort first party (app and tests)
we were seeing isort produce different outputs locally and in docker -
this was due to it having different opinions about whether the tests
module (ie all our unit tests) is a first party (local) or third party
(pip installed) import. It's a first party import, so by defining this
in the setup.cfg isort settings, we can force it to be consistent
between environments.

Note: I don't know why it was different in the first place though
2018-04-25 14:12:58 +01:00
Leo Hemsted
198bc476bb remove old feedback urls
not been hit in the last couple of weeks
2018-04-25 13:43:15 +01:00
Chris Hill-Scott
9f5d42a788 Add selected navigation for organisations page
To match how the navigation works for a single service.
2018-04-25 13:17:47 +01:00
Chris Hill-Scott
511ca8f652 Merge pull request #2032 from alphagov/increase-redis-ttl
Make Redis hold onto cached API responses longer
2018-04-25 11:42:19 +01:00
Chris Hill-Scott
8a7525a809 Highlight selected item in proposition navigation
It is standard practice when using GOV.UK template to highlight the
selected navigation item in the propositional navigation (black bar) by
colouring it blue.

This commit adds a new subclass of `Navigation` with the mapping needed
to decide which pages belong to which item in the navigation (or none
at all).
2018-04-25 11:30:39 +01:00
Chris Hill-Scott
e1fd63e184 Rewrite navigation as a class
Because we have multiple navigations, which will share the same methods
(by subclassing) but different mappings of navigation items to endpoints
by overriding the `.mapping` and `.exclude` attributes.
2018-04-25 11:15:13 +01:00
pyup-bot
7cf8775435 Update notifications-python-client from 4.8.1 to 4.8.2 2018-04-25 10:40:45 +01:00
Chris Hill-Scott
1fba5d186d Highlight selected navigation item
In research I’ve sometimes seen people click the wrong nav item. I
reckon that people’s concept of which pages live behind which navigation
items isn’t very strong.

We can reinforce this relationship by showing, for every page, which is
the corresponding nav item. The conventional way of doing this is either
with some kind of emphasis, typically colour or bold. I’ve gone for bold
because colour would be weird.

---

The implementation of this is quite loosely coupled to our application
code because:
- our application code is not well structured (eg we don’t make any use
  of blueprints)
- spreading this change across lots of files in our application would
  make it harder to test without actually hitting each endpoints; such
  tests would be slow and verbose

So I’ve gone for more of a meta approach. Rather than testing that each
endpoint has a specific navigation item selected, I’ve gone for
validating that:
- all endpoints being mapped to are real
- all endpoints have _a_ selected navigation item (or are specifically
  excluded)

This means that it’s impossible to add, change or remove an endpoint
without also updating which navigation item should be selected. And the
actual mapping is so declarative that it testing it would be redundant.
2018-04-25 09:37:35 +01:00
pyup-bot
3952b62e2e Update pytest from 3.5.0 to 3.5.1 2018-04-25 00:01:47 +01:00
Leo Hemsted
d675ceb5c2 send zendesk rather than deskpro tickets 2018-04-24 17:37:15 +01:00
Chris Hill-Scott
589dbea971 Make Redis hold onto cached API responses longer
Redis is giving us a big performance boost (it’s roughly halved the
median request time on the admin app).

Once we’re confident that it’s working properly[1] we can eke out a bit
more performance from it by keeping the caches alive for longer. As
far as I can tell we’re still using Redis in a very low-volume way[2],
so increasing the number of things we’re storing shouldn’t start taxing
our Redis server at all. But reducing the number of times we have to
hit the API to refresh the cache _should_ result in some performance
increase.

---

1. ie we’re not seeing instances of stale caches not being invalidated

2. We have 2.5G of available space in Redis. Here is our current usage:
```
used_memory:7728960
used_memory_human:7.37M
used_memory_rss:7728960
used_memory_peak:16563776
used_memory_peak_human:15.79M
used_memory_lua:37888
```
2018-04-23 17:07:41 +01:00
Chris Hill-Scott
63061b1bab Merge pull request #2031 from alphagov/failure-anchor
Fix broken anchor links from message status fields
2018-04-23 16:05:46 +01:00
Chris Hill-Scott
c6b2c5285e Fix broken anchor links from message status fields
These IDs existed at some point but have been lost. They are needed because 
we link to them from a failed message to give a bit more explanation.

Need to match here: https://github.com/alphagov/notifications-admin/blob/master/app/__init__.py#L394-L396
2018-04-23 15:07:31 +01:00
Chris Hill-Scott
54e2c94d09 Merge pull request #2026 from alphagov/redis-cache-template
Cache `GET /template…` methods in Redis
2018-04-23 14:02:59 +01:00