Commit Graph

6460 Commits

Author SHA1 Message Date
Leo Hemsted
a61a28a8c8 add emails to send when an MOU is signed
* tell the user that clicks the button
* tell the notify team
* tell the person that the button was clicked on behalf of

there are two templates for the first case
2019-07-09 11:57:13 +01:00
Pea (Malgorzata Tyczynska)
e3fdfff29b Merge pull request #2543 from alphagov/cancel-letter-job
Cancel letter job
2019-07-04 14:25:17 +01:00
Pea Tyczynska
8588d00657 Move tests closer to the code:
test can_letter_job_be_cancelled closer to the code
test dao_cancel_letter_job closer to the code
Mock out calls in cancel_letter_job to test just that method
2019-07-04 14:12:11 +01:00
Pea Tyczynska
2c79801c96 Return tuple from can_cancel_letter_job for clarity 2019-07-02 18:12:48 +01:00
Katie Smith
1ebd147ad0 Merge pull request #2551 from alphagov/fix-0-billable-units
Fix 0 billable units on provider callback
2019-07-02 09:12:55 +01:00
Pea Tyczynska
090769a069 Pull cancellable job statuses from utils and fix tests 2019-07-01 15:45:03 +01:00
Pea Tyczynska
da65ba0c91 Return specific error messages if job cannot be cancelled
Also move checking if job can be cancelled to the endpoint
2019-07-01 15:44:39 +01:00
Pea Tyczynska
cc966b1cf0 More checks and tests for cancelling a letter job 2019-06-28 15:57:39 +01:00
Rebecca Law
663b260777 Adding a cancel-letter-job endpoint to cancel a letter job. 2019-06-28 15:57:39 +01:00
Rebecca Law
6565c19a9b Adding new method to cancel a letter job. 2019-06-28 15:57:39 +01:00
Pea (Malgorzata Tyczynska)
5093b68f94 Merge pull request #2537 from alphagov/template_redacted_add_rows
Add rows in template_redacted where they are missing and help remember to insert them in the future
2019-06-28 14:41:51 +01:00
Rebecca Law
b45db5cab3 Merge pull request #2538 from alphagov/fix-team-recipient-check
Update to unit tests
2019-06-28 14:40:16 +01:00
Katie Smith
4f7cde3452 Fix 0 billable units on provider callback
We occasionally get an SMS with 0 `billable_units` if the `delivery-sender-worker`
is stopped in the middle of processing a notification - we have to fix
these manually. This change checks the billable units when we get the response from
our SMS provider and sets the correct billable units if it's 0.
2019-06-28 12:19:21 +01:00
Pea Tyczynska
2a5b0f8f17 Change the order of delete statements to respect foreign key constraint 2019-06-28 11:22:12 +01:00
Pea (Malgorzata Tyczynska)
d2b3b9940f Merge pull request #2550 from alphagov/degrade_alert_to_warning
Degrade MaxRetriesExceededError to warning status in logger
2019-06-27 15:46:51 +01:00
Pea Tyczynska
e033f3300b Degrade MaxRetriesExceededError to warning status in logger
This is because that error is caused by our providers and we
cannot do anything about it but it can make our logs hard to read
and actionable errors harder to spot
2019-06-27 14:55:10 +01:00
Pea Tyczynska
9782b08982 Add comment reminder to add template redacted when creating a template
through a migration.
Also fix the downgrades so they delete everything that needs deleting.
2019-06-26 19:03:15 +01:00
Pea Tyczynska
bd3594b2a9 Resign from trigger solution as we couldn't make it work 2019-06-26 18:36:03 +01:00
Pea Tyczynska
32e45828f8 Rename migration file 2019-06-26 18:36:03 +01:00
Pea Tyczynska
ce6f1a5572 Add trigger that ensures row in template_redacted is created
when adding new template through a migration
2019-06-26 18:36:03 +01:00
Pea Tyczynska
0ca7d4a20c Create template_redacted entry for templates created by migration
So that we can edit those templates
2019-06-26 18:36:03 +01:00
Pea (Malgorzata Tyczynska)
b5abe788e4 Merge pull request #2549 from alphagov/revert-2536-ensure_no_errors_when_creating_template
Revert "Ensure dao_create_template doesn't clash with new trigger"
2019-06-26 18:34:48 +01:00
Pea (Malgorzata Tyczynska)
ccfa1c8228 Revert "Ensure dao_create_template doesn't clash with new trigger" 2019-06-26 18:01:20 +01:00
Katie Smith
38fb7af2be Merge pull request #2546 from alphagov/bump-utils
Bump utils to add alt text to email branding
2019-06-26 09:35:44 +01:00
Katie Smith
284785a7d7 Bump utils to add alt text to email branding
Utils 33.0.0 adds alt text to email branding - the HTMLEmailTemplate now
initializes slightly differently as a result (with both `branding_name`
and `branding_text`).
2019-06-25 16:53:07 +01:00
Pea (Malgorzata Tyczynska)
e4c90c4bb9 Merge pull request #2536 from alphagov/ensure_no_errors_when_creating_template
Ensure dao_create_template doesn't clash with new trigger
2019-06-25 16:19:48 +01:00
Rebecca Law
2cd657cec6 Raise given exception 2019-06-25 16:18:48 +01:00
Rebecca Law
35d2e099f7 - Removed unused method parameters.
- Use parametrize for test.
2019-06-25 16:16:50 +01:00
Rebecca Law
b24acfea8f Merge branch 'master' into fix-team-recipient-check 2019-06-25 15:58:40 +01:00
Pea Tyczynska
673cabe6b8 Ensure dao_create_template doesn't clash with new trigger
New trigger creates template_redacted row after insert to template
table

And update tests
2019-06-25 15:40:10 +01:00
Katie Smith
08e9f1caa2 Merge pull request #2535 from alphagov/more-letter-logging
More logging and retrying for letters
2019-06-20 09:48:55 +01:00
Katie Smith
a790acc091 Create a Zendesk ticket for letters in the wrong state
This creates a Zendesk ticket if either the
`check_precompiled_letter_state` or `check_templated_letter_state` tasks
fail.
2019-06-18 10:58:58 +01:00
Katie Smith
c518f6ca76 Add scheduled task to find old letters which still have 'created' status
Added a scheduled task to run once a day and check if there were any
letters from before 17.30 that still have a status of 'created'. This
logs an exception instead of trying to fix the error because the fix
will be different depending on which bucket the letter is in.
2019-06-18 10:58:58 +01:00
Katie Smith
a2f324ad7e Add scheduled task to find precompiled letters in wrong state
Added a task which runs twice a day on weekdays and checks for letters that have
been in the state of `pending-virus-check` for over 90 minutes. This is
just logging an exception for now, not trying to fix things, since we
will need to manually check where the issue was.
2019-06-18 10:58:58 +01:00
Katie Smith
3d01276ce2 Log exception and set precompiled letter to tech-failure if S3 errors
The `process_virus_scan_passed` task now catches S3 errors - if these
occur, it logs an exception and puts the letter in a `technical-failure`
state. We don't retry the task, because the most common reason for
failure would be the letter not being in the expected S3 bucket, in
which case retrying would make no difference.
2019-06-18 10:58:58 +01:00
Chris Hill-Scott
175f56da90 Merge pull request #2542 from alphagov/add-more-agreement-signed-fields
Add columns for on whose behalf agreement signed
2019-06-18 10:48:02 +01:00
Chris Hill-Scott
8977f5193e Add columns for on whose behalf agreement signed
This is changing because we’re going to introduce accepting contracts
and MoUs online.

Previously
---
We had one column for who signed the agreement, which is foreign keyed
to the user table. This is still relevant, because there will always be
a user who is clicking the button.

Now
---
We add two new fields for the name and email address of the person on
whose behalf the agreement is being accepted. This person:
- is different from the one signing the agreement
- won’t necessarily have a Notify account
2019-06-18 10:41:22 +01:00
Chris Hill-Scott
3cde623ce2 Merge pull request #2539 from alphagov/optimise-orgs-services-for-user
Return all required information about a user’s organisations and services
2019-06-18 10:28:20 +01:00
Chris Hill-Scott
a123b02081 Merge pull request #2533 from alphagov/perf-plat-manual-run
allow you to pass in date to send perf stats
2019-06-18 09:56:12 +01:00
Chris Hill-Scott
64242506f0 Merge pull request #2544 from alphagov/put-firetext-url-in-manifest
AUTO: Explicitly include FIRETEXT_URL in manifest
2019-06-18 09:56:03 +01:00
Andy Paine
57705fd6fe AUTO: Explicitly include FIRETEXT_URL in manifest
- We are explicit about MMG_URL but not FIRETEXT_URL
- credentials has already been updated (checked by doing make
  generate-manifest for all envs)
2019-06-14 15:22:18 +01:00
Chris Hill-Scott
d974ab3b86 Return count of live services on organisations too
This makes it consistent, so the admin app can always rely on that
property being available.
2019-06-12 15:24:11 +01:00
Chris Hill-Scott
b6fdb269e4 Return all required org and services info for user
The admin app now needs to know a few extra things about orgs and
services in order to list them. At the moment it does this by making
multiple API calls.

This commit adds extra fields to the existing response. Once the admin
app is using this fields we’ll be able to remove:
- `reponse['services_without_organisations']`
- `reponse['organisations']['services']`
2019-06-12 15:24:11 +01:00
Rebecca Law
1f9aade749 - Adding test where post_notification can't send to a member outside of the team or whitelist.
- Updating some tests to be pytest4 compliant.
2019-06-11 16:45:35 +01:00
Leo Hemsted
5045590d75 allow you to pass in date to send perf stats
make it easier to replay sending data for a day if it failed the first
time round
2019-06-11 13:57:17 +01:00
Andy Paine
d19dbe5b61 Merge pull request #2532 from alphagov/enable-statsd-on-staging
AUTO: Enable statsd exporter on staging
2019-06-10 11:40:26 +01:00
Andy Paine
1010b511ee Merge pull request #2531 from alphagov/get-gunicorn-stats
AUTO: Get gunicorn stats
2019-06-10 11:40:11 +01:00
Andy Paine
2d17827780 AUTO: Enable statsd exporter on staging
- We want to do some load testing so we want to use the Prometheus
  metrics for observing the system
- Roll out the statsd exporter work to staging too
2019-06-10 11:12:44 +01:00
Andy Paine
ed9839a8ad AUTO: Get gunicorn stats
- Gunicorn can give us some interestings stats about what it is doing
  that might prove useful when trying to work out the
gunicorn/eventlet/sqlalchemy kind of bottlenecking issues
- We already ship these env vars to the app so this is a pretty easy
  change to make
- Uses statsd which is UDP so it shouldn't have any performance impact
  on gunicorn
2019-06-07 15:33:26 +01:00
Rebecca Law
c8196b0631 Merge pull request #2529 from alphagov/add-expiry-date-to-constraint
Allow api_keys names to be reused
2019-06-07 13:19:28 +01:00