{"action":"created","comment":{"url":"https://api.github.com/repos/CommunityFundIS/web/pulls/comments/107135642","pull_request_review_id":28087966,"id":107135642,"diff_hunk":"@@ -1,29 +1,29 @@\n-import {\n-  GraphQLString as StringType,\n-  GraphQLNonNull as NonNull,\n-} from 'graphql';\n+import { GraphQLString as StringType, GraphQLNonNull as NonNull } from 'graphql';\n import moment from 'moment';\n+import jwt from 'jsonwebtoken';\n import SubmissionType from '../types/SubmissionType';\n-import { Submission, User, Vote } from '../models';\n-import { logError } from '../../logger';\n-import { isDev, googleRecaptchaSecret } from '../../config';\n+import { Submission, User } from '../models';\n+import { log, logError } from '../../logger';\n+import { host, isDev, googleRecaptchaSecret, auth } from '../../config';\n import fetch from '../../core/fetch';\n import reviewTemplate from '../emailTemplates/review.handlebars';\n import sendEmail from '../../core/email';\n \n-export const sendEmailToReviewer = async (reviewerEmail, submissionId) => {\n-  console.log('Sending grant review email', reviewerEmail, submissionId);\n+export const sendEmailToReviewer = async (reviewer, submission) => {\n+  log('Sending grant review email', reviewer.email, submission.Id);\n \n-  const submission = await Submission.findOne({\n-    id: submissionId,\n-  });\n-\n-  if (!submission) {\n-    throw Error('Submission not found');\n-  }\n+  const expiresIn = 60 * 60 * 24 * 15; // 10 days","path":"src/data/mutations/createSubmission.js","position":null,"original_position":31,"commit_id":"af27fe0b95b489af3f32c9d6ff0a6789c4a07dc0","original_commit_id":"a3da123e3ebe87d3f98f70a117b73f0c14061650","user":{"login":"johannth","id":38626,"avatar_url":"https://avatars0.githubusercontent.com/u/38626?v=3","gravatar_id":"","url":"https://api.github.com/users/johannth","html_url":"https://github.com/johannth","followers_url":"https://api.github.com/users/johannth/followers","following_url":"https://api.github.com/users/johannth/following{/other_user}","gists_url":"https://api.github.com/users/johannth/gists{/gist_id}","starred_url":"https://api.github.com/users/johannth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johannth/subscriptions","organizations_url":"https://api.github.com/users/johannth/orgs","repos_url":"https://api.github.com/users/johannth/repos","events_url":"https://api.github.com/users/johannth/events{/privacy}","received_events_url":"https://api.github.com/users/johannth/received_events","type":"User","site_admin":false},"body":"Fixed in af27fe0b95b489af3f32c9d6ff0a6789c4a07dc0","created_at":"2017-03-21T11:57:04Z","updated_at":"2017-03-21T11:57:04Z","html_url":"https://github.com/CommunityFundIS/web/pull/25#discussion_r107135642","pull_request_url":"https://api.github.com/repos/CommunityFundIS/web/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/comments/107135642"},"html":{"href":"https://github.com/CommunityFundIS/web/pull/25#discussion_r107135642"},"pull_request":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/CommunityFundIS/web/pulls/25","id":111750121,"html_url":"https://github.com/CommunityFundIS/web/pull/25","diff_url":"https://github.com/CommunityFundIS/web/pull/25.diff","patch_url":"https://github.com/CommunityFundIS/web/pull/25.patch","issue_url":"https://api.github.com/repos/CommunityFundIS/web/issues/25","number":25,"state":"open","locked":false,"title":"Automatic login for voting","user":{"login":"johannth","id":38626,"avatar_url":"https://avatars0.githubusercontent.com/u/38626?v=3","gravatar_id":"","url":"https://api.github.com/users/johannth","html_url":"https://github.com/johannth","followers_url":"https://api.github.com/users/johannth/followers","following_url":"https://api.github.com/users/johannth/following{/other_user}","gists_url":"https://api.github.com/users/johannth/gists{/gist_id}","starred_url":"https://api.github.com/users/johannth/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/johannth/subscriptions","organizations_url":"https://api.github.com/users/johannth/orgs","repos_url":"https://api.github.com/users/johannth/repos","events_url":"https://api.github.com/users/johannth/events{/privacy}","received_events_url":"https://api.github.com/users/johannth/received_events","type":"User","site_admin":false},"body":"Appends a token=<token> query parameter to the link that we send to the reviewers.\r\n\r\nI decide to plug into the current authentication scheme that uses JWT. \r\n\r\nThe flow is as follow:\r\n\r\n1. Generate a token that lasts for 15 days and passes along in the email.\r\n2. When the server detects the token parameter and no cookie it will add the cookie (but only for 15 minutes).\r\n\r\nBoth the token and cookie are relatively short lived. If we would want to revoke them it would be easiest to just change the JWT secret.\r\n\r\n## How do I test this?\r\n\r\n1. Submit a grant application\r\n2. Look at the links that get printed out in the console. Locally they use 3000 as the port. Change the port to 3001 and open the link in the browser. I couldn't figure out why we both run in 3000 and 3001.\r\n3. Vote.\r\n","created_at":"2017-03-21T10:54:10Z","updated_at":"2017-03-21T11:57:04Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5e530ccafbdcd478b8eb7150175a6a2b10f25daa","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/CommunityFundIS/web/pulls/25/commits","review_comments_url":"https://api.github.com/repos/CommunityFundIS/web/pulls/25/comments","review_comment_url":"https://api.github.com/repos/CommunityFundIS/web/pulls/comments{/number}","comments_url":"https://api.github.com/repos/CommunityFundIS/web/issues/25/comments","statuses_url":"https://api.github.com/repos/CommunityFundIS/web/statuses/af27fe0b95b489af3f32c9d6ff0a6789c4a07dc0","head":{"label":"CommunityFundIS:automatic-login-for-voting","ref":"automatic-login-for-voting","sha":"af27fe0b95b489af3f32c9d6ff0a6789c4a07dc0","user":{"login":"CommunityFundIS","id":24494414,"avatar_url":"https://avatars3.githubusercontent.com/u/24494414?v=3","gravatar_id":"","url":"https://api.github.com/users/CommunityFundIS","html_url":"https://github.com/CommunityFundIS","followers_url":"https://api.github.com/users/CommunityFundIS/followers","following_url":"https://api.github.com/users/CommunityFundIS/following{/other_user}","gists_url":"https://api.github.com/users/CommunityFundIS/gists{/gist_id}","starred_url":"https://api.github.com/users/CommunityFundIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommunityFundIS/subscriptions","organizations_url":"https://api.github.com/users/CommunityFundIS/orgs","repos_url":"https://api.github.com/users/CommunityFundIS/repos","events_url":"https://api.github.com/users/CommunityFundIS/events{/privacy}","received_events_url":"https://api.github.com/users/CommunityFundIS/received_events","type":"Organization","site_admin":false},"repo":{"id":83819454,"name":"web","full_name":"CommunityFundIS/web","owner":{"login":"CommunityFundIS","id":24494414,"avatar_url":"https://avatars3.githubusercontent.com/u/24494414?v=3","gravatar_id":"","url":"https://api.github.com/users/CommunityFundIS","html_url":"https://github.com/CommunityFundIS","followers_url":"https://api.github.com/users/CommunityFundIS/followers","following_url":"https://api.github.com/users/CommunityFundIS/following{/other_user}","gists_url":"https://api.github.com/users/CommunityFundIS/gists{/gist_id}","starred_url":"https://api.github.com/users/CommunityFundIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommunityFundIS/subscriptions","organizations_url":"https://api.github.com/users/CommunityFundIS/orgs","repos_url":"https://api.github.com/users/CommunityFundIS/repos","events_url":"https://api.github.com/users/CommunityFundIS/events{/privacy}","received_events_url":"https://api.github.com/users/CommunityFundIS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommunityFundIS/web","description":null,"fork":false,"url":"https://api.github.com/repos/CommunityFundIS/web","forks_url":"https://api.github.com/repos/CommunityFundIS/web/forks","keys_url":"https://api.github.com/repos/CommunityFundIS/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommunityFundIS/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommunityFundIS/web/teams","hooks_url":"https://api.github.com/repos/CommunityFundIS/web/hooks","issue_events_url":"https://api.github.com/repos/CommunityFundIS/web/issues/events{/number}","events_url":"https://api.github.com/repos/CommunityFundIS/web/events","assignees_url":"https://api.github.com/repos/CommunityFundIS/web/assignees{/user}","branches_url":"https://api.github.com/repos/CommunityFundIS/web/branches{/branch}","tags_url":"https://api.github.com/repos/CommunityFundIS/web/tags","blobs_url":"https://api.github.com/repos/CommunityFundIS/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommunityFundIS/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommunityFundIS/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommunityFundIS/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommunityFundIS/web/statuses/{sha}","languages_url":"https://api.github.com/repos/CommunityFundIS/web/languages","stargazers_url":"https://api.github.com/repos/CommunityFundIS/web/stargazers","contributors_url":"https://api.github.com/repos/CommunityFundIS/web/contributors","subscribers_url":"https://api.github.com/repos/CommunityFundIS/web/subscribers","subscription_url":"https://api.github.com/repos/CommunityFundIS/web/subscription","commits_url":"https://api.github.com/repos/CommunityFundIS/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommunityFundIS/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommunityFundIS/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommunityFundIS/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommunityFundIS/web/contents/{+path}","compare_url":"https://api.github.com/repos/CommunityFundIS/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommunityFundIS/web/merges","archive_url":"https://api.github.com/repos/CommunityFundIS/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommunityFundIS/web/downloads","issues_url":"https://api.github.com/repos/CommunityFundIS/web/issues{/number}","pulls_url":"https://api.github.com/repos/CommunityFundIS/web/pulls{/number}","milestones_url":"https://api.github.com/repos/CommunityFundIS/web/milestones{/number}","notifications_url":"https://api.github.com/repos/CommunityFundIS/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommunityFundIS/web/labels{/name}","releases_url":"https://api.github.com/repos/CommunityFundIS/web/releases{/id}","deployments_url":"https://api.github.com/repos/CommunityFundIS/web/deployments","created_at":"2017-03-03T16:38:43Z","updated_at":"2017-03-21T09:41:33Z","pushed_at":"2017-03-21T11:57:01Z","git_url":"git://github.com/CommunityFundIS/web.git","ssh_url":"git@github.com:CommunityFundIS/web.git","clone_url":"https://github.com/CommunityFundIS/web.git","svn_url":"https://github.com/CommunityFundIS/web","homepage":"https://communityfund.co","size":5022,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"master"}},"base":{"label":"CommunityFundIS:master","ref":"master","sha":"552cfbc967730cdaa3b3838899ceb0d0a0b4fd3c","user":{"login":"CommunityFundIS","id":24494414,"avatar_url":"https://avatars3.githubusercontent.com/u/24494414?v=3","gravatar_id":"","url":"https://api.github.com/users/CommunityFundIS","html_url":"https://github.com/CommunityFundIS","followers_url":"https://api.github.com/users/CommunityFundIS/followers","following_url":"https://api.github.com/users/CommunityFundIS/following{/other_user}","gists_url":"https://api.github.com/users/CommunityFundIS/gists{/gist_id}","starred_url":"https://api.github.com/users/CommunityFundIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommunityFundIS/subscriptions","organizations_url":"https://api.github.com/users/CommunityFundIS/orgs","repos_url":"https://api.github.com/users/CommunityFundIS/repos","events_url":"https://api.github.com/users/CommunityFundIS/events{/privacy}","received_events_url":"https://api.github.com/users/CommunityFundIS/received_events","type":"Organization","site_admin":false},"repo":{"id":83819454,"name":"web","full_name":"CommunityFundIS/web","owner":{"login":"CommunityFundIS","id":24494414,"avatar_url":"https://avatars3.githubusercontent.com/u/24494414?v=3","gravatar_id":"","url":"https://api.github.com/users/CommunityFundIS","html_url":"https://github.com/CommunityFundIS","followers_url":"https://api.github.com/users/CommunityFundIS/followers","following_url":"https://api.github.com/users/CommunityFundIS/following{/other_user}","gists_url":"https://api.github.com/users/CommunityFundIS/gists{/gist_id}","starred_url":"https://api.github.com/users/CommunityFundIS/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/CommunityFundIS/subscriptions","organizations_url":"https://api.github.com/users/CommunityFundIS/orgs","repos_url":"https://api.github.com/users/CommunityFundIS/repos","events_url":"https://api.github.com/users/CommunityFundIS/events{/privacy}","received_events_url":"https://api.github.com/users/CommunityFundIS/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/CommunityFundIS/web","description":null,"fork":false,"url":"https://api.github.com/repos/CommunityFundIS/web","forks_url":"https://api.github.com/repos/CommunityFundIS/web/forks","keys_url":"https://api.github.com/repos/CommunityFundIS/web/keys{/key_id}","collaborators_url":"https://api.github.com/repos/CommunityFundIS/web/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/CommunityFundIS/web/teams","hooks_url":"https://api.github.com/repos/CommunityFundIS/web/hooks","issue_events_url":"https://api.github.com/repos/CommunityFundIS/web/issues/events{/number}","events_url":"https://api.github.com/repos/CommunityFundIS/web/events","assignees_url":"https://api.github.com/repos/CommunityFundIS/web/assignees{/user}","branches_url":"https://api.github.com/repos/CommunityFundIS/web/branches{/branch}","tags_url":"https://api.github.com/repos/CommunityFundIS/web/tags","blobs_url":"https://api.github.com/repos/CommunityFundIS/web/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/CommunityFundIS/web/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/CommunityFundIS/web/git/refs{/sha}","trees_url":"https://api.github.com/repos/CommunityFundIS/web/git/trees{/sha}","statuses_url":"https://api.github.com/repos/CommunityFundIS/web/statuses/{sha}","languages_url":"https://api.github.com/repos/CommunityFundIS/web/languages","stargazers_url":"https://api.github.com/repos/CommunityFundIS/web/stargazers","contributors_url":"https://api.github.com/repos/CommunityFundIS/web/contributors","subscribers_url":"https://api.github.com/repos/CommunityFundIS/web/subscribers","subscription_url":"https://api.github.com/repos/CommunityFundIS/web/subscription","commits_url":"https://api.github.com/repos/CommunityFundIS/web/commits{/sha}","git_commits_url":"https://api.github.com/repos/CommunityFundIS/web/git/commits{/sha}","comments_url":"https://api.github.com/repos/CommunityFundIS/web/comments{/number}","issue_comment_url":"https://api.github.com/repos/CommunityFundIS/web/issues/comments{/number}","contents_url":"https://api.github.com/repos/CommunityFundIS/web/contents/{+path}","compare_url":"https://api.github.com/repos/CommunityFundIS/web/compare/{base}...{head}","merges_url":"https://api.github.com/repos/CommunityFundIS/web/merges","archive_url":"https://api.github.com/repos/CommunityFundIS/web/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/CommunityFundIS/web/downloads","issues_url":"https://api.github.com/repos/CommunityFundIS/web/issues{/number}","pulls_url":"https://api.github.com/repos/CommunityFundIS/web/pulls{/number}","milestones_url":"https://api.github.com/repos/CommunityFundIS/web/milestones{/number}","notifications_url":"https://api.github.com/repos/CommunityFundIS/web/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/CommunityFundIS/web/labels{/name}","releases_url":"https://api.github.com/repos/CommunityFundIS/web/releases{/id}","deployments_url":"https://api.github.com/repos/CommunityFundIS/web/deployments","created_at":"2017-03-03T16:38:43Z","updated_at":"2017-03-21T09:41:33Z","pushed_at":"2017-03-21T11:57:01Z","git_url":"git://github.com/CommunityFundIS/web.git","ssh_url":"git@github.com:CommunityFundIS/web.git","clone_url":"https://github.com/CommunityFundIS/web.git","svn_url":"https://github.com/CommunityFundIS/web","homepage":"https://communityfund.co","size":5022,"stargazers_count":2,"watchers_count":2,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":5,"forks":0,"open_issues":5,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/25"},"html":{"href":"https://github.com/CommunityFundIS/web/pull/25"},"issue":{"href":"https://api.github.com/repos/CommunityFundIS/web/issues/25"},"comments":{"href":"https://api.github.com/repos/CommunityFundIS/web/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/CommunityFundIS/web/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/CommunityFundIS/web/statuses/af27fe0b95b489af3f32c9d6ff0a6789c4a07dc0"}}}}
{"actor":{"display_login":"johannth"}}