GitHub PullRequestReviewCommentEvent at 2014-10-17 19:34:55
Repository: TrinityMarketplace
Actor: houndci
Payload: {"action":"created","comment":{"url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/comments/19038346","id":19038346,"diff_hunk":"@@ -1,10 +1,67 @@\n class User < ActiveRecord::Base\n   has_many :user_books, dependent: :destroy\n+\n+  TEMP_EMAIL_PREFIX = \"change@me\"\n+  TEMP_EMAIL_REGEX = /\\Achange@me/\n   # Include default devise modules. Others available are:\n   # :confirmable, :lockable, :timeoutable and :omniauthable\n   devise :database_authenticatable, :registerable,\n          :recoverable, :rememberable, :trackable,\n-         :validatable\n+         :validatable, :omniauthable\n+\n   validates_uniqueness_of :username\n+  validates_format_of :email, without: TEMP_EMAIL_REGEX, on: :update\n   mount_uploader :profile_photo, ProfilePhotoUploader\n+\n+  def self.find_for_oauth(auth, signed_in_resource = nil)\n+\n+    # Get the identity and user if they exist\n+    identity = Identity.find_for_oauth(auth)\n+\n+    # If a signed_in_resource is provided it always overrides the existing user\n+    # to prevent the identity being locked with accidentally created accounts.\n+    # Note that this may leave zombie accounts (with no associated identity) which\n+    # can be cleaned up at a later date.\n+    user = signed_in_resource ? signed_in_resource : identity.user\n+\n+    # Create the user if needed\n+    if user.nil?\n+\n+      # Get the existing user by email if the provider gives us a verified email.\n+      # If no verified email was provided we assign a temporary email and ask the\n+      # user to verify it on the next step via UsersController.finish_signup\n+      email_is_verified = auth.info.email && (auth.info.verified || auth.info.verified_email)\n+      email = auth.info.email if email_is_verified\n+      user = User.where(email: email).first if email\n+\n+      # Create the user if it's a new registration\n+      if user.nil?\n+        user = User.new(\n+          username: auth.info.nickname || auth.extra.raw_info.name,\n+          email: email ? email : \"#{TEMP_EMAIL_PREFIX}-#{auth.uid}-#{auth.provider}.com\",\n+          password: Devise.friendly_token[0,20],\n+          profile_photo: URI.parse(auth.info.image)\n+        )\n+        # user.skip_confirmation!\n+        user.save!\n+      end\n+    end\n+\n+    # Associate the identity with the user if needed\n+    if identity.user != user\n+      identity.user = user\n+      identity.save!\n+    end\n+    user\n+  end\n+\n+  def email_verified?\n+    self.email && self.email !~ TEMP_EMAIL_REGEX","path":"app/models/user.rb","position":60,"original_position":60,"commit_id":"b52f91dbb5a2731aa472fc3d4ce49fca1adc26f3","original_commit_id":"b52f91dbb5a2731aa472fc3d4ce49fca1adc26f3","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=2","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":"Redundant `self` detected.","created_at":"2014-10-17T19:34:55Z","updated_at":"2014-10-17T19:34:55Z","html_url":"https://github.com/manders9/TrinityMarketplace/pull/25#discussion_r19038346","pull_request_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25","_links":{"self":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/comments/19038346"},"html":{"href":"https://github.com/manders9/TrinityMarketplace/pull/25#discussion_r19038346"},"pull_request":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25"}}},"pull_request":{"url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25","id":22946377,"html_url":"https://github.com/manders9/TrinityMarketplace/pull/25","diff_url":"https://github.com/manders9/TrinityMarketplace/pull/25.diff","patch_url":"https://github.com/manders9/TrinityMarketplace/pull/25.patch","issue_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/25","number":25,"state":"open","locked":false,"title":"Add omniauth","user":{"login":"manders9","id":7970639,"avatar_url":"https://avatars.githubusercontent.com/u/7970639?v=2","gravatar_id":"","url":"https://api.github.com/users/manders9","html_url":"https://github.com/manders9","followers_url":"https://api.github.com/users/manders9/followers","following_url":"https://api.github.com/users/manders9/following{/other_user}","gists_url":"https://api.github.com/users/manders9/gists{/gist_id}","starred_url":"https://api.github.com/users/manders9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manders9/subscriptions","organizations_url":"https://api.github.com/users/manders9/orgs","repos_url":"https://api.github.com/users/manders9/repos","events_url":"https://api.github.com/users/manders9/events{/privacy}","received_events_url":"https://api.github.com/users/manders9/received_events","type":"User","site_admin":false},"body":"","created_at":"2014-10-17T19:16:23Z","updated_at":"2014-10-17T19:34:55Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25/commits","review_comments_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25/comments","review_comment_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/comments/{number}","comments_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/25/comments","statuses_url":"https://api.github.com/repos/manders9/TrinityMarketplace/statuses/b52f91dbb5a2731aa472fc3d4ce49fca1adc26f3","head":{"label":"manders9:add-omniauth","ref":"add-omniauth","sha":"b52f91dbb5a2731aa472fc3d4ce49fca1adc26f3","user":{"login":"manders9","id":7970639,"avatar_url":"https://avatars.githubusercontent.com/u/7970639?v=2","gravatar_id":"","url":"https://api.github.com/users/manders9","html_url":"https://github.com/manders9","followers_url":"https://api.github.com/users/manders9/followers","following_url":"https://api.github.com/users/manders9/following{/other_user}","gists_url":"https://api.github.com/users/manders9/gists{/gist_id}","starred_url":"https://api.github.com/users/manders9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manders9/subscriptions","organizations_url":"https://api.github.com/users/manders9/orgs","repos_url":"https://api.github.com/users/manders9/repos","events_url":"https://api.github.com/users/manders9/events{/privacy}","received_events_url":"https://api.github.com/users/manders9/received_events","type":"User","site_admin":false},"repo":{"id":25007544,"name":"TrinityMarketplace","full_name":"manders9/TrinityMarketplace","owner":{"login":"manders9","id":7970639,"avatar_url":"https://avatars.githubusercontent.com/u/7970639?v=2","gravatar_id":"","url":"https://api.github.com/users/manders9","html_url":"https://github.com/manders9","followers_url":"https://api.github.com/users/manders9/followers","following_url":"https://api.github.com/users/manders9/following{/other_user}","gists_url":"https://api.github.com/users/manders9/gists{/gist_id}","starred_url":"https://api.github.com/users/manders9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manders9/subscriptions","organizations_url":"https://api.github.com/users/manders9/orgs","repos_url":"https://api.github.com/users/manders9/repos","events_url":"https://api.github.com/users/manders9/events{/privacy}","received_events_url":"https://api.github.com/users/manders9/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manders9/TrinityMarketplace","description":"","fork":false,"url":"https://api.github.com/repos/manders9/TrinityMarketplace","forks_url":"https://api.github.com/repos/manders9/TrinityMarketplace/forks","keys_url":"https://api.github.com/repos/manders9/TrinityMarketplace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manders9/TrinityMarketplace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manders9/TrinityMarketplace/teams","hooks_url":"https://api.github.com/repos/manders9/TrinityMarketplace/hooks","issue_events_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/events{/number}","events_url":"https://api.github.com/repos/manders9/TrinityMarketplace/events","assignees_url":"https://api.github.com/repos/manders9/TrinityMarketplace/assignees{/user}","branches_url":"https://api.github.com/repos/manders9/TrinityMarketplace/branches{/branch}","tags_url":"https://api.github.com/repos/manders9/TrinityMarketplace/tags","blobs_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/refs{/sha}","trees_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manders9/TrinityMarketplace/statuses/{sha}","languages_url":"https://api.github.com/repos/manders9/TrinityMarketplace/languages","stargazers_url":"https://api.github.com/repos/manders9/TrinityMarketplace/stargazers","contributors_url":"https://api.github.com/repos/manders9/TrinityMarketplace/contributors","subscribers_url":"https://api.github.com/repos/manders9/TrinityMarketplace/subscribers","subscription_url":"https://api.github.com/repos/manders9/TrinityMarketplace/subscription","commits_url":"https://api.github.com/repos/manders9/TrinityMarketplace/commits{/sha}","git_commits_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/commits{/sha}","comments_url":"https://api.github.com/repos/manders9/TrinityMarketplace/comments{/number}","issue_comment_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/comments/{number}","contents_url":"https://api.github.com/repos/manders9/TrinityMarketplace/contents/{+path}","compare_url":"https://api.github.com/repos/manders9/TrinityMarketplace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manders9/TrinityMarketplace/merges","archive_url":"https://api.github.com/repos/manders9/TrinityMarketplace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manders9/TrinityMarketplace/downloads","issues_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues{/number}","pulls_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls{/number}","milestones_url":"https://api.github.com/repos/manders9/TrinityMarketplace/milestones{/number}","notifications_url":"https://api.github.com/repos/manders9/TrinityMarketplace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manders9/TrinityMarketplace/labels{/name}","releases_url":"https://api.github.com/repos/manders9/TrinityMarketplace/releases{/id}","created_at":"2014-10-09T20:36:54Z","updated_at":"2014-10-14T14:56:48Z","pushed_at":"2014-10-17T19:34:52Z","git_url":"git://github.com/manders9/TrinityMarketplace.git","ssh_url":"git@github.com:manders9/TrinityMarketplace.git","clone_url":"https://github.com/manders9/TrinityMarketplace.git","svn_url":"https://github.com/manders9/TrinityMarketplace","homepage":null,"size":1048,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"base":{"label":"manders9:master","ref":"master","sha":"0fd7b2e42141cce50772ffe82ebb414185ef97b1","user":{"login":"manders9","id":7970639,"avatar_url":"https://avatars.githubusercontent.com/u/7970639?v=2","gravatar_id":"","url":"https://api.github.com/users/manders9","html_url":"https://github.com/manders9","followers_url":"https://api.github.com/users/manders9/followers","following_url":"https://api.github.com/users/manders9/following{/other_user}","gists_url":"https://api.github.com/users/manders9/gists{/gist_id}","starred_url":"https://api.github.com/users/manders9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manders9/subscriptions","organizations_url":"https://api.github.com/users/manders9/orgs","repos_url":"https://api.github.com/users/manders9/repos","events_url":"https://api.github.com/users/manders9/events{/privacy}","received_events_url":"https://api.github.com/users/manders9/received_events","type":"User","site_admin":false},"repo":{"id":25007544,"name":"TrinityMarketplace","full_name":"manders9/TrinityMarketplace","owner":{"login":"manders9","id":7970639,"avatar_url":"https://avatars.githubusercontent.com/u/7970639?v=2","gravatar_id":"","url":"https://api.github.com/users/manders9","html_url":"https://github.com/manders9","followers_url":"https://api.github.com/users/manders9/followers","following_url":"https://api.github.com/users/manders9/following{/other_user}","gists_url":"https://api.github.com/users/manders9/gists{/gist_id}","starred_url":"https://api.github.com/users/manders9/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/manders9/subscriptions","organizations_url":"https://api.github.com/users/manders9/orgs","repos_url":"https://api.github.com/users/manders9/repos","events_url":"https://api.github.com/users/manders9/events{/privacy}","received_events_url":"https://api.github.com/users/manders9/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/manders9/TrinityMarketplace","description":"","fork":false,"url":"https://api.github.com/repos/manders9/TrinityMarketplace","forks_url":"https://api.github.com/repos/manders9/TrinityMarketplace/forks","keys_url":"https://api.github.com/repos/manders9/TrinityMarketplace/keys{/key_id}","collaborators_url":"https://api.github.com/repos/manders9/TrinityMarketplace/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/manders9/TrinityMarketplace/teams","hooks_url":"https://api.github.com/repos/manders9/TrinityMarketplace/hooks","issue_events_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/events{/number}","events_url":"https://api.github.com/repos/manders9/TrinityMarketplace/events","assignees_url":"https://api.github.com/repos/manders9/TrinityMarketplace/assignees{/user}","branches_url":"https://api.github.com/repos/manders9/TrinityMarketplace/branches{/branch}","tags_url":"https://api.github.com/repos/manders9/TrinityMarketplace/tags","blobs_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/refs{/sha}","trees_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/trees{/sha}","statuses_url":"https://api.github.com/repos/manders9/TrinityMarketplace/statuses/{sha}","languages_url":"https://api.github.com/repos/manders9/TrinityMarketplace/languages","stargazers_url":"https://api.github.com/repos/manders9/TrinityMarketplace/stargazers","contributors_url":"https://api.github.com/repos/manders9/TrinityMarketplace/contributors","subscribers_url":"https://api.github.com/repos/manders9/TrinityMarketplace/subscribers","subscription_url":"https://api.github.com/repos/manders9/TrinityMarketplace/subscription","commits_url":"https://api.github.com/repos/manders9/TrinityMarketplace/commits{/sha}","git_commits_url":"https://api.github.com/repos/manders9/TrinityMarketplace/git/commits{/sha}","comments_url":"https://api.github.com/repos/manders9/TrinityMarketplace/comments{/number}","issue_comment_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/comments/{number}","contents_url":"https://api.github.com/repos/manders9/TrinityMarketplace/contents/{+path}","compare_url":"https://api.github.com/repos/manders9/TrinityMarketplace/compare/{base}...{head}","merges_url":"https://api.github.com/repos/manders9/TrinityMarketplace/merges","archive_url":"https://api.github.com/repos/manders9/TrinityMarketplace/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/manders9/TrinityMarketplace/downloads","issues_url":"https://api.github.com/repos/manders9/TrinityMarketplace/issues{/number}","pulls_url":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls{/number}","milestones_url":"https://api.github.com/repos/manders9/TrinityMarketplace/milestones{/number}","notifications_url":"https://api.github.com/repos/manders9/TrinityMarketplace/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/manders9/TrinityMarketplace/labels{/name}","releases_url":"https://api.github.com/repos/manders9/TrinityMarketplace/releases{/id}","created_at":"2014-10-09T20:36:54Z","updated_at":"2014-10-14T14:56:48Z","pushed_at":"2014-10-17T19:34:52Z","git_url":"git://github.com/manders9/TrinityMarketplace.git","ssh_url":"git@github.com:manders9/TrinityMarketplace.git","clone_url":"https://github.com/manders9/TrinityMarketplace.git","svn_url":"https://github.com/manders9/TrinityMarketplace","homepage":null,"size":1048,"stargazers_count":0,"watchers_count":0,"language":"CSS","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":13,"forks":0,"open_issues":13,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25"},"html":{"href":"https://github.com/manders9/TrinityMarketplace/pull/25"},"issue":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/25"},"comments":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/issues/25/comments"},"review_comments":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25/comments"},"review_comment":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/comments/{number}"},"commits":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/pulls/25/commits"},"statuses":{"href":"https://api.github.com/repos/manders9/TrinityMarketplace/statuses/b52f91dbb5a2731aa472fc3d4ce49fca1adc26f3"}}}}