{"action":"created","comment":{"url":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments/170283372","pull_request_review_id":98948971,"id":170283372,"diff_hunk":"@@ -222,3 +282,27 @@ def get_reply_to_text(notification_type, form, template):\n         reply_to = template.get_reply_to_text()\n \n     return reply_to\n+\n+\n+def get_precompiled_letter_template(service_id):\n+    template = Template.query.filter_by(\n+        service_id=service_id,\n+        template_type=LETTER_TYPE,\n+        hidden=True\n+    ).first()","path":"app/v2/notifications/post_notifications.py","position":132,"original_position":132,"commit_id":"0a45fc67f30a9606c439225cf438a340a28a2d5a","original_commit_id":"0a45fc67f30a9606c439225cf438a340a28a2d5a","user":{"login":"richardc0","id":31849076,"avatar_url":"https://avatars3.githubusercontent.com/u/31849076?v=4","gravatar_id":"","url":"https://api.github.com/users/richardc0","html_url":"https://github.com/richardc0","followers_url":"https://api.github.com/users/richardc0/followers","following_url":"https://api.github.com/users/richardc0/following{/other_user}","gists_url":"https://api.github.com/users/richardc0/gists{/gist_id}","starred_url":"https://api.github.com/users/richardc0/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/richardc0/subscriptions","organizations_url":"https://api.github.com/users/richardc0/orgs","repos_url":"https://api.github.com/users/richardc0/repos","events_url":"https://api.github.com/users/richardc0/events{/privacy}","received_events_url":"https://api.github.com/users/richardc0/received_events","type":"User","site_admin":false},"body":"One? We should only ever have one and if we don't something is wrong?\r\n\r\nBUT it shouldn't break the system","created_at":"2018-02-23T15:37:32Z","updated_at":"2018-02-23T15:42:11Z","html_url":"https://github.com/alphagov/notifications-api/pull/1703#discussion_r170283372","pull_request_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments/170283372"},"html":{"href":"https://github.com/alphagov/notifications-api/pull/1703#discussion_r170283372"},"pull_request":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703"}}},"pull_request":{"url":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703","id":171039018,"html_url":"https://github.com/alphagov/notifications-api/pull/1703","diff_url":"https://github.com/alphagov/notifications-api/pull/1703.diff","patch_url":"https://github.com/alphagov/notifications-api/pull/1703.patch","issue_url":"https://api.github.com/repos/alphagov/notifications-api/issues/1703","number":1703,"state":"open","locked":false,"title":"Post pre-compiled letter PDF notification endpoint","user":{"login":"allait","id":246664,"avatar_url":"https://avatars2.githubusercontent.com/u/246664?v=4","gravatar_id":"","url":"https://api.github.com/users/allait","html_url":"https://github.com/allait","followers_url":"https://api.github.com/users/allait/followers","following_url":"https://api.github.com/users/allait/following{/other_user}","gists_url":"https://api.github.com/users/allait/gists{/gist_id}","starred_url":"https://api.github.com/users/allait/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allait/subscriptions","organizations_url":"https://api.github.com/users/allait/orgs","repos_url":"https://api.github.com/users/allait/repos","events_url":"https://api.github.com/users/allait/events{/privacy}","received_events_url":"https://api.github.com/users/allait/received_events","type":"User","site_admin":false},"body":"### Add a hidden column to templates\r\n\r\nAllows hiding templates from the templates list in the admin app and related API responses.\r\n\r\nThis is used for 'internal' templates that we create for notifications that wouldn't have a template otherwise (eg pre-compiled PDF letters)\r\n\r\n### Add a DB migration to create Templates.hidden column\r\n\r\nCreates the column as nullable, sets the value to false for all existing templates and template versions and then applies a not-nullable constraint.\r\n\r\nAll future Templates are created with `False` as the default set in SQLAlchemy.\r\n\r\n### Set Notify service user as the creator of Pre-compiled PDF template\r\n\r\n\r\n### Add a view function for pre-compiled PDF letters\r\n\r\nAdds a separate view function that is registered under the same route as existing letter POST notification.\r\n\r\n### Upload pre-compiled letter PDF to S3\r\n\r\nPre-compiled letter endpoint uploads PDF contents to S3 directly instead of creating a letter task to generate PDF using template preview.\r\n\r\nThis moves some of the utility functions used by existing letter celery tasks to app.letters.utils, so that they can be reused by the API endpoint.\r\n\r\n### Check for precompiled letter permission in the post notification\r\n\r\n\r\n### Return 400 response for invalid per-compiled letter content\r\n\r\n\r\n### Don't return hidden templates in API service template responses\r\n\r\nRemoves hidden templates from the service templates list and returns 404 when searching for a hidden template or template versions by ID.\r\n","created_at":"2018-02-23T15:14:23Z","updated_at":"2018-02-23T15:42:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c1815145a2cf86e704f724d3f292685a675d4c53","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703/commits","review_comments_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703/comments","review_comment_url":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/issues/1703/comments","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/0a45fc67f30a9606c439225cf438a340a28a2d5a","head":{"label":"alphagov:pre-compiled-letter-pdf-endpoint","ref":"pre-compiled-letter-pdf-endpoint","sha":"0a45fc67f30a9606c439225cf438a340a28a2d5a","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":46422101,"name":"notifications-api","full_name":"alphagov/notifications-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/notifications-api","description":"GOV.UK Notify API","fork":false,"url":"https://api.github.com/repos/alphagov/notifications-api","forks_url":"https://api.github.com/repos/alphagov/notifications-api/forks","keys_url":"https://api.github.com/repos/alphagov/notifications-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/notifications-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/notifications-api/teams","hooks_url":"https://api.github.com/repos/alphagov/notifications-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/notifications-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/notifications-api/events","assignees_url":"https://api.github.com/repos/alphagov/notifications-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/notifications-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/notifications-api/tags","blobs_url":"https://api.github.com/repos/alphagov/notifications-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/notifications-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/notifications-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/notifications-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/notifications-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/notifications-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/notifications-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/notifications-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/notifications-api/subscription","commits_url":"https://api.github.com/repos/alphagov/notifications-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/notifications-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/notifications-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/notifications-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/notifications-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/notifications-api/merges","archive_url":"https://api.github.com/repos/alphagov/notifications-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/notifications-api/downloads","issues_url":"https://api.github.com/repos/alphagov/notifications-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/notifications-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/notifications-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/notifications-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/notifications-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/notifications-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/notifications-api/deployments","created_at":"2015-11-18T13:57:17Z","updated_at":"2018-02-14T22:51:37Z","pushed_at":"2018-02-23T15:18:36Z","git_url":"git://github.com/alphagov/notifications-api.git","ssh_url":"git@github.com:alphagov/notifications-api.git","clone_url":"https://github.com/alphagov/notifications-api.git","svn_url":"https://github.com/alphagov/notifications-api","homepage":"https://www.notifications.service.gov.uk/documentation","size":15909,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":6,"open_issues":9,"watchers":10,"default_branch":"master"}},"base":{"label":"alphagov:master","ref":"master","sha":"444dba994d953e3eb55678f4693c307525a4aefa","user":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"repo":{"id":46422101,"name":"notifications-api","full_name":"alphagov/notifications-api","owner":{"login":"alphagov","id":596977,"avatar_url":"https://avatars0.githubusercontent.com/u/596977?v=4","gravatar_id":"","url":"https://api.github.com/users/alphagov","html_url":"https://github.com/alphagov","followers_url":"https://api.github.com/users/alphagov/followers","following_url":"https://api.github.com/users/alphagov/following{/other_user}","gists_url":"https://api.github.com/users/alphagov/gists{/gist_id}","starred_url":"https://api.github.com/users/alphagov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alphagov/subscriptions","organizations_url":"https://api.github.com/users/alphagov/orgs","repos_url":"https://api.github.com/users/alphagov/repos","events_url":"https://api.github.com/users/alphagov/events{/privacy}","received_events_url":"https://api.github.com/users/alphagov/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/alphagov/notifications-api","description":"GOV.UK Notify API","fork":false,"url":"https://api.github.com/repos/alphagov/notifications-api","forks_url":"https://api.github.com/repos/alphagov/notifications-api/forks","keys_url":"https://api.github.com/repos/alphagov/notifications-api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/alphagov/notifications-api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/alphagov/notifications-api/teams","hooks_url":"https://api.github.com/repos/alphagov/notifications-api/hooks","issue_events_url":"https://api.github.com/repos/alphagov/notifications-api/issues/events{/number}","events_url":"https://api.github.com/repos/alphagov/notifications-api/events","assignees_url":"https://api.github.com/repos/alphagov/notifications-api/assignees{/user}","branches_url":"https://api.github.com/repos/alphagov/notifications-api/branches{/branch}","tags_url":"https://api.github.com/repos/alphagov/notifications-api/tags","blobs_url":"https://api.github.com/repos/alphagov/notifications-api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/alphagov/notifications-api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/alphagov/notifications-api/git/refs{/sha}","trees_url":"https://api.github.com/repos/alphagov/notifications-api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/alphagov/notifications-api/statuses/{sha}","languages_url":"https://api.github.com/repos/alphagov/notifications-api/languages","stargazers_url":"https://api.github.com/repos/alphagov/notifications-api/stargazers","contributors_url":"https://api.github.com/repos/alphagov/notifications-api/contributors","subscribers_url":"https://api.github.com/repos/alphagov/notifications-api/subscribers","subscription_url":"https://api.github.com/repos/alphagov/notifications-api/subscription","commits_url":"https://api.github.com/repos/alphagov/notifications-api/commits{/sha}","git_commits_url":"https://api.github.com/repos/alphagov/notifications-api/git/commits{/sha}","comments_url":"https://api.github.com/repos/alphagov/notifications-api/comments{/number}","issue_comment_url":"https://api.github.com/repos/alphagov/notifications-api/issues/comments{/number}","contents_url":"https://api.github.com/repos/alphagov/notifications-api/contents/{+path}","compare_url":"https://api.github.com/repos/alphagov/notifications-api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/alphagov/notifications-api/merges","archive_url":"https://api.github.com/repos/alphagov/notifications-api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/alphagov/notifications-api/downloads","issues_url":"https://api.github.com/repos/alphagov/notifications-api/issues{/number}","pulls_url":"https://api.github.com/repos/alphagov/notifications-api/pulls{/number}","milestones_url":"https://api.github.com/repos/alphagov/notifications-api/milestones{/number}","notifications_url":"https://api.github.com/repos/alphagov/notifications-api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/alphagov/notifications-api/labels{/name}","releases_url":"https://api.github.com/repos/alphagov/notifications-api/releases{/id}","deployments_url":"https://api.github.com/repos/alphagov/notifications-api/deployments","created_at":"2015-11-18T13:57:17Z","updated_at":"2018-02-14T22:51:37Z","pushed_at":"2018-02-23T15:18:36Z","git_url":"git://github.com/alphagov/notifications-api.git","ssh_url":"git@github.com:alphagov/notifications-api.git","clone_url":"https://github.com/alphagov/notifications-api.git","svn_url":"https://github.com/alphagov/notifications-api","homepage":"https://www.notifications.service.gov.uk/documentation","size":15909,"stargazers_count":10,"watchers_count":10,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6,"mirror_url":null,"archived":false,"open_issues_count":9,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":6,"open_issues":9,"watchers":10,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703"},"html":{"href":"https://github.com/alphagov/notifications-api/pull/1703"},"issue":{"href":"https://api.github.com/repos/alphagov/notifications-api/issues/1703"},"comments":{"href":"https://api.github.com/repos/alphagov/notifications-api/issues/1703/comments"},"review_comments":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703/comments"},"review_comment":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/alphagov/notifications-api/pulls/1703/commits"},"statuses":{"href":"https://api.github.com/repos/alphagov/notifications-api/statuses/0a45fc67f30a9606c439225cf438a340a28a2d5a"}},"author_association":"OWNER"}}
{"actor":{"display_login":"richardc0"}}