{"action":"created","comment":{"url":"https://api.github.com/repos/tbilous/thinknetica/pulls/comments/90397455","pull_request_review_id":10915009,"id":90397455,"diff_hunk":"@@ -1,17 +1,62 @@\n class User < ApplicationRecord\n   # Include default devise modules. Others available are:\n   # :confirmable, :lockable, :recoverable, :timeoutable and :omniauthable\n-  devise :database_authenticatable, :registerable,\n-         :rememberable, :trackable, :validatable\n+\n+  devise :database_authenticatable, :registerable, :confirmable,\n+         :rememberable, :trackable, :validatable, :omniauthable,\n+         omniauth_providers: [:facebook, :twitter, :github]\n \n   has_many :questions, dependent: :destroy\n   has_many :answers\n   has_many :votes\n+  has_many :authorizations, dependent: :destroy\n \n-  validates :name, length: 5..128\n+  validates :name, length: 3..20\n   validates :email, length: 5..128\n \n   def owner_of?(object)\n     id == object.user_id\n   end\n+\n+  def self.find_for_oauth(auth)\n+    return nil if auth.blank? || auth.provider.blank? || auth.uid.blank?\n+\n+    authorization = Authorization.find_by(provider: auth.provider, uid: auth.uid.to_s)\n+\n+    return authorization.user if authorization\n+\n+    user = nil\n+    confirmation_required = false\n+\n+    if auth.info[:email].present?\n+      email = auth.info[:email]\n+      user = User.find_by_email(email)\n+    else\n+      email = \"#{SecureRandom.hex(8)}@example.org\"\n+      confirmation_required = true\n+    end\n+\n+    unless user\n+      name = if auth[:provider] == 'github'","path":"app/models/user.rb","position":43,"original_position":43,"commit_id":"d30b3d9dddc3f9dbd5676367ae05079b7f3a38d7","original_commit_id":"6d13158816664ec4180c9ca2327b773b7e4f725c","user":{"login":"vkurennov","id":968537,"avatar_url":"https://avatars.githubusercontent.com/u/968537?v=3","gravatar_id":"","url":"https://api.github.com/users/vkurennov","html_url":"https://github.com/vkurennov","followers_url":"https://api.github.com/users/vkurennov/followers","following_url":"https://api.github.com/users/vkurennov/following{/other_user}","gists_url":"https://api.github.com/users/vkurennov/gists{/gist_id}","starred_url":"https://api.github.com/users/vkurennov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vkurennov/subscriptions","organizations_url":"https://api.github.com/users/vkurennov/orgs","repos_url":"https://api.github.com/users/vkurennov/repos","events_url":"https://api.github.com/users/vkurennov/events{/privacy}","received_events_url":"https://api.github.com/users/vkurennov/received_events","type":"User","site_admin":false},"body":"ок","created_at":"2016-12-01T07:53:33Z","updated_at":"2016-12-01T07:53:33Z","html_url":"https://github.com/tbilous/thinknetica/pull/12#discussion_r90397455","pull_request_url":"https://api.github.com/repos/tbilous/thinknetica/pulls/12","_links":{"self":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/comments/90397455"},"html":{"href":"https://github.com/tbilous/thinknetica/pull/12#discussion_r90397455"},"pull_request":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/tbilous/thinknetica/pulls/12","id":95900431,"html_url":"https://github.com/tbilous/thinknetica/pull/12","diff_url":"https://github.com/tbilous/thinknetica/pull/12.diff","patch_url":"https://github.com/tbilous/thinknetica/pull/12.patch","issue_url":"https://api.github.com/repos/tbilous/thinknetica/issues/12","number":12,"state":"open","locked":false,"title":"Part12 omniauth","user":{"login":"tbilous","id":10371325,"avatar_url":"https://avatars.githubusercontent.com/u/10371325?v=3","gravatar_id":"","url":"https://api.github.com/users/tbilous","html_url":"https://github.com/tbilous","followers_url":"https://api.github.com/users/tbilous/followers","following_url":"https://api.github.com/users/tbilous/following{/other_user}","gists_url":"https://api.github.com/users/tbilous/gists{/gist_id}","starred_url":"https://api.github.com/users/tbilous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbilous/subscriptions","organizations_url":"https://api.github.com/users/tbilous/orgs","repos_url":"https://api.github.com/users/tbilous/repos","events_url":"https://api.github.com/users/tbilous/events{/privacy}","received_events_url":"https://api.github.com/users/tbilous/received_events","type":"User","site_admin":false},"body":"Жду замечаний.\r\nСпасибо. ","created_at":"2016-11-30T14:24:11Z","updated_at":"2016-12-01T07:53:33Z","closed_at":null,"merged_at":null,"merge_commit_sha":"5d035f4e2c3205b3df16692f141617cb53984956","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/tbilous/thinknetica/pulls/12/commits","review_comments_url":"https://api.github.com/repos/tbilous/thinknetica/pulls/12/comments","review_comment_url":"https://api.github.com/repos/tbilous/thinknetica/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tbilous/thinknetica/issues/12/comments","statuses_url":"https://api.github.com/repos/tbilous/thinknetica/statuses/d30b3d9dddc3f9dbd5676367ae05079b7f3a38d7","head":{"label":"tbilous:part12_omniauth","ref":"part12_omniauth","sha":"d30b3d9dddc3f9dbd5676367ae05079b7f3a38d7","user":{"login":"tbilous","id":10371325,"avatar_url":"https://avatars.githubusercontent.com/u/10371325?v=3","gravatar_id":"","url":"https://api.github.com/users/tbilous","html_url":"https://github.com/tbilous","followers_url":"https://api.github.com/users/tbilous/followers","following_url":"https://api.github.com/users/tbilous/following{/other_user}","gists_url":"https://api.github.com/users/tbilous/gists{/gist_id}","starred_url":"https://api.github.com/users/tbilous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbilous/subscriptions","organizations_url":"https://api.github.com/users/tbilous/orgs","repos_url":"https://api.github.com/users/tbilous/repos","events_url":"https://api.github.com/users/tbilous/events{/privacy}","received_events_url":"https://api.github.com/users/tbilous/received_events","type":"User","site_admin":false},"repo":{"id":70559580,"name":"thinknetica","full_name":"tbilous/thinknetica","owner":{"login":"tbilous","id":10371325,"avatar_url":"https://avatars.githubusercontent.com/u/10371325?v=3","gravatar_id":"","url":"https://api.github.com/users/tbilous","html_url":"https://github.com/tbilous","followers_url":"https://api.github.com/users/tbilous/followers","following_url":"https://api.github.com/users/tbilous/following{/other_user}","gists_url":"https://api.github.com/users/tbilous/gists{/gist_id}","starred_url":"https://api.github.com/users/tbilous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbilous/subscriptions","organizations_url":"https://api.github.com/users/tbilous/orgs","repos_url":"https://api.github.com/users/tbilous/repos","events_url":"https://api.github.com/users/tbilous/events{/privacy}","received_events_url":"https://api.github.com/users/tbilous/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tbilous/thinknetica","description":null,"fork":false,"url":"https://api.github.com/repos/tbilous/thinknetica","forks_url":"https://api.github.com/repos/tbilous/thinknetica/forks","keys_url":"https://api.github.com/repos/tbilous/thinknetica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tbilous/thinknetica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tbilous/thinknetica/teams","hooks_url":"https://api.github.com/repos/tbilous/thinknetica/hooks","issue_events_url":"https://api.github.com/repos/tbilous/thinknetica/issues/events{/number}","events_url":"https://api.github.com/repos/tbilous/thinknetica/events","assignees_url":"https://api.github.com/repos/tbilous/thinknetica/assignees{/user}","branches_url":"https://api.github.com/repos/tbilous/thinknetica/branches{/branch}","tags_url":"https://api.github.com/repos/tbilous/thinknetica/tags","blobs_url":"https://api.github.com/repos/tbilous/thinknetica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tbilous/thinknetica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tbilous/thinknetica/git/refs{/sha}","trees_url":"https://api.github.com/repos/tbilous/thinknetica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tbilous/thinknetica/statuses/{sha}","languages_url":"https://api.github.com/repos/tbilous/thinknetica/languages","stargazers_url":"https://api.github.com/repos/tbilous/thinknetica/stargazers","contributors_url":"https://api.github.com/repos/tbilous/thinknetica/contributors","subscribers_url":"https://api.github.com/repos/tbilous/thinknetica/subscribers","subscription_url":"https://api.github.com/repos/tbilous/thinknetica/subscription","commits_url":"https://api.github.com/repos/tbilous/thinknetica/commits{/sha}","git_commits_url":"https://api.github.com/repos/tbilous/thinknetica/git/commits{/sha}","comments_url":"https://api.github.com/repos/tbilous/thinknetica/comments{/number}","issue_comment_url":"https://api.github.com/repos/tbilous/thinknetica/issues/comments{/number}","contents_url":"https://api.github.com/repos/tbilous/thinknetica/contents/{+path}","compare_url":"https://api.github.com/repos/tbilous/thinknetica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tbilous/thinknetica/merges","archive_url":"https://api.github.com/repos/tbilous/thinknetica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tbilous/thinknetica/downloads","issues_url":"https://api.github.com/repos/tbilous/thinknetica/issues{/number}","pulls_url":"https://api.github.com/repos/tbilous/thinknetica/pulls{/number}","milestones_url":"https://api.github.com/repos/tbilous/thinknetica/milestones{/number}","notifications_url":"https://api.github.com/repos/tbilous/thinknetica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tbilous/thinknetica/labels{/name}","releases_url":"https://api.github.com/repos/tbilous/thinknetica/releases{/id}","deployments_url":"https://api.github.com/repos/tbilous/thinknetica/deployments","created_at":"2016-10-11T05:36:41Z","updated_at":"2016-10-11T05:38:11Z","pushed_at":"2016-11-30T19:56:16Z","git_url":"git://github.com/tbilous/thinknetica.git","ssh_url":"git@github.com:tbilous/thinknetica.git","clone_url":"https://github.com/tbilous/thinknetica.git","svn_url":"https://github.com/tbilous/thinknetica","homepage":null,"size":509,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":0,"default_branch":"master"}},"base":{"label":"tbilous:master","ref":"master","sha":"58e3d28f9438771a512699e2b539c70b21f345c6","user":{"login":"tbilous","id":10371325,"avatar_url":"https://avatars.githubusercontent.com/u/10371325?v=3","gravatar_id":"","url":"https://api.github.com/users/tbilous","html_url":"https://github.com/tbilous","followers_url":"https://api.github.com/users/tbilous/followers","following_url":"https://api.github.com/users/tbilous/following{/other_user}","gists_url":"https://api.github.com/users/tbilous/gists{/gist_id}","starred_url":"https://api.github.com/users/tbilous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbilous/subscriptions","organizations_url":"https://api.github.com/users/tbilous/orgs","repos_url":"https://api.github.com/users/tbilous/repos","events_url":"https://api.github.com/users/tbilous/events{/privacy}","received_events_url":"https://api.github.com/users/tbilous/received_events","type":"User","site_admin":false},"repo":{"id":70559580,"name":"thinknetica","full_name":"tbilous/thinknetica","owner":{"login":"tbilous","id":10371325,"avatar_url":"https://avatars.githubusercontent.com/u/10371325?v=3","gravatar_id":"","url":"https://api.github.com/users/tbilous","html_url":"https://github.com/tbilous","followers_url":"https://api.github.com/users/tbilous/followers","following_url":"https://api.github.com/users/tbilous/following{/other_user}","gists_url":"https://api.github.com/users/tbilous/gists{/gist_id}","starred_url":"https://api.github.com/users/tbilous/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tbilous/subscriptions","organizations_url":"https://api.github.com/users/tbilous/orgs","repos_url":"https://api.github.com/users/tbilous/repos","events_url":"https://api.github.com/users/tbilous/events{/privacy}","received_events_url":"https://api.github.com/users/tbilous/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tbilous/thinknetica","description":null,"fork":false,"url":"https://api.github.com/repos/tbilous/thinknetica","forks_url":"https://api.github.com/repos/tbilous/thinknetica/forks","keys_url":"https://api.github.com/repos/tbilous/thinknetica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tbilous/thinknetica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tbilous/thinknetica/teams","hooks_url":"https://api.github.com/repos/tbilous/thinknetica/hooks","issue_events_url":"https://api.github.com/repos/tbilous/thinknetica/issues/events{/number}","events_url":"https://api.github.com/repos/tbilous/thinknetica/events","assignees_url":"https://api.github.com/repos/tbilous/thinknetica/assignees{/user}","branches_url":"https://api.github.com/repos/tbilous/thinknetica/branches{/branch}","tags_url":"https://api.github.com/repos/tbilous/thinknetica/tags","blobs_url":"https://api.github.com/repos/tbilous/thinknetica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tbilous/thinknetica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tbilous/thinknetica/git/refs{/sha}","trees_url":"https://api.github.com/repos/tbilous/thinknetica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tbilous/thinknetica/statuses/{sha}","languages_url":"https://api.github.com/repos/tbilous/thinknetica/languages","stargazers_url":"https://api.github.com/repos/tbilous/thinknetica/stargazers","contributors_url":"https://api.github.com/repos/tbilous/thinknetica/contributors","subscribers_url":"https://api.github.com/repos/tbilous/thinknetica/subscribers","subscription_url":"https://api.github.com/repos/tbilous/thinknetica/subscription","commits_url":"https://api.github.com/repos/tbilous/thinknetica/commits{/sha}","git_commits_url":"https://api.github.com/repos/tbilous/thinknetica/git/commits{/sha}","comments_url":"https://api.github.com/repos/tbilous/thinknetica/comments{/number}","issue_comment_url":"https://api.github.com/repos/tbilous/thinknetica/issues/comments{/number}","contents_url":"https://api.github.com/repos/tbilous/thinknetica/contents/{+path}","compare_url":"https://api.github.com/repos/tbilous/thinknetica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tbilous/thinknetica/merges","archive_url":"https://api.github.com/repos/tbilous/thinknetica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tbilous/thinknetica/downloads","issues_url":"https://api.github.com/repos/tbilous/thinknetica/issues{/number}","pulls_url":"https://api.github.com/repos/tbilous/thinknetica/pulls{/number}","milestones_url":"https://api.github.com/repos/tbilous/thinknetica/milestones{/number}","notifications_url":"https://api.github.com/repos/tbilous/thinknetica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tbilous/thinknetica/labels{/name}","releases_url":"https://api.github.com/repos/tbilous/thinknetica/releases{/id}","deployments_url":"https://api.github.com/repos/tbilous/thinknetica/deployments","created_at":"2016-10-11T05:36:41Z","updated_at":"2016-10-11T05:38:11Z","pushed_at":"2016-11-30T19:56:16Z","git_url":"git://github.com/tbilous/thinknetica.git","ssh_url":"git@github.com:tbilous/thinknetica.git","clone_url":"https://github.com/tbilous/thinknetica.git","svn_url":"https://github.com/tbilous/thinknetica","homepage":null,"size":509,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/12"},"html":{"href":"https://github.com/tbilous/thinknetica/pull/12"},"issue":{"href":"https://api.github.com/repos/tbilous/thinknetica/issues/12"},"comments":{"href":"https://api.github.com/repos/tbilous/thinknetica/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tbilous/thinknetica/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/tbilous/thinknetica/statuses/d30b3d9dddc3f9dbd5676367ae05079b7f3a38d7"}}}}
{"actor":{"display_login":"vkurennov"}}