{"action":"created","comment":{"url":"https://api.github.com/repos/meirim-org/meirim/pulls/comments/169177771","pull_request_review_id":97662851,"id":169177771,"diff_hunk":"@@ -10,19 +10,43 @@ const _ = require('lodash');\n class AlertController extends Controller {\n   create(req, res, next) {\n     return super.create(req, res, next).then(savedAlert => {\n-      return Email.newAlert(req.session.person, savedAlert).then(res=>{\n+      return Email.newAlert(req.session.person, savedAlert).then(res => {\n         return savedAlert;\n-        });\n+      });\n     });\n   }\n \n-  browse(req, res, next) {\n-    if (!req.session.person) throw new Exception.notAllowed(\"Must be logged in\");\n+  /**\n+   * Return person's alerts. Must be logged in.\n+   * @param {IncomingRequest} req \n+   * @param {OutgoingResponse} res \n+   */\n+  browse(req, res) {\n+\n+    if (!req.session.person)\n+      throw new Exception.notAllowed('Must be logged in');\n+\n     return this.model.query('where', 'person_id', '=', req.session.person.id)\n       .fetchAll()\n-      .then(collection => {\n-      Log.debug(this.tableName, \"browse success user\",req.session.person.id);\n-      return collection;\n+      .then((collection) => {\n+        Log.debug(this.tableName, 'browse success user', req.session.person.id);\n+        return collection;\n+      });\n+  }\n+  /**\n+   * Unsubscribe from alert by token, when clicking an unsubscribe\n+   * link in an email\n+   * @param {IncomingRequest} req \n+   * @param {OutgoingResponse} res \n+   */\n+  unsubscribe(req, res) {\n+    return Alert.ByToken(req.query.token).fetch().then((fetchedModel) => {\n+      if (!fetchedModel)\n+        throw new Exception.notFound('Nof found');","path":"backend/api/controller/alert.js","position":43,"original_position":43,"commit_id":"f4688ee92cadd3099d30dd059454c827561137da","original_commit_id":"f4688ee92cadd3099d30dd059454c827561137da","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars1.githubusercontent.com/u/19940114?v=4","gravatar_id":"","url":"https://api.github.com/users/codacy-bot","html_url":"https://github.com/codacy-bot","followers_url":"https://api.github.com/users/codacy-bot/followers","following_url":"https://api.github.com/users/codacy-bot/following{/other_user}","gists_url":"https://api.github.com/users/codacy-bot/gists{/gist_id}","starred_url":"https://api.github.com/users/codacy-bot/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codacy-bot/subscriptions","organizations_url":"https://api.github.com/users/codacy-bot/orgs","repos_url":"https://api.github.com/users/codacy-bot/repos","events_url":"https://api.github.com/users/codacy-bot/events{/privacy}","received_events_url":"https://api.github.com/users/codacy-bot/received_events","type":"User","site_admin":false},"body":"![Codacy](https://app.codacy.com/assets/images/favicon.png) Issue found: [A constructor name should not start with a lowercase letter. (new-cap)](https://app.codacy.com/app/CitizensForCities/CitizensForCities/pullRequest?prid=1328508)","created_at":"2018-02-19T21:49:27Z","updated_at":"2018-02-19T21:49:27Z","html_url":"https://github.com/meirim-org/meirim/pull/58#discussion_r169177771","pull_request_url":"https://api.github.com/repos/meirim-org/meirim/pulls/58","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/comments/169177771"},"html":{"href":"https://github.com/meirim-org/meirim/pull/58#discussion_r169177771"},"pull_request":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/58"}}},"pull_request":{"url":"https://api.github.com/repos/meirim-org/meirim/pulls/58","id":168675280,"html_url":"https://github.com/meirim-org/meirim/pull/58","diff_url":"https://github.com/meirim-org/meirim/pull/58.diff","patch_url":"https://github.com/meirim-org/meirim/pull/58.patch","issue_url":"https://api.github.com/repos/meirim-org/meirim/issues/58","number":58,"state":"open","locked":false,"title":"Added unsubscribe route and unsubscribe link in the email","user":{"login":"dortheimer","id":3685757,"avatar_url":"https://avatars0.githubusercontent.com/u/3685757?v=4","gravatar_id":"","url":"https://api.github.com/users/dortheimer","html_url":"https://github.com/dortheimer","followers_url":"https://api.github.com/users/dortheimer/followers","following_url":"https://api.github.com/users/dortheimer/following{/other_user}","gists_url":"https://api.github.com/users/dortheimer/gists{/gist_id}","starred_url":"https://api.github.com/users/dortheimer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dortheimer/subscriptions","organizations_url":"https://api.github.com/users/dortheimer/orgs","repos_url":"https://api.github.com/users/dortheimer/repos","events_url":"https://api.github.com/users/dortheimer/events{/privacy}","received_events_url":"https://api.github.com/users/dortheimer/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-02-12T20:06:26Z","updated_at":"2018-02-19T21:49:27Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4aa6c267891d9eda81ca68687013bc6c5993d847","assignee":null,"assignees":[],"requested_reviewers":[{"login":"BlueHotDog","id":231539,"avatar_url":"https://avatars1.githubusercontent.com/u/231539?v=4","gravatar_id":"","url":"https://api.github.com/users/BlueHotDog","html_url":"https://github.com/BlueHotDog","followers_url":"https://api.github.com/users/BlueHotDog/followers","following_url":"https://api.github.com/users/BlueHotDog/following{/other_user}","gists_url":"https://api.github.com/users/BlueHotDog/gists{/gist_id}","starred_url":"https://api.github.com/users/BlueHotDog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/BlueHotDog/subscriptions","organizations_url":"https://api.github.com/users/BlueHotDog/orgs","repos_url":"https://api.github.com/users/BlueHotDog/repos","events_url":"https://api.github.com/users/BlueHotDog/events{/privacy}","received_events_url":"https://api.github.com/users/BlueHotDog/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/meirim-org/meirim/pulls/58/commits","review_comments_url":"https://api.github.com/repos/meirim-org/meirim/pulls/58/comments","review_comment_url":"https://api.github.com/repos/meirim-org/meirim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/meirim-org/meirim/issues/58/comments","statuses_url":"https://api.github.com/repos/meirim-org/meirim/statuses/f4688ee92cadd3099d30dd059454c827561137da","head":{"label":"meirim-org:issue29-unsubscribe_backend_link","ref":"issue29-unsubscribe_backend_link","sha":"f4688ee92cadd3099d30dd059454c827561137da","user":{"login":"meirim-org","id":35703559,"avatar_url":"https://avatars1.githubusercontent.com/u/35703559?v=4","gravatar_id":"","url":"https://api.github.com/users/meirim-org","html_url":"https://github.com/meirim-org","followers_url":"https://api.github.com/users/meirim-org/followers","following_url":"https://api.github.com/users/meirim-org/following{/other_user}","gists_url":"https://api.github.com/users/meirim-org/gists{/gist_id}","starred_url":"https://api.github.com/users/meirim-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meirim-org/subscriptions","organizations_url":"https://api.github.com/users/meirim-org/orgs","repos_url":"https://api.github.com/users/meirim-org/repos","events_url":"https://api.github.com/users/meirim-org/events{/privacy}","received_events_url":"https://api.github.com/users/meirim-org/received_events","type":"Organization","site_admin":false},"repo":{"id":92304996,"name":"meirim","full_name":"meirim-org/meirim","owner":{"login":"meirim-org","id":35703559,"avatar_url":"https://avatars1.githubusercontent.com/u/35703559?v=4","gravatar_id":"","url":"https://api.github.com/users/meirim-org","html_url":"https://github.com/meirim-org","followers_url":"https://api.github.com/users/meirim-org/followers","following_url":"https://api.github.com/users/meirim-org/following{/other_user}","gists_url":"https://api.github.com/users/meirim-org/gists{/gist_id}","starred_url":"https://api.github.com/users/meirim-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meirim-org/subscriptions","organizations_url":"https://api.github.com/users/meirim-org/orgs","repos_url":"https://api.github.com/users/meirim-org/repos","events_url":"https://api.github.com/users/meirim-org/events{/privacy}","received_events_url":"https://api.github.com/users/meirim-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meirim-org/meirim","description":"The citizens for cities initialive will produce an online platform to help organization and collaboration in urban politics.","fork":false,"url":"https://api.github.com/repos/meirim-org/meirim","forks_url":"https://api.github.com/repos/meirim-org/meirim/forks","keys_url":"https://api.github.com/repos/meirim-org/meirim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meirim-org/meirim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meirim-org/meirim/teams","hooks_url":"https://api.github.com/repos/meirim-org/meirim/hooks","issue_events_url":"https://api.github.com/repos/meirim-org/meirim/issues/events{/number}","events_url":"https://api.github.com/repos/meirim-org/meirim/events","assignees_url":"https://api.github.com/repos/meirim-org/meirim/assignees{/user}","branches_url":"https://api.github.com/repos/meirim-org/meirim/branches{/branch}","tags_url":"https://api.github.com/repos/meirim-org/meirim/tags","blobs_url":"https://api.github.com/repos/meirim-org/meirim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meirim-org/meirim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meirim-org/meirim/git/refs{/sha}","trees_url":"https://api.github.com/repos/meirim-org/meirim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meirim-org/meirim/statuses/{sha}","languages_url":"https://api.github.com/repos/meirim-org/meirim/languages","stargazers_url":"https://api.github.com/repos/meirim-org/meirim/stargazers","contributors_url":"https://api.github.com/repos/meirim-org/meirim/contributors","subscribers_url":"https://api.github.com/repos/meirim-org/meirim/subscribers","subscription_url":"https://api.github.com/repos/meirim-org/meirim/subscription","commits_url":"https://api.github.com/repos/meirim-org/meirim/commits{/sha}","git_commits_url":"https://api.github.com/repos/meirim-org/meirim/git/commits{/sha}","comments_url":"https://api.github.com/repos/meirim-org/meirim/comments{/number}","issue_comment_url":"https://api.github.com/repos/meirim-org/meirim/issues/comments{/number}","contents_url":"https://api.github.com/repos/meirim-org/meirim/contents/{+path}","compare_url":"https://api.github.com/repos/meirim-org/meirim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meirim-org/meirim/merges","archive_url":"https://api.github.com/repos/meirim-org/meirim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meirim-org/meirim/downloads","issues_url":"https://api.github.com/repos/meirim-org/meirim/issues{/number}","pulls_url":"https://api.github.com/repos/meirim-org/meirim/pulls{/number}","milestones_url":"https://api.github.com/repos/meirim-org/meirim/milestones{/number}","notifications_url":"https://api.github.com/repos/meirim-org/meirim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meirim-org/meirim/labels{/name}","releases_url":"https://api.github.com/repos/meirim-org/meirim/releases{/id}","deployments_url":"https://api.github.com/repos/meirim-org/meirim/deployments","created_at":"2017-05-24T15:00:57Z","updated_at":"2018-02-09T18:37:38Z","pushed_at":"2018-02-19T17:56:32Z","git_url":"git://github.com/meirim-org/meirim.git","ssh_url":"git@github.com:meirim-org/meirim.git","clone_url":"https://github.com/meirim-org/meirim.git","svn_url":"https://github.com/meirim-org/meirim","homepage":null,"size":4999,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":5,"open_issues":23,"watchers":2,"default_branch":"master"}},"base":{"label":"meirim-org:master","ref":"master","sha":"6f820b10f5a8cb2f6e5f5d1760622becb5a19307","user":{"login":"meirim-org","id":35703559,"avatar_url":"https://avatars1.githubusercontent.com/u/35703559?v=4","gravatar_id":"","url":"https://api.github.com/users/meirim-org","html_url":"https://github.com/meirim-org","followers_url":"https://api.github.com/users/meirim-org/followers","following_url":"https://api.github.com/users/meirim-org/following{/other_user}","gists_url":"https://api.github.com/users/meirim-org/gists{/gist_id}","starred_url":"https://api.github.com/users/meirim-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meirim-org/subscriptions","organizations_url":"https://api.github.com/users/meirim-org/orgs","repos_url":"https://api.github.com/users/meirim-org/repos","events_url":"https://api.github.com/users/meirim-org/events{/privacy}","received_events_url":"https://api.github.com/users/meirim-org/received_events","type":"Organization","site_admin":false},"repo":{"id":92304996,"name":"meirim","full_name":"meirim-org/meirim","owner":{"login":"meirim-org","id":35703559,"avatar_url":"https://avatars1.githubusercontent.com/u/35703559?v=4","gravatar_id":"","url":"https://api.github.com/users/meirim-org","html_url":"https://github.com/meirim-org","followers_url":"https://api.github.com/users/meirim-org/followers","following_url":"https://api.github.com/users/meirim-org/following{/other_user}","gists_url":"https://api.github.com/users/meirim-org/gists{/gist_id}","starred_url":"https://api.github.com/users/meirim-org/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/meirim-org/subscriptions","organizations_url":"https://api.github.com/users/meirim-org/orgs","repos_url":"https://api.github.com/users/meirim-org/repos","events_url":"https://api.github.com/users/meirim-org/events{/privacy}","received_events_url":"https://api.github.com/users/meirim-org/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/meirim-org/meirim","description":"The citizens for cities initialive will produce an online platform to help organization and collaboration in urban politics.","fork":false,"url":"https://api.github.com/repos/meirim-org/meirim","forks_url":"https://api.github.com/repos/meirim-org/meirim/forks","keys_url":"https://api.github.com/repos/meirim-org/meirim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/meirim-org/meirim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/meirim-org/meirim/teams","hooks_url":"https://api.github.com/repos/meirim-org/meirim/hooks","issue_events_url":"https://api.github.com/repos/meirim-org/meirim/issues/events{/number}","events_url":"https://api.github.com/repos/meirim-org/meirim/events","assignees_url":"https://api.github.com/repos/meirim-org/meirim/assignees{/user}","branches_url":"https://api.github.com/repos/meirim-org/meirim/branches{/branch}","tags_url":"https://api.github.com/repos/meirim-org/meirim/tags","blobs_url":"https://api.github.com/repos/meirim-org/meirim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/meirim-org/meirim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/meirim-org/meirim/git/refs{/sha}","trees_url":"https://api.github.com/repos/meirim-org/meirim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/meirim-org/meirim/statuses/{sha}","languages_url":"https://api.github.com/repos/meirim-org/meirim/languages","stargazers_url":"https://api.github.com/repos/meirim-org/meirim/stargazers","contributors_url":"https://api.github.com/repos/meirim-org/meirim/contributors","subscribers_url":"https://api.github.com/repos/meirim-org/meirim/subscribers","subscription_url":"https://api.github.com/repos/meirim-org/meirim/subscription","commits_url":"https://api.github.com/repos/meirim-org/meirim/commits{/sha}","git_commits_url":"https://api.github.com/repos/meirim-org/meirim/git/commits{/sha}","comments_url":"https://api.github.com/repos/meirim-org/meirim/comments{/number}","issue_comment_url":"https://api.github.com/repos/meirim-org/meirim/issues/comments{/number}","contents_url":"https://api.github.com/repos/meirim-org/meirim/contents/{+path}","compare_url":"https://api.github.com/repos/meirim-org/meirim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/meirim-org/meirim/merges","archive_url":"https://api.github.com/repos/meirim-org/meirim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/meirim-org/meirim/downloads","issues_url":"https://api.github.com/repos/meirim-org/meirim/issues{/number}","pulls_url":"https://api.github.com/repos/meirim-org/meirim/pulls{/number}","milestones_url":"https://api.github.com/repos/meirim-org/meirim/milestones{/number}","notifications_url":"https://api.github.com/repos/meirim-org/meirim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/meirim-org/meirim/labels{/name}","releases_url":"https://api.github.com/repos/meirim-org/meirim/releases{/id}","deployments_url":"https://api.github.com/repos/meirim-org/meirim/deployments","created_at":"2017-05-24T15:00:57Z","updated_at":"2018-02-09T18:37:38Z","pushed_at":"2018-02-19T17:56:32Z","git_url":"git://github.com/meirim-org/meirim.git","ssh_url":"git@github.com:meirim-org/meirim.git","clone_url":"https://github.com/meirim-org/meirim.git","svn_url":"https://github.com/meirim-org/meirim","homepage":null,"size":4999,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":23,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit"},"forks":5,"open_issues":23,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/58"},"html":{"href":"https://github.com/meirim-org/meirim/pull/58"},"issue":{"href":"https://api.github.com/repos/meirim-org/meirim/issues/58"},"comments":{"href":"https://api.github.com/repos/meirim-org/meirim/issues/58/comments"},"review_comments":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/58/comments"},"review_comment":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/meirim-org/meirim/pulls/58/commits"},"statuses":{"href":"https://api.github.com/repos/meirim-org/meirim/statuses/f4688ee92cadd3099d30dd059454c827561137da"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"codacy-bot"}}