{"action":"created","comment":{"url":"https://api.github.com/repos/outline/outline/pulls/comments/178440302","pull_request_review_id":108501032,"id":178440302,"diff_hunk":"@@ -223,23 +228,51 @@ Document.searchForUser = async (\n \n // Hooks\n \n-Document.addHook('afterCreate', model =>\n-  events.add({ name: 'documents.create', model })\n-);\n+Document.addHook('beforeSave', async model => {\n+  if (!model.publishedAt) return;\n+\n+  const collection = await Collection.findById(model.atlasId);\n+  if (collection.type !== 'atlas') return;\n+\n+  await collection.updateDocument(model);\n+  model.collection = collection;","path":"server/models/Document.js","position":33,"original_position":33,"commit_id":"5f3320f44c297cfaaf4382fff66b5212e0c87c2f","original_commit_id":"5f3320f44c297cfaaf4382fff66b5212e0c87c2f","user":{"login":"jorilallo","id":31465,"avatar_url":"https://avatars3.githubusercontent.com/u/31465?v=4","gravatar_id":"","url":"https://api.github.com/users/jorilallo","html_url":"https://github.com/jorilallo","followers_url":"https://api.github.com/users/jorilallo/followers","following_url":"https://api.github.com/users/jorilallo/following{/other_user}","gists_url":"https://api.github.com/users/jorilallo/gists{/gist_id}","starred_url":"https://api.github.com/users/jorilallo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jorilallo/subscriptions","organizations_url":"https://api.github.com/users/jorilallo/orgs","repos_url":"https://api.github.com/users/jorilallo/repos","events_url":"https://api.github.com/users/jorilallo/events{/privacy}","received_events_url":"https://api.github.com/users/jorilallo/received_events","type":"User","site_admin":false},"body":"👏 ","created_at":"2018-03-31T19:42:05Z","updated_at":"2018-03-31T19:42:05Z","html_url":"https://github.com/outline/outline/pull/603#discussion_r178440302","pull_request_url":"https://api.github.com/repos/outline/outline/pulls/603","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/outline/outline/pulls/comments/178440302"},"html":{"href":"https://github.com/outline/outline/pull/603#discussion_r178440302"},"pull_request":{"href":"https://api.github.com/repos/outline/outline/pulls/603"}}},"pull_request":{"url":"https://api.github.com/repos/outline/outline/pulls/603","id":169869695,"html_url":"https://github.com/outline/outline/pull/603","diff_url":"https://github.com/outline/outline/pull/603.diff","patch_url":"https://github.com/outline/outline/pull/603.patch","issue_url":"https://api.github.com/repos/outline/outline/issues/603","number":603,"state":"open","locked":false,"title":"Post to Slack","user":{"login":"tommoor","id":380914,"avatar_url":"https://avatars2.githubusercontent.com/u/380914?v=4","gravatar_id":"","url":"https://api.github.com/users/tommoor","html_url":"https://github.com/tommoor","followers_url":"https://api.github.com/users/tommoor/followers","following_url":"https://api.github.com/users/tommoor/following{/other_user}","gists_url":"https://api.github.com/users/tommoor/gists{/gist_id}","starred_url":"https://api.github.com/users/tommoor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tommoor/subscriptions","organizations_url":"https://api.github.com/users/tommoor/orgs","repos_url":"https://api.github.com/users/tommoor/repos","events_url":"https://api.github.com/users/tommoor/events{/privacy}","received_events_url":"https://api.github.com/users/tommoor/received_events","type":"User","site_admin":false},"body":"Ongoing work to enable connect and post collection changes to Slack.\r\n\r\n### Todo:\r\n\r\n- [x] Add new Integration model and endpoints\r\n- [x] Integrate new authorization work from #602 \r\n- [x] Make sure that `documents.update` isn't triggered every time the user hits CMD+S\r\n- [ ] Stretch: Remove need to redirect user through SPA and redirect directly to API\r\n\r\ncloses https://github.com/outline/outline/issues/63","created_at":"2018-02-19T02:52:57Z","updated_at":"2018-03-31T19:42:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"034a0ad35a2a4bfa8ccc40042a515461ecf8d625","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":380684924,"url":"https://api.github.com/repos/outline/outline/labels/enhancement","name":"enhancement","color":"84b6eb","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/outline/outline/pulls/603/commits","review_comments_url":"https://api.github.com/repos/outline/outline/pulls/603/comments","review_comment_url":"https://api.github.com/repos/outline/outline/pulls/comments{/number}","comments_url":"https://api.github.com/repos/outline/outline/issues/603/comments","statuses_url":"https://api.github.com/repos/outline/outline/statuses/5f3320f44c297cfaaf4382fff66b5212e0c87c2f","head":{"label":"outline:post-to-slack","ref":"post-to-slack","sha":"5f3320f44c297cfaaf4382fff66b5212e0c87c2f","user":{"login":"outline","id":1765001,"avatar_url":"https://avatars0.githubusercontent.com/u/1765001?v=4","gravatar_id":"","url":"https://api.github.com/users/outline","html_url":"https://github.com/outline","followers_url":"https://api.github.com/users/outline/followers","following_url":"https://api.github.com/users/outline/following{/other_user}","gists_url":"https://api.github.com/users/outline/gists{/gist_id}","starred_url":"https://api.github.com/users/outline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outline/subscriptions","organizations_url":"https://api.github.com/users/outline/orgs","repos_url":"https://api.github.com/users/outline/repos","events_url":"https://api.github.com/users/outline/events{/privacy}","received_events_url":"https://api.github.com/users/outline/received_events","type":"Organization","site_admin":false},"repo":{"id":59435364,"name":"outline","full_name":"outline/outline","owner":{"login":"outline","id":1765001,"avatar_url":"https://avatars0.githubusercontent.com/u/1765001?v=4","gravatar_id":"","url":"https://api.github.com/users/outline","html_url":"https://github.com/outline","followers_url":"https://api.github.com/users/outline/followers","following_url":"https://api.github.com/users/outline/following{/other_user}","gists_url":"https://api.github.com/users/outline/gists{/gist_id}","starred_url":"https://api.github.com/users/outline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outline/subscriptions","organizations_url":"https://api.github.com/users/outline/orgs","repos_url":"https://api.github.com/users/outline/repos","events_url":"https://api.github.com/users/outline/events{/privacy}","received_events_url":"https://api.github.com/users/outline/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outline/outline","description":"📝 Open source wiki and knowledge base for growing teams","fork":false,"url":"https://api.github.com/repos/outline/outline","forks_url":"https://api.github.com/repos/outline/outline/forks","keys_url":"https://api.github.com/repos/outline/outline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outline/outline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outline/outline/teams","hooks_url":"https://api.github.com/repos/outline/outline/hooks","issue_events_url":"https://api.github.com/repos/outline/outline/issues/events{/number}","events_url":"https://api.github.com/repos/outline/outline/events","assignees_url":"https://api.github.com/repos/outline/outline/assignees{/user}","branches_url":"https://api.github.com/repos/outline/outline/branches{/branch}","tags_url":"https://api.github.com/repos/outline/outline/tags","blobs_url":"https://api.github.com/repos/outline/outline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outline/outline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outline/outline/git/refs{/sha}","trees_url":"https://api.github.com/repos/outline/outline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outline/outline/statuses/{sha}","languages_url":"https://api.github.com/repos/outline/outline/languages","stargazers_url":"https://api.github.com/repos/outline/outline/stargazers","contributors_url":"https://api.github.com/repos/outline/outline/contributors","subscribers_url":"https://api.github.com/repos/outline/outline/subscribers","subscription_url":"https://api.github.com/repos/outline/outline/subscription","commits_url":"https://api.github.com/repos/outline/outline/commits{/sha}","git_commits_url":"https://api.github.com/repos/outline/outline/git/commits{/sha}","comments_url":"https://api.github.com/repos/outline/outline/comments{/number}","issue_comment_url":"https://api.github.com/repos/outline/outline/issues/comments{/number}","contents_url":"https://api.github.com/repos/outline/outline/contents/{+path}","compare_url":"https://api.github.com/repos/outline/outline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outline/outline/merges","archive_url":"https://api.github.com/repos/outline/outline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outline/outline/downloads","issues_url":"https://api.github.com/repos/outline/outline/issues{/number}","pulls_url":"https://api.github.com/repos/outline/outline/pulls{/number}","milestones_url":"https://api.github.com/repos/outline/outline/milestones{/number}","notifications_url":"https://api.github.com/repos/outline/outline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outline/outline/labels{/name}","releases_url":"https://api.github.com/repos/outline/outline/releases{/id}","deployments_url":"https://api.github.com/repos/outline/outline/deployments","created_at":"2016-05-22T21:31:47Z","updated_at":"2018-03-31T01:42:28Z","pushed_at":"2018-03-30T07:32:34Z","git_url":"git://github.com/outline/outline.git","ssh_url":"git@github.com:outline/outline.git","clone_url":"https://github.com/outline/outline.git","svn_url":"https://github.com/outline/outline","homepage":"https://www.getoutline.com/","size":5317,"stargazers_count":522,"watchers_count":522,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":19,"open_issues":34,"watchers":522,"default_branch":"master"}},"base":{"label":"outline:master","ref":"master","sha":"c7d50c4a78c2f1cd4de7e873f65296b55ea13033","user":{"login":"outline","id":1765001,"avatar_url":"https://avatars0.githubusercontent.com/u/1765001?v=4","gravatar_id":"","url":"https://api.github.com/users/outline","html_url":"https://github.com/outline","followers_url":"https://api.github.com/users/outline/followers","following_url":"https://api.github.com/users/outline/following{/other_user}","gists_url":"https://api.github.com/users/outline/gists{/gist_id}","starred_url":"https://api.github.com/users/outline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outline/subscriptions","organizations_url":"https://api.github.com/users/outline/orgs","repos_url":"https://api.github.com/users/outline/repos","events_url":"https://api.github.com/users/outline/events{/privacy}","received_events_url":"https://api.github.com/users/outline/received_events","type":"Organization","site_admin":false},"repo":{"id":59435364,"name":"outline","full_name":"outline/outline","owner":{"login":"outline","id":1765001,"avatar_url":"https://avatars0.githubusercontent.com/u/1765001?v=4","gravatar_id":"","url":"https://api.github.com/users/outline","html_url":"https://github.com/outline","followers_url":"https://api.github.com/users/outline/followers","following_url":"https://api.github.com/users/outline/following{/other_user}","gists_url":"https://api.github.com/users/outline/gists{/gist_id}","starred_url":"https://api.github.com/users/outline/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/outline/subscriptions","organizations_url":"https://api.github.com/users/outline/orgs","repos_url":"https://api.github.com/users/outline/repos","events_url":"https://api.github.com/users/outline/events{/privacy}","received_events_url":"https://api.github.com/users/outline/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/outline/outline","description":"📝 Open source wiki and knowledge base for growing teams","fork":false,"url":"https://api.github.com/repos/outline/outline","forks_url":"https://api.github.com/repos/outline/outline/forks","keys_url":"https://api.github.com/repos/outline/outline/keys{/key_id}","collaborators_url":"https://api.github.com/repos/outline/outline/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/outline/outline/teams","hooks_url":"https://api.github.com/repos/outline/outline/hooks","issue_events_url":"https://api.github.com/repos/outline/outline/issues/events{/number}","events_url":"https://api.github.com/repos/outline/outline/events","assignees_url":"https://api.github.com/repos/outline/outline/assignees{/user}","branches_url":"https://api.github.com/repos/outline/outline/branches{/branch}","tags_url":"https://api.github.com/repos/outline/outline/tags","blobs_url":"https://api.github.com/repos/outline/outline/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/outline/outline/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/outline/outline/git/refs{/sha}","trees_url":"https://api.github.com/repos/outline/outline/git/trees{/sha}","statuses_url":"https://api.github.com/repos/outline/outline/statuses/{sha}","languages_url":"https://api.github.com/repos/outline/outline/languages","stargazers_url":"https://api.github.com/repos/outline/outline/stargazers","contributors_url":"https://api.github.com/repos/outline/outline/contributors","subscribers_url":"https://api.github.com/repos/outline/outline/subscribers","subscription_url":"https://api.github.com/repos/outline/outline/subscription","commits_url":"https://api.github.com/repos/outline/outline/commits{/sha}","git_commits_url":"https://api.github.com/repos/outline/outline/git/commits{/sha}","comments_url":"https://api.github.com/repos/outline/outline/comments{/number}","issue_comment_url":"https://api.github.com/repos/outline/outline/issues/comments{/number}","contents_url":"https://api.github.com/repos/outline/outline/contents/{+path}","compare_url":"https://api.github.com/repos/outline/outline/compare/{base}...{head}","merges_url":"https://api.github.com/repos/outline/outline/merges","archive_url":"https://api.github.com/repos/outline/outline/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/outline/outline/downloads","issues_url":"https://api.github.com/repos/outline/outline/issues{/number}","pulls_url":"https://api.github.com/repos/outline/outline/pulls{/number}","milestones_url":"https://api.github.com/repos/outline/outline/milestones{/number}","notifications_url":"https://api.github.com/repos/outline/outline/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/outline/outline/labels{/name}","releases_url":"https://api.github.com/repos/outline/outline/releases{/id}","deployments_url":"https://api.github.com/repos/outline/outline/deployments","created_at":"2016-05-22T21:31:47Z","updated_at":"2018-03-31T01:42:28Z","pushed_at":"2018-03-30T07:32:34Z","git_url":"git://github.com/outline/outline.git","ssh_url":"git@github.com:outline/outline.git","clone_url":"https://github.com/outline/outline.git","svn_url":"https://github.com/outline/outline","homepage":"https://www.getoutline.com/","size":5317,"stargazers_count":522,"watchers_count":522,"language":"JavaScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":19,"mirror_url":null,"archived":false,"open_issues_count":34,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause"},"forks":19,"open_issues":34,"watchers":522,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/outline/outline/pulls/603"},"html":{"href":"https://github.com/outline/outline/pull/603"},"issue":{"href":"https://api.github.com/repos/outline/outline/issues/603"},"comments":{"href":"https://api.github.com/repos/outline/outline/issues/603/comments"},"review_comments":{"href":"https://api.github.com/repos/outline/outline/pulls/603/comments"},"review_comment":{"href":"https://api.github.com/repos/outline/outline/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/outline/outline/pulls/603/commits"},"statuses":{"href":"https://api.github.com/repos/outline/outline/statuses/5f3320f44c297cfaaf4382fff66b5212e0c87c2f"}},"author_association":"OWNER"}}
{"actor":{"display_login":"jorilallo"}}