{"action":"created","comment":{"url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/comments/46418777","id":46418777,"diff_hunk":"@@ -1,7 +1,22 @@\n class PageCommentsController < CommentsController\n+  include SlackNotifier\n+\n+  after_action :notify_mentions, only: :create\n+\n   protected\n \n   def show_path(comment)\n     page_path(path: comment.page.path)\n   end\n+\n+  private\n+\n+  def notify_mentions\n+    usernames = @comment.content.scan(MENTION_USER_REGEX).map { |mention| mention[0] }\n+    mention_users = usernames.map { |username| User.find_by(nickname: username) }.compact\n+    mention_users.each do |mention_user|\n+      message = \"New mention on #{@comment.page.title} by #{@comment.user.nickname} #{page_url(@comment.page)}\\n#{@comment.content}\"","path":"app/controllers/page_comments_controller.rb","position":18,"original_position":18,"commit_id":"d749852683efb9588b2a0411bff28e6ce47b2ce0","original_commit_id":"d749852683efb9588b2a0411bff28e6ce47b2ce0","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [132/128]","created_at":"2015-12-02T14:20:15Z","updated_at":"2015-12-02T14:20:15Z","html_url":"https://github.com/sfc-rg/rg-portal/pull/102#discussion_r46418777","pull_request_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102","_links":{"self":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/comments/46418777"},"html":{"href":"https://github.com/sfc-rg/rg-portal/pull/102#discussion_r46418777"},"pull_request":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102"}}},"pull_request":{"url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102","id":52400898,"html_url":"https://github.com/sfc-rg/rg-portal/pull/102","diff_url":"https://github.com/sfc-rg/rg-portal/pull/102.diff","patch_url":"https://github.com/sfc-rg/rg-portal/pull/102.patch","issue_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/102","number":102,"state":"open","locked":false,"title":"Slack notification","user":{"login":"miyukki","id":720609,"avatar_url":"https://avatars.githubusercontent.com/u/720609?v=3","gravatar_id":"","url":"https://api.github.com/users/miyukki","html_url":"https://github.com/miyukki","followers_url":"https://api.github.com/users/miyukki/followers","following_url":"https://api.github.com/users/miyukki/following{/other_user}","gists_url":"https://api.github.com/users/miyukki/gists{/gist_id}","starred_url":"https://api.github.com/users/miyukki/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miyukki/subscriptions","organizations_url":"https://api.github.com/users/miyukki/orgs","repos_url":"https://api.github.com/users/miyukki/repos","events_url":"https://api.github.com/users/miyukki/events{/privacy}","received_events_url":"https://api.github.com/users/miyukki/received_events","type":"User","site_admin":false},"body":"To close #39 ","created_at":"2015-12-02T14:20:11Z","updated_at":"2015-12-02T14:20:16Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a5a9264a16df7dacfb675757ac4e28074b943c87","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102/commits","review_comments_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102/comments","review_comment_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/102/comments","statuses_url":"https://api.github.com/repos/sfc-rg/rg-portal/statuses/d749852683efb9588b2a0411bff28e6ce47b2ce0","head":{"label":"sfc-rg:feature/store-slack-token","ref":"feature/store-slack-token","sha":"d749852683efb9588b2a0411bff28e6ce47b2ce0","user":{"login":"sfc-rg","id":13977529,"avatar_url":"https://avatars.githubusercontent.com/u/13977529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfc-rg","html_url":"https://github.com/sfc-rg","followers_url":"https://api.github.com/users/sfc-rg/followers","following_url":"https://api.github.com/users/sfc-rg/following{/other_user}","gists_url":"https://api.github.com/users/sfc-rg/gists{/gist_id}","starred_url":"https://api.github.com/users/sfc-rg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfc-rg/subscriptions","organizations_url":"https://api.github.com/users/sfc-rg/orgs","repos_url":"https://api.github.com/users/sfc-rg/repos","events_url":"https://api.github.com/users/sfc-rg/events{/privacy}","received_events_url":"https://api.github.com/users/sfc-rg/received_events","type":"Organization","site_admin":false},"repo":{"id":37115426,"name":"rg-portal","full_name":"sfc-rg/rg-portal","owner":{"login":"sfc-rg","id":13977529,"avatar_url":"https://avatars.githubusercontent.com/u/13977529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfc-rg","html_url":"https://github.com/sfc-rg","followers_url":"https://api.github.com/users/sfc-rg/followers","following_url":"https://api.github.com/users/sfc-rg/following{/other_user}","gists_url":"https://api.github.com/users/sfc-rg/gists{/gist_id}","starred_url":"https://api.github.com/users/sfc-rg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfc-rg/subscriptions","organizations_url":"https://api.github.com/users/sfc-rg/orgs","repos_url":"https://api.github.com/users/sfc-rg/repos","events_url":"https://api.github.com/users/sfc-rg/events{/privacy}","received_events_url":"https://api.github.com/users/sfc-rg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sfc-rg/rg-portal","description":"Internal Website for Keio Univ. Technology joint research groups","fork":false,"url":"https://api.github.com/repos/sfc-rg/rg-portal","forks_url":"https://api.github.com/repos/sfc-rg/rg-portal/forks","keys_url":"https://api.github.com/repos/sfc-rg/rg-portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sfc-rg/rg-portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sfc-rg/rg-portal/teams","hooks_url":"https://api.github.com/repos/sfc-rg/rg-portal/hooks","issue_events_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/events{/number}","events_url":"https://api.github.com/repos/sfc-rg/rg-portal/events","assignees_url":"https://api.github.com/repos/sfc-rg/rg-portal/assignees{/user}","branches_url":"https://api.github.com/repos/sfc-rg/rg-portal/branches{/branch}","tags_url":"https://api.github.com/repos/sfc-rg/rg-portal/tags","blobs_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sfc-rg/rg-portal/statuses/{sha}","languages_url":"https://api.github.com/repos/sfc-rg/rg-portal/languages","stargazers_url":"https://api.github.com/repos/sfc-rg/rg-portal/stargazers","contributors_url":"https://api.github.com/repos/sfc-rg/rg-portal/contributors","subscribers_url":"https://api.github.com/repos/sfc-rg/rg-portal/subscribers","subscription_url":"https://api.github.com/repos/sfc-rg/rg-portal/subscription","commits_url":"https://api.github.com/repos/sfc-rg/rg-portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/sfc-rg/rg-portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/sfc-rg/rg-portal/contents/{+path}","compare_url":"https://api.github.com/repos/sfc-rg/rg-portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sfc-rg/rg-portal/merges","archive_url":"https://api.github.com/repos/sfc-rg/rg-portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sfc-rg/rg-portal/downloads","issues_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues{/number}","pulls_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls{/number}","milestones_url":"https://api.github.com/repos/sfc-rg/rg-portal/milestones{/number}","notifications_url":"https://api.github.com/repos/sfc-rg/rg-portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sfc-rg/rg-portal/labels{/name}","releases_url":"https://api.github.com/repos/sfc-rg/rg-portal/releases{/id}","created_at":"2015-06-09T06:49:45Z","updated_at":"2015-09-30T08:29:03Z","pushed_at":"2015-12-02T14:20:11Z","git_url":"git://github.com/sfc-rg/rg-portal.git","ssh_url":"git@github.com:sfc-rg/rg-portal.git","clone_url":"https://github.com/sfc-rg/rg-portal.git","svn_url":"https://github.com/sfc-rg/rg-portal","homepage":"http://portal.gw.sfc.wide.ad.jp/","size":334,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":2,"default_branch":"master"}},"base":{"label":"sfc-rg:master","ref":"master","sha":"70b4f02387979eecf73e10333739911b3e6b1a90","user":{"login":"sfc-rg","id":13977529,"avatar_url":"https://avatars.githubusercontent.com/u/13977529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfc-rg","html_url":"https://github.com/sfc-rg","followers_url":"https://api.github.com/users/sfc-rg/followers","following_url":"https://api.github.com/users/sfc-rg/following{/other_user}","gists_url":"https://api.github.com/users/sfc-rg/gists{/gist_id}","starred_url":"https://api.github.com/users/sfc-rg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfc-rg/subscriptions","organizations_url":"https://api.github.com/users/sfc-rg/orgs","repos_url":"https://api.github.com/users/sfc-rg/repos","events_url":"https://api.github.com/users/sfc-rg/events{/privacy}","received_events_url":"https://api.github.com/users/sfc-rg/received_events","type":"Organization","site_admin":false},"repo":{"id":37115426,"name":"rg-portal","full_name":"sfc-rg/rg-portal","owner":{"login":"sfc-rg","id":13977529,"avatar_url":"https://avatars.githubusercontent.com/u/13977529?v=3","gravatar_id":"","url":"https://api.github.com/users/sfc-rg","html_url":"https://github.com/sfc-rg","followers_url":"https://api.github.com/users/sfc-rg/followers","following_url":"https://api.github.com/users/sfc-rg/following{/other_user}","gists_url":"https://api.github.com/users/sfc-rg/gists{/gist_id}","starred_url":"https://api.github.com/users/sfc-rg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sfc-rg/subscriptions","organizations_url":"https://api.github.com/users/sfc-rg/orgs","repos_url":"https://api.github.com/users/sfc-rg/repos","events_url":"https://api.github.com/users/sfc-rg/events{/privacy}","received_events_url":"https://api.github.com/users/sfc-rg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/sfc-rg/rg-portal","description":"Internal Website for Keio Univ. Technology joint research groups","fork":false,"url":"https://api.github.com/repos/sfc-rg/rg-portal","forks_url":"https://api.github.com/repos/sfc-rg/rg-portal/forks","keys_url":"https://api.github.com/repos/sfc-rg/rg-portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sfc-rg/rg-portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sfc-rg/rg-portal/teams","hooks_url":"https://api.github.com/repos/sfc-rg/rg-portal/hooks","issue_events_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/events{/number}","events_url":"https://api.github.com/repos/sfc-rg/rg-portal/events","assignees_url":"https://api.github.com/repos/sfc-rg/rg-portal/assignees{/user}","branches_url":"https://api.github.com/repos/sfc-rg/rg-portal/branches{/branch}","tags_url":"https://api.github.com/repos/sfc-rg/rg-portal/tags","blobs_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sfc-rg/rg-portal/statuses/{sha}","languages_url":"https://api.github.com/repos/sfc-rg/rg-portal/languages","stargazers_url":"https://api.github.com/repos/sfc-rg/rg-portal/stargazers","contributors_url":"https://api.github.com/repos/sfc-rg/rg-portal/contributors","subscribers_url":"https://api.github.com/repos/sfc-rg/rg-portal/subscribers","subscription_url":"https://api.github.com/repos/sfc-rg/rg-portal/subscription","commits_url":"https://api.github.com/repos/sfc-rg/rg-portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/sfc-rg/rg-portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/sfc-rg/rg-portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/sfc-rg/rg-portal/contents/{+path}","compare_url":"https://api.github.com/repos/sfc-rg/rg-portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sfc-rg/rg-portal/merges","archive_url":"https://api.github.com/repos/sfc-rg/rg-portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sfc-rg/rg-portal/downloads","issues_url":"https://api.github.com/repos/sfc-rg/rg-portal/issues{/number}","pulls_url":"https://api.github.com/repos/sfc-rg/rg-portal/pulls{/number}","milestones_url":"https://api.github.com/repos/sfc-rg/rg-portal/milestones{/number}","notifications_url":"https://api.github.com/repos/sfc-rg/rg-portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sfc-rg/rg-portal/labels{/name}","releases_url":"https://api.github.com/repos/sfc-rg/rg-portal/releases{/id}","created_at":"2015-06-09T06:49:45Z","updated_at":"2015-09-30T08:29:03Z","pushed_at":"2015-12-02T14:20:11Z","git_url":"git://github.com/sfc-rg/rg-portal.git","ssh_url":"git@github.com:sfc-rg/rg-portal.git","clone_url":"https://github.com/sfc-rg/rg-portal.git","svn_url":"https://github.com/sfc-rg/rg-portal","homepage":"http://portal.gw.sfc.wide.ad.jp/","size":334,"stargazers_count":2,"watchers_count":2,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":15,"forks":1,"open_issues":15,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102"},"html":{"href":"https://github.com/sfc-rg/rg-portal/pull/102"},"issue":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/issues/102"},"comments":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/issues/102/comments"},"review_comments":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102/comments"},"review_comment":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/pulls/102/commits"},"statuses":{"href":"https://api.github.com/repos/sfc-rg/rg-portal/statuses/d749852683efb9588b2a0411bff28e6ce47b2ce0"}}}}