Commit Graph

736 Commits

Author SHA1 Message Date
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
Nicholas Staples
3b1423a2ea Provider Statistics added.
Rates command added with a test.

Updated to include added migration.
2016-04-21 13:47:04 +01:00
Adam Shimali
a38e4f4965 Merge pull request #249 from alphagov/notification-stats-date
Changed notifications stats day column to date type from string.
2016-04-20 15:54:33 +01:00
Adam Shimali
054d8baa0a Changed notifications stats day column to date type from string. 2016-04-20 15:38:06 +01:00
Rebecca Law
794e922d94 Merge pull request #248 from alphagov/mmg-client-fix
Update MMG responses so that 3 is success.
2016-04-20 14:45:08 +01:00
Rebecca Law
9a25062943 Update mmg responses so that 3 is success.
Status codes from mmg are:
2: UNDELIVERABLE Message is undeliverable.
3: DELIVERED Message is delivered.
4: EXPIRED Message is expired.
5: REJECTED Message is rejected.
2016-04-20 14:29:31 +01:00
NIcholas Staples
abdbdc7335 Merge pull request #247 from alphagov/add_context_to_auth_code
Updated text send to user for the authorization code.
2016-04-20 12:08:11 +01:00
Nicholas Staples
bee23281fc Updated text send to user for the authorization code. 2016-04-20 12:02:17 +01:00
Rebecca Law
7187ba6dc7 Merge pull request #242 from alphagov/mmg-client-fix
Update to processing the the response from MMG
2016-04-20 11:27:37 +01:00
Rebecca Law
f283379646 Defend against status code 00 or 0 from mmg 2016-04-20 11:07:21 +01:00
Chris Hill-Scott
2883b220b7 Merge pull request #244 from alphagov/fix-missing-import
Fix missing import on notification stats endpoint
2016-04-20 10:35:23 +01:00
Chris Hill-Scott
425cc8340e Fix missing import on notification stats endpoint
The response import was missing, which broke things.

There was no test to catch this.

This commit adds a rudimentary test to make sure that the endpoint
doesn’t 500, at the very least.
2016-04-20 10:33:41 +01:00
Chris Hill-Scott
85d5c656f8 Merge pull request #241 from alphagov/get-notification-stats-last-7-days
Allow filtering of notification stats by days
2016-04-20 10:07:17 +01:00
Rebecca Law
41ce691704 Update to processing the the response from MMG
MMG changed the datatype and the status codes they send us for the delivery receipts.
This PR accounts for that change.
2016-04-20 09:45:13 +01:00
Adam Shimali
6ef8bb5ada Merge pull request #236 from alphagov/record-service-history
A slightly manual way of recording history.
2016-04-19 17:18:19 +01:00
Adam Shimali
8ea8bba612 Fix migration downgrade 2016-04-19 17:13:26 +01:00
Adam Shimali
a6a18c1a6f This approach uses part of sqlalchemy example history_meta code
adapted to recording inserts and updates.

This removes need to manually create history tables.

Our code still remains in control of when history records are
created.
2016-04-19 17:13:26 +01:00
Chris Hill-Scott
9c2c9435e3 Allow filtering of notification stats by days
https://www.pivotaltracker.com/story/show/117920839

On the dashboard we want to show counts of notifications sent in the
last 7 days, plus today. So the API enpoint needs to accept an argument
to limit how many days worth of statistics it will return.

This is a bit fiddly at the DAO level because the date is just stored as
a string.
2016-04-19 16:44:19 +01:00
NIcholas Staples
16553af133 Merge pull request #238 from alphagov/add_page_size_parameter
Added page_size parameter for notifications api. All tests passing.
2016-04-19 14:46:54 +01:00
Nicholas Staples
31978bd987 Added page_size parameter for notifications api. All tests passing.
Add page_size and total parameters to all calls for notifications.
2016-04-19 11:26:21 +01:00
NIcholas Staples
58ab831df9 Merge pull request #229 from alphagov/process_email_subject_placeholders
Character count added and tests passing.
2016-04-18 16:16:10 +01:00
NIcholas Staples
d59cf0133c Merge pull request #235 from alphagov/mmg_bug_fix
Added multi parameter for sending messages.
2016-04-18 16:16:00 +01:00
Rebecca Law
bcb031259c Revert "Update master with all the staging changes for aws deployments."
This reverts commit bfb59811f4.
2016-04-18 14:07:54 +01:00
Nicholas Staples
15c4fb47f7 Added multi parameter for sending messages. 2016-04-18 09:55:56 +01:00
Rebecca Law
a96d2b5e4a Merge pull request #232 from alphagov/aws-fixup
Update master with all the staging changes for aws deployments.
2016-04-15 16:42:42 +01:00
Nicholas Staples
f681d40366 Character count added and tests passing.
Remove sql restriction for count to not be null.
2016-04-15 16:31:13 +01:00
Rebecca Law
bfb59811f4 Update master with all the staging changes for aws deployments. 2016-04-15 16:10:11 +01:00
Rebecca Law
966a662513 Merge branch 'master' of github.com:alphagov/notifications-api 2016-04-15 14:51:35 +01:00