{"action":"created","comment":{"url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments/76261833","id":76261833,"diff_hunk":"@@ -0,0 +1,55 @@\n+package com.musicforall.services.message;\n+\n+import com.musicforall.model.User;\n+import com.musicforall.services.template.TemplateService;\n+import com.musicforall.util.SecurityUtil;\n+import org.springframework.beans.factory.annotation.Autowired;\n+import org.springframework.beans.factory.annotation.Qualifier;\n+import org.springframework.mail.SimpleMailMessage;\n+import org.springframework.stereotype.Component;\n+\n+import java.util.HashMap;\n+import java.util.Map;\n+\n+import static com.musicforall.util.SecurityUtil.currentUser;\n+\n+/**\n+ * Created by kgavrylchenko on 25.08.16.\n+ */\n+@Component\n+public class Mails {\n+    @Autowired\n+    private TemplateService templateService;\n+\n+    @Autowired\n+    @Qualifier(\"email\")\n+    private String emailFrom;\n+\n+    public SimpleMailMessage welcomeMail() {\n+        final User user = currentUser();\n+\n+        final Map<String, Object> params = new HashMap<>();\n+        params.put(\"username\", user.getUsername());\n+        return MailBuilder.build()\n+                .to(emailTo())\n+                .from(emailFrom)\n+                .subject(\"WELCOME\")\n+                .text(mailText(\"welcomeMessageTemplate.ftl\", params))\n+                .get();\n+    }\n+\n+    private String emailTo() {\n+        return SecurityUtil.currentUser().getEmail();\n+    }\n+\n+    private String mailText(String template, Map<String, Object> params) {\n+        String mailText;\n+        try {\n+            mailText = templateService.from(template, params);\n+        } catch (Exception e) {\n+            throw new RuntimeException(e);","path":"application/src/main/java/com/musicforall/services/message/Mails.java","position":50,"original_position":50,"commit_id":"43a483d4bb594b5a7e3dd3e30c5bc122edf0b91e","original_commit_id":"1c763b395454fd788f74c2384efa3dd34880ff57","user":{"login":"codacy-bot","id":19940114,"avatar_url":"https://avatars.githubusercontent.com/u/19940114?v=3","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://www.codacy.com/assets/images/favicon.png) Issue found: [Avoid throwing raw exception types.](https://www.codacy.com/app/music_for_all/music-for-all-application/file/3567244029/issues/source?bid=3379442&fileBranchId=3603883#l50)","created_at":"2016-08-25T15:08:13Z","updated_at":"2016-08-25T15:08:13Z","html_url":"https://github.com/music-for-all/music-for-all-application/pull/68#discussion_r76261833","pull_request_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68","_links":{"self":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments/76261833"},"html":{"href":"https://github.com/music-for-all/music-for-all-application/pull/68#discussion_r76261833"},"pull_request":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68"}}},"pull_request":{"url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68","id":81826942,"html_url":"https://github.com/music-for-all/music-for-all-application/pull/68","diff_url":"https://github.com/music-for-all/music-for-all-application/pull/68.diff","patch_url":"https://github.com/music-for-all/music-for-all-application/pull/68.patch","issue_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/68","number":68,"state":"open","locked":false,"title":"Messages","user":{"login":"jekanik","id":13684926,"avatar_url":"https://avatars.githubusercontent.com/u/13684926?v=3","gravatar_id":"","url":"https://api.github.com/users/jekanik","html_url":"https://github.com/jekanik","followers_url":"https://api.github.com/users/jekanik/followers","following_url":"https://api.github.com/users/jekanik/following{/other_user}","gists_url":"https://api.github.com/users/jekanik/gists{/gist_id}","starred_url":"https://api.github.com/users/jekanik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jekanik/subscriptions","organizations_url":"https://api.github.com/users/jekanik/orgs","repos_url":"https://api.github.com/users/jekanik/repos","events_url":"https://api.github.com/users/jekanik/events{/privacy}","received_events_url":"https://api.github.com/users/jekanik/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-08-18T14:36:11Z","updated_at":"2016-08-25T15:08:14Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1d06ec365d4a6ec6c2da4484ca5823c9acf8e00c","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68/commits","review_comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68/comments","review_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments{/number}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/68/comments","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/43a483d4bb594b5a7e3dd3e30c5bc122edf0b91e","head":{"label":"music-for-all:messages","ref":"messages","sha":"43a483d4bb594b5a7e3dd3e30c5bc122edf0b91e","user":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"repo":{"id":60590888,"name":"music-for-all-application","full_name":"music-for-all/music-for-all-application","owner":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/music-for-all/music-for-all-application","description":"","fork":false,"url":"https://api.github.com/repos/music-for-all/music-for-all-application","forks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/forks","keys_url":"https://api.github.com/repos/music-for-all/music-for-all-application/keys{/key_id}","collaborators_url":"https://api.github.com/repos/music-for-all/music-for-all-application/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/music-for-all/music-for-all-application/teams","hooks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/hooks","issue_events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/events{/number}","events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/events","assignees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/assignees{/user}","branches_url":"https://api.github.com/repos/music-for-all/music-for-all-application/branches{/branch}","tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/tags","blobs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/refs{/sha}","trees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/trees{/sha}","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/{sha}","languages_url":"https://api.github.com/repos/music-for-all/music-for-all-application/languages","stargazers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/stargazers","contributors_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contributors","subscribers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscribers","subscription_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscription","commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/commits{/sha}","git_commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/commits{/sha}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/comments{/number}","issue_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/comments{/number}","contents_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contents/{+path}","compare_url":"https://api.github.com/repos/music-for-all/music-for-all-application/compare/{base}...{head}","merges_url":"https://api.github.com/repos/music-for-all/music-for-all-application/merges","archive_url":"https://api.github.com/repos/music-for-all/music-for-all-application/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/music-for-all/music-for-all-application/downloads","issues_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues{/number}","pulls_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls{/number}","milestones_url":"https://api.github.com/repos/music-for-all/music-for-all-application/milestones{/number}","notifications_url":"https://api.github.com/repos/music-for-all/music-for-all-application/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/music-for-all/music-for-all-application/labels{/name}","releases_url":"https://api.github.com/repos/music-for-all/music-for-all-application/releases{/id}","deployments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/deployments","created_at":"2016-06-07T07:13:41Z","updated_at":"2016-08-13T09:33:55Z","pushed_at":"2016-08-25T15:07:18Z","git_url":"git://github.com/music-for-all/music-for-all-application.git","ssh_url":"git@github.com:music-for-all/music-for-all-application.git","clone_url":"https://github.com/music-for-all/music-for-all-application.git","svn_url":"https://github.com/music-for-all/music-for-all-application","homepage":null,"size":20139,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":3,"default_branch":"master"}},"base":{"label":"music-for-all:master","ref":"master","sha":"ac26a5209776b1ff96082e73d64cff27e94a34e7","user":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"repo":{"id":60590888,"name":"music-for-all-application","full_name":"music-for-all/music-for-all-application","owner":{"login":"music-for-all","id":19793146,"avatar_url":"https://avatars.githubusercontent.com/u/19793146?v=3","gravatar_id":"","url":"https://api.github.com/users/music-for-all","html_url":"https://github.com/music-for-all","followers_url":"https://api.github.com/users/music-for-all/followers","following_url":"https://api.github.com/users/music-for-all/following{/other_user}","gists_url":"https://api.github.com/users/music-for-all/gists{/gist_id}","starred_url":"https://api.github.com/users/music-for-all/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/music-for-all/subscriptions","organizations_url":"https://api.github.com/users/music-for-all/orgs","repos_url":"https://api.github.com/users/music-for-all/repos","events_url":"https://api.github.com/users/music-for-all/events{/privacy}","received_events_url":"https://api.github.com/users/music-for-all/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/music-for-all/music-for-all-application","description":"","fork":false,"url":"https://api.github.com/repos/music-for-all/music-for-all-application","forks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/forks","keys_url":"https://api.github.com/repos/music-for-all/music-for-all-application/keys{/key_id}","collaborators_url":"https://api.github.com/repos/music-for-all/music-for-all-application/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/music-for-all/music-for-all-application/teams","hooks_url":"https://api.github.com/repos/music-for-all/music-for-all-application/hooks","issue_events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/events{/number}","events_url":"https://api.github.com/repos/music-for-all/music-for-all-application/events","assignees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/assignees{/user}","branches_url":"https://api.github.com/repos/music-for-all/music-for-all-application/branches{/branch}","tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/tags","blobs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/refs{/sha}","trees_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/trees{/sha}","statuses_url":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/{sha}","languages_url":"https://api.github.com/repos/music-for-all/music-for-all-application/languages","stargazers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/stargazers","contributors_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contributors","subscribers_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscribers","subscription_url":"https://api.github.com/repos/music-for-all/music-for-all-application/subscription","commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/commits{/sha}","git_commits_url":"https://api.github.com/repos/music-for-all/music-for-all-application/git/commits{/sha}","comments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/comments{/number}","issue_comment_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/comments{/number}","contents_url":"https://api.github.com/repos/music-for-all/music-for-all-application/contents/{+path}","compare_url":"https://api.github.com/repos/music-for-all/music-for-all-application/compare/{base}...{head}","merges_url":"https://api.github.com/repos/music-for-all/music-for-all-application/merges","archive_url":"https://api.github.com/repos/music-for-all/music-for-all-application/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/music-for-all/music-for-all-application/downloads","issues_url":"https://api.github.com/repos/music-for-all/music-for-all-application/issues{/number}","pulls_url":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls{/number}","milestones_url":"https://api.github.com/repos/music-for-all/music-for-all-application/milestones{/number}","notifications_url":"https://api.github.com/repos/music-for-all/music-for-all-application/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/music-for-all/music-for-all-application/labels{/name}","releases_url":"https://api.github.com/repos/music-for-all/music-for-all-application/releases{/id}","deployments_url":"https://api.github.com/repos/music-for-all/music-for-all-application/deployments","created_at":"2016-06-07T07:13:41Z","updated_at":"2016-08-13T09:33:55Z","pushed_at":"2016-08-25T15:07:18Z","git_url":"git://github.com/music-for-all/music-for-all-application.git","ssh_url":"git@github.com:music-for-all/music-for-all-application.git","clone_url":"https://github.com/music-for-all/music-for-all-application.git","svn_url":"https://github.com/music-for-all/music-for-all-application","homepage":null,"size":20139,"stargazers_count":3,"watchers_count":3,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":4,"forks":1,"open_issues":4,"watchers":3,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68"},"html":{"href":"https://github.com/music-for-all/music-for-all-application/pull/68"},"issue":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/68"},"comments":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/issues/68/comments"},"review_comments":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68/comments"},"review_comment":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/pulls/68/commits"},"statuses":{"href":"https://api.github.com/repos/music-for-all/music-for-all-application/statuses/43a483d4bb594b5a7e3dd3e30c5bc122edf0b91e"}}}}
{"actor":{"display_login":"codacy-bot"}}