{"action":"created","comment":{"url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/comments/98156444","pull_request_review_id":18789640,"id":98156444,"diff_hunk":"@@ -68,4 +123,65 @@ public void insertFeedback(InsertFeedbackRequest request) throws Exception {\n         feedback.comment = feedbackDto.comment;\n         return getAllFeedback();\n     }\n+\n+    private String createTimestamp() {\n+        ZonedDateTime helsinkiNow = ZonedDateTime.now(HELSINKI_ZONE_ID);\n+        return helsinkiNow.format(TIMESTAMP_FORMATTER);\n+    }\n+\n+    private String getState(InsertFeedbackRequest request) {\n+        return request.metadata.findValue(\"state\").textValue();\n+    }\n+\n+    private String getFaculty(InsertFeedbackRequest request) {\n+        JsonNode facultyNode = request.metadata.findValue(\"faculty\");\n+        return facultyNode == null ? null : facultyNode.textValue();\n+    }\n+\n+    private String getUserAgent(InsertFeedbackRequest request) {\n+        return request.metadata.findValue(\"userAgent\").textValue();\n+    }\n+\n+    private Locale getLocale(InsertFeedbackRequest request) {\n+        JsonNode langNode = request.metadata.findValue(\"lang\");\n+        String langCode = langNode == null ? \"fi\" : langNode.textValue();\n+        return CODES_TO_LOCALES.get(langCode);\n+    }\n+\n+    private String buildMessageBody(String content,\n+                                    String timestamp,\n+                                    String faculty,\n+                                    String state,\n+                                    String userAgent,\n+                                    Locale locale) {\n+        String timestampLine = getTimestampLine(timestamp, locale);\n+        String stateLine = getStateLine(state, locale);\n+        String userAgentLine = getUserAgentLine(userAgent, locale);\n+        if (faculty == null) {\n+            return String.join(\"\\n\", content, \"\", timestampLine, stateLine, userAgentLine);","path":"app/src/main/java/fi/helsinki/opintoni/service/FeedbackService.java","position":147,"original_position":147,"commit_id":"477f8cf1457148261b11441ff4cff88d321f714d","original_commit_id":"477f8cf1457148261b11441ff4cff88d321f714d","user":{"login":"greygriffin","id":4215847,"avatar_url":"https://avatars.githubusercontent.com/u/4215847?v=3","gravatar_id":"","url":"https://api.github.com/users/greygriffin","html_url":"https://github.com/greygriffin","followers_url":"https://api.github.com/users/greygriffin/followers","following_url":"https://api.github.com/users/greygriffin/following{/other_user}","gists_url":"https://api.github.com/users/greygriffin/gists{/gist_id}","starred_url":"https://api.github.com/users/greygriffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greygriffin/subscriptions","organizations_url":"https://api.github.com/users/greygriffin/orgs","repos_url":"https://api.github.com/users/greygriffin/repos","events_url":"https://api.github.com/users/greygriffin/events{/privacy}","received_events_url":"https://api.github.com/users/greygriffin/received_events","type":"User","site_admin":false},"body":"Ehkä melkein. Mutta ei olisi yhtään selkeämpi.","created_at":"2017-01-27T07:51:34Z","updated_at":"2017-01-27T07:51:34Z","html_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107#discussion_r98156444","pull_request_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107","_links":{"self":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/comments/98156444"},"html":{"href":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107#discussion_r98156444"},"pull_request":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107"}}},"pull_request":{"url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107","id":103298753,"html_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107","diff_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107.diff","patch_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107.patch","issue_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/107","number":107,"state":"open","locked":false,"title":"Oo 811 direct feedback to efecte","user":{"login":"greygriffin","id":4215847,"avatar_url":"https://avatars.githubusercontent.com/u/4215847?v=3","gravatar_id":"","url":"https://api.github.com/users/greygriffin","html_url":"https://github.com/greygriffin","followers_url":"https://api.github.com/users/greygriffin/followers","following_url":"https://api.github.com/users/greygriffin/following{/other_user}","gists_url":"https://api.github.com/users/greygriffin/gists{/gist_id}","starred_url":"https://api.github.com/users/greygriffin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/greygriffin/subscriptions","organizations_url":"https://api.github.com/users/greygriffin/orgs","repos_url":"https://api.github.com/users/greygriffin/repos","events_url":"https://api.github.com/users/greygriffin/events{/privacy}","received_events_url":"https://api.github.com/users/greygriffin/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-01-26T12:29:41Z","updated_at":"2017-01-27T07:51:34Z","closed_at":null,"merged_at":null,"merge_commit_sha":"8f6f05c5038133ff030c382f2cfaa2f1af78ee9e","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107/commits","review_comments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107/comments","review_comment_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/comments{/number}","comments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/107/comments","statuses_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/statuses/477f8cf1457148261b11441ff4cff88d321f714d","head":{"label":"UH-StudentServices:oo-811-direct-feedback-to-efecte","ref":"oo-811-direct-feedback-to-efecte","sha":"477f8cf1457148261b11441ff4cff88d321f714d","user":{"login":"UH-StudentServices","id":11271527,"avatar_url":"https://avatars.githubusercontent.com/u/11271527?v=3","gravatar_id":"","url":"https://api.github.com/users/UH-StudentServices","html_url":"https://github.com/UH-StudentServices","followers_url":"https://api.github.com/users/UH-StudentServices/followers","following_url":"https://api.github.com/users/UH-StudentServices/following{/other_user}","gists_url":"https://api.github.com/users/UH-StudentServices/gists{/gist_id}","starred_url":"https://api.github.com/users/UH-StudentServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UH-StudentServices/subscriptions","organizations_url":"https://api.github.com/users/UH-StudentServices/orgs","repos_url":"https://api.github.com/users/UH-StudentServices/repos","events_url":"https://api.github.com/users/UH-StudentServices/events{/privacy}","received_events_url":"https://api.github.com/users/UH-StudentServices/received_events","type":"Organization","site_admin":false},"repo":{"id":46273704,"name":"mystudies-myteaching-backend","full_name":"UH-StudentServices/mystudies-myteaching-backend","owner":{"login":"UH-StudentServices","id":11271527,"avatar_url":"https://avatars.githubusercontent.com/u/11271527?v=3","gravatar_id":"","url":"https://api.github.com/users/UH-StudentServices","html_url":"https://github.com/UH-StudentServices","followers_url":"https://api.github.com/users/UH-StudentServices/followers","following_url":"https://api.github.com/users/UH-StudentServices/following{/other_user}","gists_url":"https://api.github.com/users/UH-StudentServices/gists{/gist_id}","starred_url":"https://api.github.com/users/UH-StudentServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UH-StudentServices/subscriptions","organizations_url":"https://api.github.com/users/UH-StudentServices/orgs","repos_url":"https://api.github.com/users/UH-StudentServices/repos","events_url":"https://api.github.com/users/UH-StudentServices/events{/privacy}","received_events_url":"https://api.github.com/users/UH-StudentServices/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend","description":null,"fork":false,"url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend","forks_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/forks","keys_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/teams","hooks_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/hooks","issue_events_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/events{/number}","events_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/events","assignees_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/assignees{/user}","branches_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/branches{/branch}","tags_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/tags","blobs_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/languages","stargazers_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/stargazers","contributors_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/contributors","subscribers_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/subscribers","subscription_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/subscription","commits_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/contents/{+path}","compare_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/merges","archive_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/downloads","issues_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues{/number}","pulls_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/labels{/name}","releases_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/releases{/id}","deployments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/deployments","created_at":"2015-11-16T12:38:03Z","updated_at":"2016-10-25T05:30:51Z","pushed_at":"2017-01-26T16:55:11Z","git_url":"git://github.com/UH-StudentServices/mystudies-myteaching-backend.git","ssh_url":"git@github.com:UH-StudentServices/mystudies-myteaching-backend.git","clone_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend.git","svn_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend","homepage":null,"size":5346,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"develop"}},"base":{"label":"UH-StudentServices:develop","ref":"develop","sha":"1775fe143e6d66fa16463ddd399769f98fc23e29","user":{"login":"UH-StudentServices","id":11271527,"avatar_url":"https://avatars.githubusercontent.com/u/11271527?v=3","gravatar_id":"","url":"https://api.github.com/users/UH-StudentServices","html_url":"https://github.com/UH-StudentServices","followers_url":"https://api.github.com/users/UH-StudentServices/followers","following_url":"https://api.github.com/users/UH-StudentServices/following{/other_user}","gists_url":"https://api.github.com/users/UH-StudentServices/gists{/gist_id}","starred_url":"https://api.github.com/users/UH-StudentServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UH-StudentServices/subscriptions","organizations_url":"https://api.github.com/users/UH-StudentServices/orgs","repos_url":"https://api.github.com/users/UH-StudentServices/repos","events_url":"https://api.github.com/users/UH-StudentServices/events{/privacy}","received_events_url":"https://api.github.com/users/UH-StudentServices/received_events","type":"Organization","site_admin":false},"repo":{"id":46273704,"name":"mystudies-myteaching-backend","full_name":"UH-StudentServices/mystudies-myteaching-backend","owner":{"login":"UH-StudentServices","id":11271527,"avatar_url":"https://avatars.githubusercontent.com/u/11271527?v=3","gravatar_id":"","url":"https://api.github.com/users/UH-StudentServices","html_url":"https://github.com/UH-StudentServices","followers_url":"https://api.github.com/users/UH-StudentServices/followers","following_url":"https://api.github.com/users/UH-StudentServices/following{/other_user}","gists_url":"https://api.github.com/users/UH-StudentServices/gists{/gist_id}","starred_url":"https://api.github.com/users/UH-StudentServices/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/UH-StudentServices/subscriptions","organizations_url":"https://api.github.com/users/UH-StudentServices/orgs","repos_url":"https://api.github.com/users/UH-StudentServices/repos","events_url":"https://api.github.com/users/UH-StudentServices/events{/privacy}","received_events_url":"https://api.github.com/users/UH-StudentServices/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend","description":null,"fork":false,"url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend","forks_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/forks","keys_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/keys{/key_id}","collaborators_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/teams","hooks_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/hooks","issue_events_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/events{/number}","events_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/events","assignees_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/assignees{/user}","branches_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/branches{/branch}","tags_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/tags","blobs_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/refs{/sha}","trees_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/trees{/sha}","statuses_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/statuses/{sha}","languages_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/languages","stargazers_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/stargazers","contributors_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/contributors","subscribers_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/subscribers","subscription_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/subscription","commits_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/commits{/sha}","git_commits_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/git/commits{/sha}","comments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/comments{/number}","issue_comment_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/comments{/number}","contents_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/contents/{+path}","compare_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/compare/{base}...{head}","merges_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/merges","archive_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/downloads","issues_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues{/number}","pulls_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls{/number}","milestones_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/milestones{/number}","notifications_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/labels{/name}","releases_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/releases{/id}","deployments_url":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/deployments","created_at":"2015-11-16T12:38:03Z","updated_at":"2016-10-25T05:30:51Z","pushed_at":"2017-01-26T16:55:11Z","git_url":"git://github.com/UH-StudentServices/mystudies-myteaching-backend.git","ssh_url":"git@github.com:UH-StudentServices/mystudies-myteaching-backend.git","clone_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend.git","svn_url":"https://github.com/UH-StudentServices/mystudies-myteaching-backend","homepage":null,"size":5346,"stargazers_count":2,"watchers_count":2,"language":"Java","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":2,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107"},"html":{"href":"https://github.com/UH-StudentServices/mystudies-myteaching-backend/pull/107"},"issue":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/107"},"comments":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/issues/107/comments"},"review_comments":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107/comments"},"review_comment":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/pulls/107/commits"},"statuses":{"href":"https://api.github.com/repos/UH-StudentServices/mystudies-myteaching-backend/statuses/477f8cf1457148261b11441ff4cff88d321f714d"}}}}
{"actor":{"display_login":"greygriffin"}}