{"action":"created","comment":{"url":"https://api.github.com/repos/18F/identity-idp/pulls/comments/173504226","pull_request_review_id":102711961,"id":173504226,"diff_hunk":"@@ -0,0 +1,37 @@\n+import { isValidNumber } from 'libphonenumber-js';\n+\n+const checkPhoneValidity = () => {\n+  const sendCodeButton = document.querySelector('[data-international-phone-form] input[name=commit]');\n+  const phoneInput = document.querySelector('[data-international-phone-form] .phone');\n+  const countryCodeInput = document.querySelector('[data-international-phone-form] .international-code');\n+\n+  if (phoneInput && countryCodeInput && sendCodeButton) {\n+    const phone = phoneInput.value;\n+    const countryCode = countryCodeInput.value;\n+\n+    const phoneValid = isValidNumber(phone, countryCode);\n+\n+    if (phoneValid) {\n+      phoneInput.classList.add('valid-phone');","path":"app/javascript/app/phone-validation.js","position":15,"original_position":15,"commit_id":"a2d16703c407aedcdd8aed0d5367bd5cdbb4cef2","original_commit_id":"a2d16703c407aedcdd8aed0d5367bd5cdbb4cef2","user":{"login":"jmhooper","id":963654,"avatar_url":"https://avatars1.githubusercontent.com/u/963654?v=4","gravatar_id":"","url":"https://api.github.com/users/jmhooper","html_url":"https://github.com/jmhooper","followers_url":"https://api.github.com/users/jmhooper/followers","following_url":"https://api.github.com/users/jmhooper/following{/other_user}","gists_url":"https://api.github.com/users/jmhooper/gists{/gist_id}","starred_url":"https://api.github.com/users/jmhooper/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jmhooper/subscriptions","organizations_url":"https://api.github.com/users/jmhooper/orgs","repos_url":"https://api.github.com/users/jmhooper/repos","events_url":"https://api.github.com/users/jmhooper/events{/privacy}","received_events_url":"https://api.github.com/users/jmhooper/received_events","type":"User","site_admin":false},"body":"What is the purpose of adding / removing these classes here?","created_at":"2018-03-09T16:47:20Z","updated_at":"2018-03-09T16:47:20Z","html_url":"https://github.com/18F/identity-idp/pull/2034#discussion_r173504226","pull_request_url":"https://api.github.com/repos/18F/identity-idp/pulls/2034","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/comments/173504226"},"html":{"href":"https://github.com/18F/identity-idp/pull/2034#discussion_r173504226"},"pull_request":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/2034"}}},"pull_request":{"url":"https://api.github.com/repos/18F/identity-idp/pulls/2034","id":172602192,"html_url":"https://github.com/18F/identity-idp/pull/2034","diff_url":"https://github.com/18F/identity-idp/pull/2034.diff","patch_url":"https://github.com/18F/identity-idp/pull/2034.patch","issue_url":"https://api.github.com/repos/18F/identity-idp/issues/2034","number":2034,"state":"open","locked":false,"title":"LG-126 - Validate the appearance of phone numbers before allowing OTP submission","user":{"login":"jgsmith-usds","id":25034073,"avatar_url":"https://avatars2.githubusercontent.com/u/25034073?v=4","gravatar_id":"","url":"https://api.github.com/users/jgsmith-usds","html_url":"https://github.com/jgsmith-usds","followers_url":"https://api.github.com/users/jgsmith-usds/followers","following_url":"https://api.github.com/users/jgsmith-usds/following{/other_user}","gists_url":"https://api.github.com/users/jgsmith-usds/gists{/gist_id}","starred_url":"https://api.github.com/users/jgsmith-usds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jgsmith-usds/subscriptions","organizations_url":"https://api.github.com/users/jgsmith-usds/orgs","repos_url":"https://api.github.com/users/jgsmith-usds/repos","events_url":"https://api.github.com/users/jgsmith-usds/events{/privacy}","received_events_url":"https://api.github.com/users/jgsmith-usds/received_events","type":"User","site_admin":false},"body":"**Why**: We want to be able to leverage several phone validation options,\r\nso we are (1) moving the validation to the backend, (2) giving feedback\r\nto the user when the phone number is considered valid, (3) enabling\r\n\"Send Code\" only when the phone number is considered valid.\r\n\r\n**How**: Originally, we were going to send a POST to an endpoint, but since we\r\nalready have libphonenumber-js in our browser-side environment, we're using that\r\nuntil we need to do validation that can't be done in the browser. Since this isn't the\r\nfinal validation, we do this just for the benefit of the UX.\r\n\r\nHi! Before submitting your PR for review, and/or before merging it, please\r\ngo through the following checklist:\r\n\r\n- [x] For DB changes, check for missing indexes, check to see if the changes\r\naffect other apps (such as the dashboard), make sure the DB columns in the\r\nvarious environments are properly populated, coordinate with devops, plan\r\nmigrations in separate steps.\r\n\r\n- [x] For route changes, make sure GET requests don't change state or result in\r\ndestructive behavior. GET requests should only result in information being\r\nread, not written.\r\n\r\n- [x] For encryption changes, make sure it is compatible with data that was\r\nencrypted with the old code.\r\n\r\n- [x] For secrets changes, [make sure to update the S3 secrets bucket](https://github.com/18F/identity-private/wiki/Secrets-S3-buckets) with the \r\nnew configs in **all** environments. \r\n\r\n- [x] Do not disable Rubocop or Reek offenses unless you are absolutely sure\r\nthey are false positives. If you're not sure how to fix the offense, please\r\nask a teammate.\r\n\r\n- [x] When reading data, write tests for nil values, empty strings,\r\nand invalid formats.\r\n\r\n- [x] When calling `redirect_to` in a controller, use `_url`, not `_path`.\r\n\r\n- [x] When adding user data to the session, use the `user_session` helper\r\ninstead of the `session` helper so the data does not persist beyond the user's\r\nsession.\r\n\r\n- [x] When adding a new controller that requires the user to be fully\r\nauthenticated, make sure to add `before_action :confirm_two_factor_authenticated`.\r\n","created_at":"2018-03-02T20:53:12Z","updated_at":"2018-03-09T16:47:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f47221e05796da1570b410fa0273bd8ddadde3fa","assignee":null,"assignees":[],"requested_reviewers":[{"login":"monfresh","id":811150,"avatar_url":"https://avatars1.githubusercontent.com/u/811150?v=4","gravatar_id":"","url":"https://api.github.com/users/monfresh","html_url":"https://github.com/monfresh","followers_url":"https://api.github.com/users/monfresh/followers","following_url":"https://api.github.com/users/monfresh/following{/other_user}","gists_url":"https://api.github.com/users/monfresh/gists{/gist_id}","starred_url":"https://api.github.com/users/monfresh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monfresh/subscriptions","organizations_url":"https://api.github.com/users/monfresh/orgs","repos_url":"https://api.github.com/users/monfresh/repos","events_url":"https://api.github.com/users/monfresh/events{/privacy}","received_events_url":"https://api.github.com/users/monfresh/received_events","type":"User","site_admin":false},{"login":"stevegsa","id":34244063,"avatar_url":"https://avatars0.githubusercontent.com/u/34244063?v=4","gravatar_id":"","url":"https://api.github.com/users/stevegsa","html_url":"https://github.com/stevegsa","followers_url":"https://api.github.com/users/stevegsa/followers","following_url":"https://api.github.com/users/stevegsa/following{/other_user}","gists_url":"https://api.github.com/users/stevegsa/gists{/gist_id}","starred_url":"https://api.github.com/users/stevegsa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/stevegsa/subscriptions","organizations_url":"https://api.github.com/users/stevegsa/orgs","repos_url":"https://api.github.com/users/stevegsa/repos","events_url":"https://api.github.com/users/stevegsa/events{/privacy}","received_events_url":"https://api.github.com/users/stevegsa/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":355011342,"url":"https://api.github.com/repos/18F/identity-idp/labels/status%20-%20ready%20for%20review","name":"status - ready for review","color":"006b75","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/18F/identity-idp/pulls/2034/commits","review_comments_url":"https://api.github.com/repos/18F/identity-idp/pulls/2034/comments","review_comment_url":"https://api.github.com/repos/18F/identity-idp/pulls/comments{/number}","comments_url":"https://api.github.com/repos/18F/identity-idp/issues/2034/comments","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/a2d16703c407aedcdd8aed0d5367bd5cdbb4cef2","head":{"label":"18F:jgs-lg-126-validate-otp-phone-numbers-before-sending-code","ref":"jgs-lg-126-validate-otp-phone-numbers-before-sending-code","sha":"a2d16703c407aedcdd8aed0d5367bd5cdbb4cef2","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars0.githubusercontent.com/u/6233994?v=4","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":50386243,"name":"identity-idp","full_name":"18F/identity-idp","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars0.githubusercontent.com/u/6233994?v=4","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/identity-idp","description":"18F Identity Provider (IdP)","fork":false,"url":"https://api.github.com/repos/18F/identity-idp","forks_url":"https://api.github.com/repos/18F/identity-idp/forks","keys_url":"https://api.github.com/repos/18F/identity-idp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/identity-idp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/identity-idp/teams","hooks_url":"https://api.github.com/repos/18F/identity-idp/hooks","issue_events_url":"https://api.github.com/repos/18F/identity-idp/issues/events{/number}","events_url":"https://api.github.com/repos/18F/identity-idp/events","assignees_url":"https://api.github.com/repos/18F/identity-idp/assignees{/user}","branches_url":"https://api.github.com/repos/18F/identity-idp/branches{/branch}","tags_url":"https://api.github.com/repos/18F/identity-idp/tags","blobs_url":"https://api.github.com/repos/18F/identity-idp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/identity-idp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/identity-idp/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/identity-idp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/identity-idp/languages","stargazers_url":"https://api.github.com/repos/18F/identity-idp/stargazers","contributors_url":"https://api.github.com/repos/18F/identity-idp/contributors","subscribers_url":"https://api.github.com/repos/18F/identity-idp/subscribers","subscription_url":"https://api.github.com/repos/18F/identity-idp/subscription","commits_url":"https://api.github.com/repos/18F/identity-idp/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/identity-idp/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/identity-idp/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/identity-idp/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/identity-idp/contents/{+path}","compare_url":"https://api.github.com/repos/18F/identity-idp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/identity-idp/merges","archive_url":"https://api.github.com/repos/18F/identity-idp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/identity-idp/downloads","issues_url":"https://api.github.com/repos/18F/identity-idp/issues{/number}","pulls_url":"https://api.github.com/repos/18F/identity-idp/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/identity-idp/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/identity-idp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/identity-idp/labels{/name}","releases_url":"https://api.github.com/repos/18F/identity-idp/releases{/id}","deployments_url":"https://api.github.com/repos/18F/identity-idp/deployments","created_at":"2016-01-25T22:40:59Z","updated_at":"2018-03-08T12:34:30Z","pushed_at":"2018-03-09T16:42:11Z","git_url":"git://github.com/18F/identity-idp.git","ssh_url":"git@github.com:18F/identity-idp.git","clone_url":"https://github.com/18F/identity-idp.git","svn_url":"https://github.com/18F/identity-idp","homepage":"https://secure.login.gov/","size":12352,"stargazers_count":157,"watchers_count":157,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":31,"open_issues":18,"watchers":157,"default_branch":"master"}},"base":{"label":"18F:master","ref":"master","sha":"5d698dd81382cab83b3b2065ca5506a472715837","user":{"login":"18F","id":6233994,"avatar_url":"https://avatars0.githubusercontent.com/u/6233994?v=4","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"repo":{"id":50386243,"name":"identity-idp","full_name":"18F/identity-idp","owner":{"login":"18F","id":6233994,"avatar_url":"https://avatars0.githubusercontent.com/u/6233994?v=4","gravatar_id":"","url":"https://api.github.com/users/18F","html_url":"https://github.com/18F","followers_url":"https://api.github.com/users/18F/followers","following_url":"https://api.github.com/users/18F/following{/other_user}","gists_url":"https://api.github.com/users/18F/gists{/gist_id}","starred_url":"https://api.github.com/users/18F/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/18F/subscriptions","organizations_url":"https://api.github.com/users/18F/orgs","repos_url":"https://api.github.com/users/18F/repos","events_url":"https://api.github.com/users/18F/events{/privacy}","received_events_url":"https://api.github.com/users/18F/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/18F/identity-idp","description":"18F Identity Provider (IdP)","fork":false,"url":"https://api.github.com/repos/18F/identity-idp","forks_url":"https://api.github.com/repos/18F/identity-idp/forks","keys_url":"https://api.github.com/repos/18F/identity-idp/keys{/key_id}","collaborators_url":"https://api.github.com/repos/18F/identity-idp/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/18F/identity-idp/teams","hooks_url":"https://api.github.com/repos/18F/identity-idp/hooks","issue_events_url":"https://api.github.com/repos/18F/identity-idp/issues/events{/number}","events_url":"https://api.github.com/repos/18F/identity-idp/events","assignees_url":"https://api.github.com/repos/18F/identity-idp/assignees{/user}","branches_url":"https://api.github.com/repos/18F/identity-idp/branches{/branch}","tags_url":"https://api.github.com/repos/18F/identity-idp/tags","blobs_url":"https://api.github.com/repos/18F/identity-idp/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/18F/identity-idp/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/18F/identity-idp/git/refs{/sha}","trees_url":"https://api.github.com/repos/18F/identity-idp/git/trees{/sha}","statuses_url":"https://api.github.com/repos/18F/identity-idp/statuses/{sha}","languages_url":"https://api.github.com/repos/18F/identity-idp/languages","stargazers_url":"https://api.github.com/repos/18F/identity-idp/stargazers","contributors_url":"https://api.github.com/repos/18F/identity-idp/contributors","subscribers_url":"https://api.github.com/repos/18F/identity-idp/subscribers","subscription_url":"https://api.github.com/repos/18F/identity-idp/subscription","commits_url":"https://api.github.com/repos/18F/identity-idp/commits{/sha}","git_commits_url":"https://api.github.com/repos/18F/identity-idp/git/commits{/sha}","comments_url":"https://api.github.com/repos/18F/identity-idp/comments{/number}","issue_comment_url":"https://api.github.com/repos/18F/identity-idp/issues/comments{/number}","contents_url":"https://api.github.com/repos/18F/identity-idp/contents/{+path}","compare_url":"https://api.github.com/repos/18F/identity-idp/compare/{base}...{head}","merges_url":"https://api.github.com/repos/18F/identity-idp/merges","archive_url":"https://api.github.com/repos/18F/identity-idp/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/18F/identity-idp/downloads","issues_url":"https://api.github.com/repos/18F/identity-idp/issues{/number}","pulls_url":"https://api.github.com/repos/18F/identity-idp/pulls{/number}","milestones_url":"https://api.github.com/repos/18F/identity-idp/milestones{/number}","notifications_url":"https://api.github.com/repos/18F/identity-idp/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/18F/identity-idp/labels{/name}","releases_url":"https://api.github.com/repos/18F/identity-idp/releases{/id}","deployments_url":"https://api.github.com/repos/18F/identity-idp/deployments","created_at":"2016-01-25T22:40:59Z","updated_at":"2018-03-08T12:34:30Z","pushed_at":"2018-03-09T16:42:11Z","git_url":"git://github.com/18F/identity-idp.git","ssh_url":"git@github.com:18F/identity-idp.git","clone_url":"https://github.com/18F/identity-idp.git","svn_url":"https://github.com/18F/identity-idp","homepage":"https://secure.login.gov/","size":12352,"stargazers_count":157,"watchers_count":157,"language":"Ruby","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":31,"mirror_url":null,"archived":false,"open_issues_count":18,"license":{"key":"other","name":"Other","spdx_id":null,"url":null},"forks":31,"open_issues":18,"watchers":157,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/2034"},"html":{"href":"https://github.com/18F/identity-idp/pull/2034"},"issue":{"href":"https://api.github.com/repos/18F/identity-idp/issues/2034"},"comments":{"href":"https://api.github.com/repos/18F/identity-idp/issues/2034/comments"},"review_comments":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/2034/comments"},"review_comment":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/18F/identity-idp/pulls/2034/commits"},"statuses":{"href":"https://api.github.com/repos/18F/identity-idp/statuses/a2d16703c407aedcdd8aed0d5367bd5cdbb4cef2"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"jmhooper"}}