Commit Graph

763 Commits

Author SHA1 Message Date
Chris Hill-Scott
c96c1799f9 Process CSV files with column headers of any case
Implements and depends on:
https://github.com/alphagov/notifications-utils/pull/27

Should be merged and deployed before the same change in the admin app.
2016-04-29 17:24:00 +01:00
Adam Shimali
553ef6bfc8 Merge pull request #279 from alphagov/status-page-error
Add delivery status endpoint
2016-04-29 15:08:35 +01:00
Rebecca Law
559496a518 Merge pull request #275 from alphagov/fix-auth-bug
This pull request fixes a bug in authentication.
2016-04-29 14:52:20 +01:00
Rebecca Law
11c4696775 Update to test as per review comments.
However, I am curious if there is evidence that using fake_uuid over creating one in the test is actually faster.
2016-04-29 14:36:10 +01:00
Adam Shimali
b51ee0b4d0 Add delivery status endpoint 2016-04-29 13:00:21 +01:00
NIcholas Staples
519b912edc Merge pull request #271 from alphagov/limit_msg_size
Hard sms limits added to the api for send_notification and create_tem…
2016-04-29 12:29:05 +01:00
NIcholas Staples
7121a50cd1 Merge pull request #273 from alphagov/provider_statistics
Fragment count endpoint added and all tests working.
2016-04-29 12:28:54 +01:00
Nicholas Staples
f71dbe9c0f Message limit added and all tests passing. 2016-04-29 10:36:59 +01:00
Rebecca Law
8c14b5a8ab This pull request fixes a bug in authentication.
If the service does not have any api keys, there would be an error but it was not formed well.
2016-04-29 10:24:02 +01:00
Adam Shimali
87a02cba14 Merge pull request #274 from alphagov/one-week-activity
Added limit_days filter to get notifications dao.
2016-04-28 16:56:39 +01:00
Adam Shimali
4e81695c84 Added limit_days filter to get notifications dao. 2016-04-28 16:51:19 +01:00
Nicholas Staples
bedc20d0ff Fragment count endpoint added and all tests working. 2016-04-28 12:01:57 +01:00
Adam Shimali
23bcb08fb2 Merge pull request #272 from alphagov/temp-api-event-view
Add events to temporary history view for story sign off.
2016-04-28 10:48:37 +01:00
Adam Shimali
078756919d Add events to temporary history view for story sign off. 2016-04-27 17:30:15 +01:00
Chris Hill-Scott
deb8889e8e Merge pull request #268 from alphagov/align-statistics
Align date range for template + notification stats
2016-04-27 11:54:51 +01:00
Adam Shimali
c2d3e021cc Fix migration name clash 2016-04-27 11:48:46 +01:00
Adam Shimali
f71b626089 Merge pull request #267 from alphagov/events
Endpoint for recording events in api.
2016-04-27 11:37:33 +01:00
Rebecca Law
d936a09870 Merge pull request #266 from alphagov/add-created-by-for-jobs
Add created by for jobs
2016-04-27 11:26:57 +01:00
Chris Hill-Scott
d7f6bb9976 Align date range for template + notification stats
We were using two different queries to filter template stats to the past
7 days, plus today.

Since we’re storing both as short dates, we can now use the same query
for both.

0      | 1       | 2         | 3        | 4      | 5        | 6      | 7
-------|---------|-----------|----------|--------|----------|--------|-------
Monday | Tuesday | Wednesday | Thursday | Friday | Saturday | Sunday | Monday

So if we are on Monday, the stats should include today, plus everything
back to last Monday.

Previously the template stats query was only going back to the Tuesday.

This should mean the numbers on the dashboard always line up.
2016-04-27 11:11:09 +01:00
Adam Shimali
dacbbfbf2f Endpoint for recording events in api.
An event has an id, a type and a blob of json attached.
2016-04-27 10:36:59 +01:00
Rebecca Law
3f7bae3428 Removed update_job endpoint because it is not being used 2016-04-27 09:46:45 +01:00
Rebecca Law
18a2408faa Merge branch 'master' into add-created-by-for-jobs 2016-04-26 16:16:51 +01:00
Rebecca Law
94aab20317 Add created_by_id to jobs table.
The user logged in will be the user marked as creating the job.
The admin code already sends the created_by user when creating a job.
2016-04-26 16:15:34 +01:00
Chris Hill-Scott
bca61454f3 Merge pull request #264 from alphagov/quis-patch-1
Fix syntax error in README
2016-04-26 15:53:34 +01:00
Chris Hill-Scott
071ce4cac4 Merge pull request #265 from alphagov/fix-duplicate-service-name-test
Fix test for duplicate service name
2016-04-26 15:53:16 +01:00
Chris Hill-Scott
f6d3ce0b6a Fix test for duplicate service name
There is a uniqueness constraint on service `name` and `email_from`.

When you try to insert a row which has _both_ constraints, there is no
guarantee which one the operation will fail on.

This means that, when handling the exception, service `name` is not
reliably available, because sometimes the operation fails on the
`email_from` constraint instead.

This caused the tests to fail non-deterministically because they were
looking for the service `name` in the error message. As a fix, this
commit does two things:

1. Return either the service `name` or `email_from` in the error
   message, depending which is available.

2. Modify the test to pass on _either_ of the two possible error
   messages.

This is not ideal, but I can’t think of a way to maintain the original
behaviour, and have reliably passing tests.
2016-04-26 15:38:20 +01:00
Chris Hill-Scott
2e5df51b65 Fix syntax error in README 2016-04-26 14:16:01 +01:00
Chris Hill-Scott
b282f5015b Merge pull request #262 from alphagov/email-from-name
Send emails with a friendly from name
2016-04-26 11:24:49 +01:00
NIcholas Staples
fc0e70526b Merge pull request #261 from alphagov/template_archive
Added functionality to archive a template.
2016-04-26 11:23:02 +01:00
Nicholas Staples
e6cc3b1724 Added functionality to archive a template.
Renamed migration file.
2016-04-26 10:11:18 +01:00
Chris Hill-Scott
74c3746d23 Merge pull request #263 from alphagov/remove-send-email-code-task
Remove send email code task
2016-04-26 09:00:10 +01:00
Chris Hill-Scott
eeaeacbf0b Remove send email code task
We don’t send email codes any more
2016-04-26 08:55:09 +01:00
Adam Shimali
f82ed164e6 Merge pull request #260 from alphagov/notification-delete-schedule
Use short dates when selection notifications for deletion.
2016-04-25 17:28:19 +01:00
Adam Shimali
886f302993 Removed unused code 2016-04-25 17:21:55 +01:00
Adam Shimali
9bb3214b1c Removed wandering code 2016-04-25 17:13:12 +01:00
Chris Hill-Scott
ac0fa5b211 Send emails with a friendly from name
It’s nicer to have emails with a sender name, as well as the raw email
address.

Amazon SES can acheive this by using the format
```
"Sender name" <sender.name@domain.com>
```
— http://docs.aws.amazon.com/ses/latest/DeveloperGuide/email-format.html
We also have to remove all non-ASCII characters from the sender name,
because SMTP only supports 7-bit ASCII:

> A field name MUST be composed of printable US-ASCII characters (i.e.,
> characters that have values between 33 and 126, inclusive), except
> colon.

— http://www.ietf.org/rfc/rfc5322.txt

We use the service name as the sender name when:
- sending emails from the API
- sending emails from a CSV file

We use GOV.UK Notify as the sender name when:
- sending invitation emails
- sending password reset emails
2016-04-25 16:57:17 +01:00
Adam Shimali
24ea6f1637 Use short dates when selection notifications for deletion.
This means we will retain notifications for a full week and not
delete records that are 7 x 24 hours older than the time of the run of
the deletion task.

Also the task only needs to run once a day now, so I have changed
the celery config for the deletion tasks.
2016-04-25 16:12:46 +01:00
NIcholas Staples
4e4a5abbad Merge pull request #259 from alphagov/migration_fix
Fix migration.
2016-04-25 14:03:08 +01:00
Nicholas Staples
cec582e73d Fix migration. 2016-04-25 13:57:55 +01:00
NIcholas Staples
551f20e839 Merge pull request #258 from alphagov/template_history
Working tests and provider stats table.
2016-04-25 13:38:39 +01:00
Nicholas Staples
b56e324a4c Working tests and provider stats table.
Fix for tests and import error.

Added tests and updated for code review comments.
2016-04-25 12:20:06 +01:00
Rebecca Law
ff61223d97 Merge pull request #257 from alphagov/version-history-tweak
Only record history for specified class
2016-04-22 10:08:21 +01:00
Adam Shimali
d14be2067c When using the versioned decorator I noticed that when adding or
revoking an api key the service it associated with was of course added
to db.session.dirty.

That resulted in an updated version of service being added to the
service history table that showed no visible difference from that
record immediately precending it as the change was to another table,
namely the api_key table. A new api key or revoked api key was correctly
added to api_key and api_key_history tables. However I think an
'unchanged' service history record may be a bit confusing as you'd need
to correlate with api_keys to work out what the change was.

I think it's best to just record the new/revoked api_key and not create
another version of the service.

This pr wraps the exisiting versioned decorator with one that take a
class which you are interested in versioning.

Using the new decorator you only get a new version and history record
for the class you pass to outer decorator.

If the exising behaviour is acceptable to the powers that be then by all
means ignore/close this pr.
2016-04-21 18:10:57 +01:00
Adam Shimali
783271f306 Merge pull request #256 from alphagov/temp-endpoint-for-history
Temp history of endpoint
2016-04-21 17:05:01 +01:00
Adam Shimali
7378352c26 This is a temporary endpoint to get history of service and api key
updates. This will be surfaced on a simple log page on admin app
until product team work out who/how/when etc. of viewing history
data.
2016-04-21 16:32:20 +01:00
Adam Shimali
68eabd0676 Merge pull request #255 from alphagov/api-keys-history
Added version history to api keys.
2016-04-21 15:43:27 +01:00
Adam Shimali
252386c3c9 Changes for pr comments 2016-04-21 15:22:26 +01:00
Adam Shimali
873b8d1312 Reverted commented out tests 2016-04-21 15:15:32 +01:00
Adam Shimali
74ac5b5f30 Added version history to api keys. This needed a bit of change
to create history to handle foreign keys better. There may yet
be a better way of doing this that I have not found yet in sqlalchemy
docs.
2016-04-21 14:47:58 +01:00
NIcholas Staples
a3651c8398 Merge pull request #252 from alphagov/notification_billings_stats
Provider Statistics added.
2016-04-21 14:02:21 +01:00