Commit Graph

6051 Commits

Author SHA1 Message Date
Pea (Malgorzata Tyczynska)
1dad075395 Merge pull request #2378 from alphagov/send_notification_wwhen_editing_attr
Send confirmation emails to users when colleague edits their email or mobile
2019-02-26 16:41:35 +00:00
Pea Tyczynska
211d3741ba Send confirmation emails to users when team manager edits their
email address  or mobile number.
2019-02-26 16:30:29 +00:00
Katie Smith
a6f5e644b6 Merge pull request #2370 from alphagov/change-permission-endpoint
Change permissions endpoint to accept data in new format
2019-02-25 16:11:38 +00:00
Katie Smith
bcb1c483ca Change permissions endpoint to accept data in new format
The data posted to the `set_permissions` endpoint is currently sent as a
list of permissions:
`[{'permission': MANAGE_SETTINGS}, {'permission': MANAGE_TEMPLATES}]`.

This endpoint is going to also be used for folder permissions, so the
data now needs to be nested:

`{'permissions': [{'permission': MANAGE_SETTINGS}, {'permission': MANAGE_TEMPLATES}]}`

This changes the set_permissions endpoint to accept data in either
format. Once admin is sending data in the new format, the code can be
simplified.
2019-02-25 16:01:24 +00:00
Leo Hemsted
26d42b5ea3 Merge pull request #2373 from alphagov/slow-provider-threshold
move slow sms provider threshold from 10% to 20%
2019-02-25 15:22:42 +00:00
Leo Hemsted
f00bfdfe85 move slow sms provider threshold from 10% to 20%
provider switching is a process that can happen as often as we like
without disrupting the flow of the system - however, there are some
reasons why we might not want to switch. One problem we've seen is
when a provider is having an issue, we might switch away from them
manually only for the app to automatically switch back to them again
and again.

Long term we'd like to have a system better suited for sharing the load
equally between our two sms providers, but short term, by increasing
the threshold for switching from 10% (of messages sent are slow) to
20%, we hope to make switching happen less often.

A notification is considered slow if it was sent in the last ten
minutes, on the current provider, and is either

* still in sending or pending after 4 minutes
* in delivered, but took at least 4 minutes to send
2019-02-25 14:29:39 +00:00
Alexey Bezhan
f42ab70a1f Merge pull request #2372 from alphagov/dont-log-ses-callback-retry
Allow retry exception to propagate from ses callback task
2019-02-25 14:00:29 +00:00
Alexey Bezhan
c2e15d4ee2 Allow retry exception to propagate from ses callback task
Celery `self.retry` raises an exception to communicate that the task
needs to be retried. Since our ses task is wrapped in a catch-all
except block it logs that exception as an error before retrying.

Handling Retry class separately allows us to raise it without logging
the traceback.
2019-02-25 13:25:50 +00:00
Alexey Bezhan
3271a567b8 Merge pull request #2353 from alphagov/retry-instant-ses-callback
Add retries for SES callbacks for recent notifications
2019-02-25 11:01:02 +00:00
Alexey Bezhan
2932b44eb8 Add retries for SES callbacks for recent notifications
We've seen errors caused by what we suspect is a race condition when
SES callback processing tries to look up the notification before the
sender worker has saved notification reference from the SES POST
response to the database.

This adds a retry for SES callback task if the notification was not
found and the message is less than 10 minutes old and removes the
error log message for notifications older than 3 days (since they
might no longer exist in the notifications table and would've been
marked as failure by then either way).

In order to be able to call retry and silence the error log based on
notification time this change inlines `process_ses_response` and
`update_notification_by_reference` functions into the celery task.
It also removes a lot of defensive error-handling that doesn't appear
to have been triggered in the last few months (for things like missing
keys in SES callback data).
2019-02-25 10:36:37 +00:00
Leo Hemsted
ae3505d692 Merge pull request #2369 from alphagov/provider-switch-fix
allow pending notifications to influence switchover.
2019-02-22 16:57:10 +00:00
Leo Hemsted
eeebdd3e0c Merge pull request #2367 from alphagov/reqs
bump requirements
2019-02-21 16:40:08 +00:00
Leo Hemsted
a617ccca9d allow pending notifications to influence switchover.
Currently we switch if:

* status = delivered and updated_at - sent_at > threshold
* status = sending and now - sent_at > threshold

firetext can leave notifications in the pending state, which is
equivalent to sending in terms of how we should handle it, so this
commit changes the second case to allow pending as well as sending.
2019-02-21 16:30:42 +00:00
Leo Hemsted
335eeea235 bump requirements
pyup ignore pytest until we sort all the fixtures as functions issues
2019-02-19 16:17:33 +00:00
Alexey Bezhan
19b285f5c7 Merge pull request #2356 from alphagov/folder-permissions-permission
Add folder permissions permission
2019-02-19 10:48:09 +00:00
Alexey Bezhan
1d77310fbd Add folder permissions permission
[#163755302](https://www.pivotaltracker.com/story/show/163755302)

Adds a new temporary service permission for enabling folder permission
editing.
2019-02-19 10:23:40 +00:00
Rebecca Law
ceaea6afbe Merge pull request #2359 from alphagov/remove-edit-folder-permission
Last commit to remove edit_folders.
2019-02-15 15:41:21 +00:00
Rebecca Law
34e5e9558d Last commit to remove edit_folders. 2019-02-15 14:44:33 +00:00
Rebecca Law
8c6cebca17 Merge pull request #2358 from alphagov/remove-edit-folder-permission
Remove edit folder permission
2019-02-15 14:44:00 +00:00
Rebecca Law
718626f639 Remove all edit_folder permissions from service_permissions 2019-02-15 14:35:34 +00:00
Rebecca Law
331414d379 Merge pull request #2357 from alphagov/remove-edit-folder-permission
Remove the need for the edit_folders service permission.
2019-02-15 13:19:48 +00:00
Chris Hill-Scott
26ea503fc8 Merge pull request #2355 from alphagov/service-volumes
Add fields to record a service’s estimated volumes
2019-02-15 10:18:37 +00:00
Chris Hill-Scott
7ca62ce4cf Bump migration version 2019-02-15 10:09:44 +00:00
Chris Hill-Scott
f679731af8 Also store consent to research against a service
It makes most sense to collect this at the same time as the estimated
volumes. Which means we need to store it somewhere; we can’t put it
straight into the ticket.
2019-02-15 10:08:22 +00:00
Chris Hill-Scott
ecdf076506 Store anticipated volumes as integers
This will make it easier to do analysis on the data. Almost all users
are submitting data in a numerical format now anyway, because we ask the
question in a sensible way.
2019-02-15 10:08:22 +00:00
Chris Hill-Scott
17e32fa5f6 Add fields to record a service’s estimated volumes
When a service go live we ask people for their estimated sending
volumes. At the moment we only put this in the ticket, and store it in
a spreadsheet.

This means that a service can
- say they want to go live
- say they are sending 100,000 emails per year
- not have created any email templates
- still see ‘create templates’ as ‘completed’ in the go live checklist

If we store this data against the service we can collect it earlier, and
then use it to determine automatically what kind of templates the user
needs to create before their go live checklist can be considered
complete.
2019-02-15 10:08:22 +00:00
Leo Hemsted
f8f7d245b3 Merge pull request #2352 from alphagov/remove-dvla-part-2
remove dvla_organisation from database
2019-02-15 09:15:23 +00:00
Leo Hemsted
06f9e445f7 remove dvla_organisation from database
downgrade re-populates all static data but leaves all services with 001
(HM Government) branding
2019-02-14 14:27:59 +00:00
Leo Hemsted
e890e5cf32 Merge pull request #2351 from alphagov/remove-dvla-part-1
remove dvla_organisation
2019-02-14 14:27:12 +00:00
Rebecca Law
38852c4440 Merge pull request #2346 from alphagov/remove_unused_postage_artifacts
Remove unused postage artefacts
2019-02-13 15:50:10 +00:00
Rebecca Law
63e831c70d Merge branch 'master' into remove_unused_postage_artifacts 2019-02-13 15:44:20 +00:00
Rebecca Law
4ce5724bc7 Fix the downgrade of the migration.
By the way I'm not concerned about fixing service.postage data if we have to rollback.
2019-02-13 15:40:08 +00:00
Leo Hemsted
53ecaa3230 remove dvla_organisation
it's been superceeded by letter branding
2019-02-13 15:02:18 +00:00
Leo Hemsted
5037293724 Merge pull request #2349 from alphagov/stop-using-dvla-organisation
Don't fallback to dvla_organisation if letter branding unset
2019-02-13 14:32:24 +00:00
Leo Hemsted
afc5c96927 Don't fallback to dvla_organisation if letter branding unset
The template preview app now accepts a null value for the `filename` 
parameter. If a service doesn't have a letter branding option set, 
previously we defaulted to their dvla_organisation (probably HM 
Government). Now, we pass through None, so that we generate letters 
without any logo or branding.
2019-02-13 11:58:54 +00:00
Pea Tyczynska
97b1e034b8 Remove service.postage and choose_postage permission from database
Also change constraint on template postage so it cannot be null for
letters

Also add postage to all letters in template_history to respect new constraint
2019-02-13 11:50:00 +00:00
Pea (Malgorzata Tyczynska)
a8ee92cf03 Merge pull request #2348 from alphagov/remove_service_postage_and_choose_postage_from_code
Remove service postage and choose postage from code
2019-02-13 11:09:35 +00:00
Leo Hemsted
b5b1056c02 Merge pull request #2343 from alphagov/reqs
reqs bump
2019-02-13 10:20:09 +00:00
Pea Tyczynska
08663b386c Don't test whether deleting service doesn't delete service permission
types. As we found it unncessarry.
2019-02-12 14:38:35 +00:00
Pea Tyczynska
6320882876 Make service postage nullable 2019-02-12 12:15:38 +00:00
Pea (Malgorzata Tyczynska)
d65315335b Merge pull request #2347 from alphagov/fix_templates_history_postage
dao_update_template_reply_to maintains postage in TemplateHistory
2019-02-12 11:05:41 +00:00
Pea Tyczynska
2b0668c7c8 Fix dao_update_template_reply_to so it maintains postage in TemplateHistory 2019-02-12 10:41:44 +00:00
Pea Tyczynska
8ea55c3f5c Remove service.postage and choose_postage permission from models
Also change constraint on templates postage so letter postage
cannot be null
2019-02-11 18:22:46 +00:00
Pea Tyczynska
8ef581de69 Remove service.postage and choose_postage permission from the code and tests 2019-02-11 18:20:34 +00:00
Rebecca Law
38a599c758 Remove the need for the edit_folders service permission.
We need another PR to remove it from ServicePermissionTypes and remove the data in service_permissions.
2019-02-11 17:26:17 +00:00
Leo Hemsted
a6660b7d91 Merge pull request #2345 from alphagov/wigan
fix new services being assigned to wrong letter branding
2019-02-11 13:44:14 +00:00
Leo Hemsted
478de8bb8e fix new services being assigned to wrong letter branding
when creating a service, the api accepts a `service_domain` field that
it uses to populate the letter branding - if the service domain is
known to match an existing letter branding option, use that
automatically. However, the admin currently doesn't know about this
field yet so doesn't pass anything through - the api erroneously
searches the DB for letter branding with a domain of None - which they
currently all have.

This meant that when services were created, their letter branding was
set to the most recent row in the DB (that matched None).
2019-02-11 11:46:33 +00:00
Chris Hill-Scott
e708c93b1c Merge pull request #2344 from alphagov/html-response
Return rendered HTML when previewing a template
2019-02-08 15:09:51 +00:00
Chris Hill-Scott
aab36157a5 Test for HTML response in the schema
Because we test for the other properties in the schema.

Also sets `additionalProperties` to `False` so we’re forced to update
the schemas if we make similar changes in the future. This means
removing `created_by` from the test data because it’s not returned by
the real response.
2019-02-08 13:10:42 +00:00
Chris Hill-Scott
f185dbecbe Return rendered HTML when previewing a template
If you’re trying to show what a Notify email will look like in your
caseworking system all the API gives you at the moment is raw markdown
(with the placeholders replaced).

This isn’t that useful if your caseworkers have no idea what markdown
is. If we also give teams the HTML then they can embed this in their
systems, and the people using those systems will be able to see how
headings, bulleted lists, etc. look.
2019-02-07 17:43:46 +00:00