{"action":"created","comment":{"url":"https://api.github.com/repos/HackIllinois/api/pulls/comments/233263557","pull_request_review_id":174637855,"id":233263557,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMzI2MzU1Nw==","diff_hunk":"@@ -25,3 +28,47 @@ func SendUserMail(id string, template string) error {\n \n \treturn err\n }\n+\n+/*\n+\tAdd user with given id, to the specified mailing list.\n+\tIf the mailing list does not exist, it creates a new list with the user.\n+*/\n+func AddUserToMailList(user_id string, mail_list_id string) error {\n+\tadd_to_mail_list_url := fmt.Sprintf(\"%s/mail/list/add/\", config.MAIL_SERVICE)\n+\n+\tmail_list := models.MailList{\n+\t\tID:      mail_list_id,\n+\t\tUserIDs: []string{user_id},\n+\t}\n+\n+\tupdate_request_body := bytes.Buffer{}\n+\tjson.NewEncoder(&update_request_body).Encode(&mail_list)\n+\n+\tstatus, err := apirequest.Post(add_to_mail_list_url, &update_request_body, nil)\n+\n+\tif err != nil {\n+\t\treturn err\n+\t}\n+\n+\tif status != http.StatusOK {\n+\t\t// The mailing list didn't exist\n+\t\tcreate_mail_list_url := fmt.Sprintf(\"%s/mail/list/create/\", config.MAIL_SERVICE)\n+\n+\t\tcreate_request_body := bytes.Buffer{}\n+\t\tjson.NewEncoder(&create_request_body).Encode(&mail_list)\n+\n+\t\tstatus, err = apirequest.Post(create_mail_list_url, &create_request_body, nil)\n+\n+\t\tif err != nil {\n+\t\t\treturn err\n+\t\t}\n+\n+\t\tif status != http.StatusOK {\n+\t\t\treturn errors.New(\"Mailing list does not exist, furthermore, creation of mailing list failed.\")\n+\t\t}\n+\n+\t\treturn err","path":"services/registration/service/mail_service.go","position":53,"original_position":53,"commit_id":"295043c00d2ceb9edc70c2aec492535671112a4c","original_commit_id":"295043c00d2ceb9edc70c2aec492535671112a4c","user":{"login":"ASankaran","id":6099357,"node_id":"MDQ6VXNlcjYwOTkzNTc=","avatar_url":"https://avatars2.githubusercontent.com/u/6099357?v=4","gravatar_id":"","url":"https://api.github.com/users/ASankaran","html_url":"https://github.com/ASankaran","followers_url":"https://api.github.com/users/ASankaran/followers","following_url":"https://api.github.com/users/ASankaran/following{/other_user}","gists_url":"https://api.github.com/users/ASankaran/gists{/gist_id}","starred_url":"https://api.github.com/users/ASankaran/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ASankaran/subscriptions","organizations_url":"https://api.github.com/users/ASankaran/orgs","repos_url":"https://api.github.com/users/ASankaran/repos","events_url":"https://api.github.com/users/ASankaran/events{/privacy}","received_events_url":"https://api.github.com/users/ASankaran/received_events","type":"User","site_admin":false},"body":"`return nil`\r\n\r\nMight as well be explicit here since err can only be nil.","created_at":"2018-11-13T23:30:44Z","updated_at":"2018-11-13T23:30:44Z","html_url":"https://github.com/HackIllinois/api/pull/83#discussion_r233263557","pull_request_url":"https://api.github.com/repos/HackIllinois/api/pulls/83","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/comments/233263557"},"html":{"href":"https://github.com/HackIllinois/api/pull/83#discussion_r233263557"},"pull_request":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/83"}}},"pull_request":{"url":"https://api.github.com/repos/HackIllinois/api/pulls/83","id":223826657,"node_id":"MDExOlB1bGxSZXF1ZXN0MjIzODI2NjU3","html_url":"https://github.com/HackIllinois/api/pull/83","diff_url":"https://github.com/HackIllinois/api/pull/83.diff","patch_url":"https://github.com/HackIllinois/api/pull/83.patch","issue_url":"https://api.github.com/repos/HackIllinois/api/issues/83","number":83,"state":"open","locked":false,"title":"Add users to a registered user mailing list, after registration.","user":{"login":"PradyumnaShome","id":13492296,"node_id":"MDQ6VXNlcjEzNDkyMjk2","avatar_url":"https://avatars3.githubusercontent.com/u/13492296?v=4","gravatar_id":"","url":"https://api.github.com/users/PradyumnaShome","html_url":"https://github.com/PradyumnaShome","followers_url":"https://api.github.com/users/PradyumnaShome/followers","following_url":"https://api.github.com/users/PradyumnaShome/following{/other_user}","gists_url":"https://api.github.com/users/PradyumnaShome/gists{/gist_id}","starred_url":"https://api.github.com/users/PradyumnaShome/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/PradyumnaShome/subscriptions","organizations_url":"https://api.github.com/users/PradyumnaShome/orgs","repos_url":"https://api.github.com/users/PradyumnaShome/repos","events_url":"https://api.github.com/users/PradyumnaShome/events{/privacy}","received_events_url":"https://api.github.com/users/PradyumnaShome/received_events","type":"User","site_admin":false},"body":"Addresses #61.\r\n\r\nUsers are added to a mailing list once they are registered.","created_at":"2018-10-18T05:05:42Z","updated_at":"2018-11-13T23:30:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"543e9cb5fdf72cc501986586efa5ddcbad52fbf4","assignee":null,"assignees":[],"requested_reviewers":[{"login":"benpankow","id":10215173,"node_id":"MDQ6VXNlcjEwMjE1MTcz","avatar_url":"https://avatars1.githubusercontent.com/u/10215173?v=4","gravatar_id":"","url":"https://api.github.com/users/benpankow","html_url":"https://github.com/benpankow","followers_url":"https://api.github.com/users/benpankow/followers","following_url":"https://api.github.com/users/benpankow/following{/other_user}","gists_url":"https://api.github.com/users/benpankow/gists{/gist_id}","starred_url":"https://api.github.com/users/benpankow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/benpankow/subscriptions","organizations_url":"https://api.github.com/users/benpankow/orgs","repos_url":"https://api.github.com/users/benpankow/repos","events_url":"https://api.github.com/users/benpankow/events{/privacy}","received_events_url":"https://api.github.com/users/benpankow/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/HackIllinois/api/pulls/83/commits","review_comments_url":"https://api.github.com/repos/HackIllinois/api/pulls/83/comments","review_comment_url":"https://api.github.com/repos/HackIllinois/api/pulls/comments{/number}","comments_url":"https://api.github.com/repos/HackIllinois/api/issues/83/comments","statuses_url":"https://api.github.com/repos/HackIllinois/api/statuses/295043c00d2ceb9edc70c2aec492535671112a4c","head":{"label":"HackIllinois:feat/registered-users-mail-list","ref":"feat/registered-users-mail-list","sha":"295043c00d2ceb9edc70c2aec492535671112a4c","user":{"login":"HackIllinois","id":5751098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTEwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5751098?v=4","gravatar_id":"","url":"https://api.github.com/users/HackIllinois","html_url":"https://github.com/HackIllinois","followers_url":"https://api.github.com/users/HackIllinois/followers","following_url":"https://api.github.com/users/HackIllinois/following{/other_user}","gists_url":"https://api.github.com/users/HackIllinois/gists{/gist_id}","starred_url":"https://api.github.com/users/HackIllinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackIllinois/subscriptions","organizations_url":"https://api.github.com/users/HackIllinois/orgs","repos_url":"https://api.github.com/users/HackIllinois/repos","events_url":"https://api.github.com/users/HackIllinois/events{/privacy}","received_events_url":"https://api.github.com/users/HackIllinois/received_events","type":"Organization","site_admin":false},"repo":{"id":143492864,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM0OTI4NjQ=","name":"api","full_name":"HackIllinois/api","private":false,"owner":{"login":"HackIllinois","id":5751098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTEwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5751098?v=4","gravatar_id":"","url":"https://api.github.com/users/HackIllinois","html_url":"https://github.com/HackIllinois","followers_url":"https://api.github.com/users/HackIllinois/followers","following_url":"https://api.github.com/users/HackIllinois/following{/other_user}","gists_url":"https://api.github.com/users/HackIllinois/gists{/gist_id}","starred_url":"https://api.github.com/users/HackIllinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackIllinois/subscriptions","organizations_url":"https://api.github.com/users/HackIllinois/orgs","repos_url":"https://api.github.com/users/HackIllinois/repos","events_url":"https://api.github.com/users/HackIllinois/events{/privacy}","received_events_url":"https://api.github.com/users/HackIllinois/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HackIllinois/api","description":"The API supporting Hackillinois","fork":false,"url":"https://api.github.com/repos/HackIllinois/api","forks_url":"https://api.github.com/repos/HackIllinois/api/forks","keys_url":"https://api.github.com/repos/HackIllinois/api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HackIllinois/api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HackIllinois/api/teams","hooks_url":"https://api.github.com/repos/HackIllinois/api/hooks","issue_events_url":"https://api.github.com/repos/HackIllinois/api/issues/events{/number}","events_url":"https://api.github.com/repos/HackIllinois/api/events","assignees_url":"https://api.github.com/repos/HackIllinois/api/assignees{/user}","branches_url":"https://api.github.com/repos/HackIllinois/api/branches{/branch}","tags_url":"https://api.github.com/repos/HackIllinois/api/tags","blobs_url":"https://api.github.com/repos/HackIllinois/api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HackIllinois/api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HackIllinois/api/git/refs{/sha}","trees_url":"https://api.github.com/repos/HackIllinois/api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HackIllinois/api/statuses/{sha}","languages_url":"https://api.github.com/repos/HackIllinois/api/languages","stargazers_url":"https://api.github.com/repos/HackIllinois/api/stargazers","contributors_url":"https://api.github.com/repos/HackIllinois/api/contributors","subscribers_url":"https://api.github.com/repos/HackIllinois/api/subscribers","subscription_url":"https://api.github.com/repos/HackIllinois/api/subscription","commits_url":"https://api.github.com/repos/HackIllinois/api/commits{/sha}","git_commits_url":"https://api.github.com/repos/HackIllinois/api/git/commits{/sha}","comments_url":"https://api.github.com/repos/HackIllinois/api/comments{/number}","issue_comment_url":"https://api.github.com/repos/HackIllinois/api/issues/comments{/number}","contents_url":"https://api.github.com/repos/HackIllinois/api/contents/{+path}","compare_url":"https://api.github.com/repos/HackIllinois/api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HackIllinois/api/merges","archive_url":"https://api.github.com/repos/HackIllinois/api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HackIllinois/api/downloads","issues_url":"https://api.github.com/repos/HackIllinois/api/issues{/number}","pulls_url":"https://api.github.com/repos/HackIllinois/api/pulls{/number}","milestones_url":"https://api.github.com/repos/HackIllinois/api/milestones{/number}","notifications_url":"https://api.github.com/repos/HackIllinois/api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HackIllinois/api/labels{/name}","releases_url":"https://api.github.com/repos/HackIllinois/api/releases{/id}","deployments_url":"https://api.github.com/repos/HackIllinois/api/deployments","created_at":"2018-08-04T02:58:57Z","updated_at":"2018-10-25T16:57:13Z","pushed_at":"2018-11-13T23:00:40Z","git_url":"git://github.com/HackIllinois/api.git","ssh_url":"git@github.com:HackIllinois/api.git","clone_url":"https://github.com/HackIllinois/api.git","svn_url":"https://github.com/HackIllinois/api","homepage":"https://api.hackillinois.org","size":1741,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":13,"open_issues":37,"watchers":8,"default_branch":"master"}},"base":{"label":"HackIllinois:staging","ref":"staging","sha":"e2d560211077bf64ce2d2db048bbbaa978273863","user":{"login":"HackIllinois","id":5751098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTEwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5751098?v=4","gravatar_id":"","url":"https://api.github.com/users/HackIllinois","html_url":"https://github.com/HackIllinois","followers_url":"https://api.github.com/users/HackIllinois/followers","following_url":"https://api.github.com/users/HackIllinois/following{/other_user}","gists_url":"https://api.github.com/users/HackIllinois/gists{/gist_id}","starred_url":"https://api.github.com/users/HackIllinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackIllinois/subscriptions","organizations_url":"https://api.github.com/users/HackIllinois/orgs","repos_url":"https://api.github.com/users/HackIllinois/repos","events_url":"https://api.github.com/users/HackIllinois/events{/privacy}","received_events_url":"https://api.github.com/users/HackIllinois/received_events","type":"Organization","site_admin":false},"repo":{"id":143492864,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM0OTI4NjQ=","name":"api","full_name":"HackIllinois/api","private":false,"owner":{"login":"HackIllinois","id":5751098,"node_id":"MDEyOk9yZ2FuaXphdGlvbjU3NTEwOTg=","avatar_url":"https://avatars0.githubusercontent.com/u/5751098?v=4","gravatar_id":"","url":"https://api.github.com/users/HackIllinois","html_url":"https://github.com/HackIllinois","followers_url":"https://api.github.com/users/HackIllinois/followers","following_url":"https://api.github.com/users/HackIllinois/following{/other_user}","gists_url":"https://api.github.com/users/HackIllinois/gists{/gist_id}","starred_url":"https://api.github.com/users/HackIllinois/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/HackIllinois/subscriptions","organizations_url":"https://api.github.com/users/HackIllinois/orgs","repos_url":"https://api.github.com/users/HackIllinois/repos","events_url":"https://api.github.com/users/HackIllinois/events{/privacy}","received_events_url":"https://api.github.com/users/HackIllinois/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/HackIllinois/api","description":"The API supporting Hackillinois","fork":false,"url":"https://api.github.com/repos/HackIllinois/api","forks_url":"https://api.github.com/repos/HackIllinois/api/forks","keys_url":"https://api.github.com/repos/HackIllinois/api/keys{/key_id}","collaborators_url":"https://api.github.com/repos/HackIllinois/api/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/HackIllinois/api/teams","hooks_url":"https://api.github.com/repos/HackIllinois/api/hooks","issue_events_url":"https://api.github.com/repos/HackIllinois/api/issues/events{/number}","events_url":"https://api.github.com/repos/HackIllinois/api/events","assignees_url":"https://api.github.com/repos/HackIllinois/api/assignees{/user}","branches_url":"https://api.github.com/repos/HackIllinois/api/branches{/branch}","tags_url":"https://api.github.com/repos/HackIllinois/api/tags","blobs_url":"https://api.github.com/repos/HackIllinois/api/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/HackIllinois/api/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/HackIllinois/api/git/refs{/sha}","trees_url":"https://api.github.com/repos/HackIllinois/api/git/trees{/sha}","statuses_url":"https://api.github.com/repos/HackIllinois/api/statuses/{sha}","languages_url":"https://api.github.com/repos/HackIllinois/api/languages","stargazers_url":"https://api.github.com/repos/HackIllinois/api/stargazers","contributors_url":"https://api.github.com/repos/HackIllinois/api/contributors","subscribers_url":"https://api.github.com/repos/HackIllinois/api/subscribers","subscription_url":"https://api.github.com/repos/HackIllinois/api/subscription","commits_url":"https://api.github.com/repos/HackIllinois/api/commits{/sha}","git_commits_url":"https://api.github.com/repos/HackIllinois/api/git/commits{/sha}","comments_url":"https://api.github.com/repos/HackIllinois/api/comments{/number}","issue_comment_url":"https://api.github.com/repos/HackIllinois/api/issues/comments{/number}","contents_url":"https://api.github.com/repos/HackIllinois/api/contents/{+path}","compare_url":"https://api.github.com/repos/HackIllinois/api/compare/{base}...{head}","merges_url":"https://api.github.com/repos/HackIllinois/api/merges","archive_url":"https://api.github.com/repos/HackIllinois/api/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/HackIllinois/api/downloads","issues_url":"https://api.github.com/repos/HackIllinois/api/issues{/number}","pulls_url":"https://api.github.com/repos/HackIllinois/api/pulls{/number}","milestones_url":"https://api.github.com/repos/HackIllinois/api/milestones{/number}","notifications_url":"https://api.github.com/repos/HackIllinois/api/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/HackIllinois/api/labels{/name}","releases_url":"https://api.github.com/repos/HackIllinois/api/releases{/id}","deployments_url":"https://api.github.com/repos/HackIllinois/api/deployments","created_at":"2018-08-04T02:58:57Z","updated_at":"2018-10-25T16:57:13Z","pushed_at":"2018-11-13T23:00:40Z","git_url":"git://github.com/HackIllinois/api.git","ssh_url":"git@github.com:HackIllinois/api.git","clone_url":"https://github.com/HackIllinois/api.git","svn_url":"https://github.com/HackIllinois/api","homepage":"https://api.hackillinois.org","size":1741,"stargazers_count":8,"watchers_count":8,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"archived":false,"open_issues_count":37,"license":{"key":"other","name":"Other","spdx_id":"NOASSERTION","url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":13,"open_issues":37,"watchers":8,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/83"},"html":{"href":"https://github.com/HackIllinois/api/pull/83"},"issue":{"href":"https://api.github.com/repos/HackIllinois/api/issues/83"},"comments":{"href":"https://api.github.com/repos/HackIllinois/api/issues/83/comments"},"review_comments":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/83/comments"},"review_comment":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/HackIllinois/api/pulls/83/commits"},"statuses":{"href":"https://api.github.com/repos/HackIllinois/api/statuses/295043c00d2ceb9edc70c2aec492535671112a4c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"ASankaran"}}