{"action":"created","comment":{"url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/comments/34025851","id":34025851,"diff_hunk":"@@ -0,0 +1,68 @@\n+package controller\n+\n+import (\n+\t\"encoding/json\"\n+\t\"fmt\"\n+\t\"net/http\"\n+\n+\t\"github.com/gorilla/mux\"\n+)\n+\n+// NotificationRequest is the JSON request sent by a client to trigger\n+// to escalating notification of a whole team. Implements the Notification interface.\n+type NotificationRequest struct {\n+\tSummary string `json:\"summary\"` // a summary or subject of the notification. Currenlty not used in all integrations. Optional.\n+\tContent string `json:\"content\"` // the notification content. mandatory.\n+}\n+\n+// StopNotification stops a notification-in-progress (NIP) by sending the UUID to the notification engine\n+func (a *Controller) StopNotification(w http.ResponseWriter, r *http.Request) {\n+\tvar res NotifyPersonResponse\n+\n+\tvars := mux.Vars(r)\n+\tid := vars[\"uuid\"]\n+\n+\tw.Header().Set(\"Content-Type\", \"application/json; charset=UTF-8\")\n+\n+\tif !a.n.IsNotification(id) {\n+\t\tres = NotifyPersonResponse{\n+\t\t\tError: \"No active notifications for this UUID\",\n+\t\t\tUUID:  id,\n+\t\t}\n+\t\terrjson, _ := json.Marshal(res)\n+\t\thttp.Error(w, string(errjson), http.StatusNotFound)\n+\t\treturn\n+\t}\n+\n+\t// Attempt to stop the notification by sending the UUID to the notification engine\n+\ta.n.CancelNotification(id)\n+\n+\t// TO DO: make sure that this is a valid UUID and obtain\n+\t//        confirmation of deletion\n+\n+\tres = NotifyPersonResponse{\n+\t\tMessage: \"Attempting to terminate notification\",\n+\t\tUUID:    id,\n+\t}\n+\n+\tjson.NewEncoder(w).Encode(res)\n+}\n+\n+// StopNotificationClick provides a simple GET-able endpoint to stop notifications when a link is clicked in an email client\n+func (a *Controller) StopNotificationClick(w http.ResponseWriter, r *http.Request) {\n+\n+\tvars := mux.Vars(r)\n+\tid := vars[\"uuid\"]\n+\n+\tw.Header().Set(\"Content-Type\", \"text/html; charset=UTF-8\")\n+\n+\tif !a.n.IsNotification(id) {\n+\t\thttp.Error(w, fmt.Sprintf(\"UUID %s not found.\", id), http.StatusNotFound)\n+\t\treturn\n+\t}\n+\n+\t// Attempt to stop the notification by sending the UUID to the notification engine\n+\ta.n.CancelNotification(id)\n+\n+\tfmt.Fprintln(w, \"<html><body><b>Thank you!</b><br><br>Chicken Little has received your acknowledgement and you will no longer be notified with this message.</body></html>\")","path":"controller/notification.go","position":67,"original_position":67,"commit_id":"196981087343e66c79b7e0651fb53f42e57f8ebe","original_commit_id":"196981087343e66c79b7e0651fb53f42e57f8ebe","user":{"login":"dominikschulz","id":1449175,"avatar_url":"https://avatars.githubusercontent.com/u/1449175?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikschulz","html_url":"https://github.com/dominikschulz","followers_url":"https://api.github.com/users/dominikschulz/followers","following_url":"https://api.github.com/users/dominikschulz/following{/other_user}","gists_url":"https://api.github.com/users/dominikschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikschulz/subscriptions","organizations_url":"https://api.github.com/users/dominikschulz/orgs","repos_url":"https://api.github.com/users/dominikschulz/repos","events_url":"https://api.github.com/users/dominikschulz/events{/privacy}","received_events_url":"https://api.github.com/users/dominikschulz/received_events","type":"User","site_admin":false},"body":"Definitely but IMHO i18n can get quite messy, so I`d like to keep that separate from the teamescalations branch.","created_at":"2015-07-07T10:17:18Z","updated_at":"2015-07-07T10:17:18Z","html_url":"https://github.com/chrissnell/chickenlittle/pull/10#discussion_r34025851","pull_request_url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10","_links":{"self":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/comments/34025851"},"html":{"href":"https://github.com/chrissnell/chickenlittle/pull/10#discussion_r34025851"},"pull_request":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10"}}},"pull_request":{"url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10","id":38969251,"html_url":"https://github.com/chrissnell/chickenlittle/pull/10","diff_url":"https://github.com/chrissnell/chickenlittle/pull/10.diff","patch_url":"https://github.com/chrissnell/chickenlittle/pull/10.patch","issue_url":"https://api.github.com/repos/chrissnell/chickenlittle/issues/10","number":10,"state":"open","locked":false,"title":"Refactor packages","user":{"login":"dominikschulz","id":1449175,"avatar_url":"https://avatars.githubusercontent.com/u/1449175?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikschulz","html_url":"https://github.com/dominikschulz","followers_url":"https://api.github.com/users/dominikschulz/followers","following_url":"https://api.github.com/users/dominikschulz/following{/other_user}","gists_url":"https://api.github.com/users/dominikschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikschulz/subscriptions","organizations_url":"https://api.github.com/users/dominikschulz/orgs","repos_url":"https://api.github.com/users/dominikschulz/repos","events_url":"https://api.github.com/users/dominikschulz/events{/privacy}","received_events_url":"https://api.github.com/users/dominikschulz/received_events","type":"User","site_admin":false},"body":"This PR contains a major overhaul of the package structure of this project.\r\n\r\nIt grew bigger and bigger over time while trying to split things up support the implementation of the team escalation logic. At the moment it does neither provide working team nor people notifications or escalations but it lays the ground to implement those in an follow-up PR against the teamescalations branch. It is definitely not yet mature enough the get merged into master.\r\n\r\nI´m sorry for putting this many changes into one PR, but I didn´t want to do large refactoring without having tests and one let to the other ... so please have a look and tell me what you think. It still contains a lot TODO which should be gone before this gets merged.\r\n\r\nIf you insist I can try to split it up into smaller PRs, but due to the nature of those changes that could be tedious and error prone.\r\n\r\nI´ll continue working on the team escalation logic and update the PR.","created_at":"2015-07-01T10:41:36Z","updated_at":"2015-07-07T10:17:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"732cf4ed03be8ea12d5c66dbe1d4f7f66bdb1582","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10/commits","review_comments_url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10/comments","review_comment_url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/comments{/number}","comments_url":"https://api.github.com/repos/chrissnell/chickenlittle/issues/10/comments","statuses_url":"https://api.github.com/repos/chrissnell/chickenlittle/statuses/196981087343e66c79b7e0651fb53f42e57f8ebe","head":{"label":"dominikschulz:teams","ref":"teams","sha":"196981087343e66c79b7e0651fb53f42e57f8ebe","user":{"login":"dominikschulz","id":1449175,"avatar_url":"https://avatars.githubusercontent.com/u/1449175?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikschulz","html_url":"https://github.com/dominikschulz","followers_url":"https://api.github.com/users/dominikschulz/followers","following_url":"https://api.github.com/users/dominikschulz/following{/other_user}","gists_url":"https://api.github.com/users/dominikschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikschulz/subscriptions","organizations_url":"https://api.github.com/users/dominikschulz/orgs","repos_url":"https://api.github.com/users/dominikschulz/repos","events_url":"https://api.github.com/users/dominikschulz/events{/privacy}","received_events_url":"https://api.github.com/users/dominikschulz/received_events","type":"User","site_admin":false},"repo":{"id":37197029,"name":"chickenlittle","full_name":"dominikschulz/chickenlittle","owner":{"login":"dominikschulz","id":1449175,"avatar_url":"https://avatars.githubusercontent.com/u/1449175?v=3","gravatar_id":"","url":"https://api.github.com/users/dominikschulz","html_url":"https://github.com/dominikschulz","followers_url":"https://api.github.com/users/dominikschulz/followers","following_url":"https://api.github.com/users/dominikschulz/following{/other_user}","gists_url":"https://api.github.com/users/dominikschulz/gists{/gist_id}","starred_url":"https://api.github.com/users/dominikschulz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dominikschulz/subscriptions","organizations_url":"https://api.github.com/users/dominikschulz/orgs","repos_url":"https://api.github.com/users/dominikschulz/repos","events_url":"https://api.github.com/users/dominikschulz/events{/privacy}","received_events_url":"https://api.github.com/users/dominikschulz/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/dominikschulz/chickenlittle","description":"A RESTful service to get ahold of people, quickly.","fork":true,"url":"https://api.github.com/repos/dominikschulz/chickenlittle","forks_url":"https://api.github.com/repos/dominikschulz/chickenlittle/forks","keys_url":"https://api.github.com/repos/dominikschulz/chickenlittle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dominikschulz/chickenlittle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dominikschulz/chickenlittle/teams","hooks_url":"https://api.github.com/repos/dominikschulz/chickenlittle/hooks","issue_events_url":"https://api.github.com/repos/dominikschulz/chickenlittle/issues/events{/number}","events_url":"https://api.github.com/repos/dominikschulz/chickenlittle/events","assignees_url":"https://api.github.com/repos/dominikschulz/chickenlittle/assignees{/user}","branches_url":"https://api.github.com/repos/dominikschulz/chickenlittle/branches{/branch}","tags_url":"https://api.github.com/repos/dominikschulz/chickenlittle/tags","blobs_url":"https://api.github.com/repos/dominikschulz/chickenlittle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dominikschulz/chickenlittle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dominikschulz/chickenlittle/git/refs{/sha}","trees_url":"https://api.github.com/repos/dominikschulz/chickenlittle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dominikschulz/chickenlittle/statuses/{sha}","languages_url":"https://api.github.com/repos/dominikschulz/chickenlittle/languages","stargazers_url":"https://api.github.com/repos/dominikschulz/chickenlittle/stargazers","contributors_url":"https://api.github.com/repos/dominikschulz/chickenlittle/contributors","subscribers_url":"https://api.github.com/repos/dominikschulz/chickenlittle/subscribers","subscription_url":"https://api.github.com/repos/dominikschulz/chickenlittle/subscription","commits_url":"https://api.github.com/repos/dominikschulz/chickenlittle/commits{/sha}","git_commits_url":"https://api.github.com/repos/dominikschulz/chickenlittle/git/commits{/sha}","comments_url":"https://api.github.com/repos/dominikschulz/chickenlittle/comments{/number}","issue_comment_url":"https://api.github.com/repos/dominikschulz/chickenlittle/issues/comments{/number}","contents_url":"https://api.github.com/repos/dominikschulz/chickenlittle/contents/{+path}","compare_url":"https://api.github.com/repos/dominikschulz/chickenlittle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dominikschulz/chickenlittle/merges","archive_url":"https://api.github.com/repos/dominikschulz/chickenlittle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dominikschulz/chickenlittle/downloads","issues_url":"https://api.github.com/repos/dominikschulz/chickenlittle/issues{/number}","pulls_url":"https://api.github.com/repos/dominikschulz/chickenlittle/pulls{/number}","milestones_url":"https://api.github.com/repos/dominikschulz/chickenlittle/milestones{/number}","notifications_url":"https://api.github.com/repos/dominikschulz/chickenlittle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dominikschulz/chickenlittle/labels{/name}","releases_url":"https://api.github.com/repos/dominikschulz/chickenlittle/releases{/id}","created_at":"2015-06-10T12:54:34Z","updated_at":"2015-06-10T12:54:34Z","pushed_at":"2015-07-06T09:24:07Z","git_url":"git://github.com/dominikschulz/chickenlittle.git","ssh_url":"git@github.com:dominikschulz/chickenlittle.git","clone_url":"https://github.com/dominikschulz/chickenlittle.git","svn_url":"https://github.com/dominikschulz/chickenlittle","homepage":null,"size":2309,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"chrissnell:teamescalation","ref":"teamescalation","sha":"106b508cc596b9592890ba456f53cd6211ffd453","user":{"login":"chrissnell","id":1072626,"avatar_url":"https://avatars.githubusercontent.com/u/1072626?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissnell","html_url":"https://github.com/chrissnell","followers_url":"https://api.github.com/users/chrissnell/followers","following_url":"https://api.github.com/users/chrissnell/following{/other_user}","gists_url":"https://api.github.com/users/chrissnell/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissnell/subscriptions","organizations_url":"https://api.github.com/users/chrissnell/orgs","repos_url":"https://api.github.com/users/chrissnell/repos","events_url":"https://api.github.com/users/chrissnell/events{/privacy}","received_events_url":"https://api.github.com/users/chrissnell/received_events","type":"User","site_admin":false},"repo":{"id":36709041,"name":"chickenlittle","full_name":"chrissnell/chickenlittle","owner":{"login":"chrissnell","id":1072626,"avatar_url":"https://avatars.githubusercontent.com/u/1072626?v=3","gravatar_id":"","url":"https://api.github.com/users/chrissnell","html_url":"https://github.com/chrissnell","followers_url":"https://api.github.com/users/chrissnell/followers","following_url":"https://api.github.com/users/chrissnell/following{/other_user}","gists_url":"https://api.github.com/users/chrissnell/gists{/gist_id}","starred_url":"https://api.github.com/users/chrissnell/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrissnell/subscriptions","organizations_url":"https://api.github.com/users/chrissnell/orgs","repos_url":"https://api.github.com/users/chrissnell/repos","events_url":"https://api.github.com/users/chrissnell/events{/privacy}","received_events_url":"https://api.github.com/users/chrissnell/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/chrissnell/chickenlittle","description":"A RESTful service to get ahold of people, quickly.","fork":false,"url":"https://api.github.com/repos/chrissnell/chickenlittle","forks_url":"https://api.github.com/repos/chrissnell/chickenlittle/forks","keys_url":"https://api.github.com/repos/chrissnell/chickenlittle/keys{/key_id}","collaborators_url":"https://api.github.com/repos/chrissnell/chickenlittle/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/chrissnell/chickenlittle/teams","hooks_url":"https://api.github.com/repos/chrissnell/chickenlittle/hooks","issue_events_url":"https://api.github.com/repos/chrissnell/chickenlittle/issues/events{/number}","events_url":"https://api.github.com/repos/chrissnell/chickenlittle/events","assignees_url":"https://api.github.com/repos/chrissnell/chickenlittle/assignees{/user}","branches_url":"https://api.github.com/repos/chrissnell/chickenlittle/branches{/branch}","tags_url":"https://api.github.com/repos/chrissnell/chickenlittle/tags","blobs_url":"https://api.github.com/repos/chrissnell/chickenlittle/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/chrissnell/chickenlittle/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/chrissnell/chickenlittle/git/refs{/sha}","trees_url":"https://api.github.com/repos/chrissnell/chickenlittle/git/trees{/sha}","statuses_url":"https://api.github.com/repos/chrissnell/chickenlittle/statuses/{sha}","languages_url":"https://api.github.com/repos/chrissnell/chickenlittle/languages","stargazers_url":"https://api.github.com/repos/chrissnell/chickenlittle/stargazers","contributors_url":"https://api.github.com/repos/chrissnell/chickenlittle/contributors","subscribers_url":"https://api.github.com/repos/chrissnell/chickenlittle/subscribers","subscription_url":"https://api.github.com/repos/chrissnell/chickenlittle/subscription","commits_url":"https://api.github.com/repos/chrissnell/chickenlittle/commits{/sha}","git_commits_url":"https://api.github.com/repos/chrissnell/chickenlittle/git/commits{/sha}","comments_url":"https://api.github.com/repos/chrissnell/chickenlittle/comments{/number}","issue_comment_url":"https://api.github.com/repos/chrissnell/chickenlittle/issues/comments{/number}","contents_url":"https://api.github.com/repos/chrissnell/chickenlittle/contents/{+path}","compare_url":"https://api.github.com/repos/chrissnell/chickenlittle/compare/{base}...{head}","merges_url":"https://api.github.com/repos/chrissnell/chickenlittle/merges","archive_url":"https://api.github.com/repos/chrissnell/chickenlittle/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/chrissnell/chickenlittle/downloads","issues_url":"https://api.github.com/repos/chrissnell/chickenlittle/issues{/number}","pulls_url":"https://api.github.com/repos/chrissnell/chickenlittle/pulls{/number}","milestones_url":"https://api.github.com/repos/chrissnell/chickenlittle/milestones{/number}","notifications_url":"https://api.github.com/repos/chrissnell/chickenlittle/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/chrissnell/chickenlittle/labels{/name}","releases_url":"https://api.github.com/repos/chrissnell/chickenlittle/releases{/id}","created_at":"2015-06-02T05:01:51Z","updated_at":"2015-06-14T19:31:37Z","pushed_at":"2015-07-07T00:44:55Z","git_url":"git://github.com/chrissnell/chickenlittle.git","ssh_url":"git@github.com:chrissnell/chickenlittle.git","clone_url":"https://github.com/chrissnell/chickenlittle.git","svn_url":"https://github.com/chrissnell/chickenlittle","homepage":null,"size":2747,"stargazers_count":29,"watchers_count":29,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":2,"forks":1,"open_issues":2,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10"},"html":{"href":"https://github.com/chrissnell/chickenlittle/pull/10"},"issue":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/issues/10"},"comments":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/issues/10/comments"},"review_comments":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10/comments"},"review_comment":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/pulls/10/commits"},"statuses":{"href":"https://api.github.com/repos/chrissnell/chickenlittle/statuses/196981087343e66c79b7e0651fb53f42e57f8ebe"}}}}