{"action":"created","comment":{"url":"https://api.github.com/repos/Wikia/mercury/pulls/comments/32299021","id":32299021,"diff_hunk":"@@ -0,0 +1,128 @@\n+interface HeliosError {\n+\tdescription: string;\n+\tadditional: HeliosErrorAdditional;\n+}\n+\n+interface HeliosErrorAdditional {\n+\tfield: string;\n+}\n+\n+interface HeliosRegisterInput {\n+\tusername: string;\n+\tpassword: string;\n+\temail: string;\n+\tbirthdate: string;\n+}\n+\n+class SignupForm {\n+\tform: HTMLFormElement;\n+\tgeneralValidationErrors: Array<string> = ['email_blocked', 'username_unavailable', 'birthdate_below_min_age'];\n+\tgeneralErrorShown: boolean = false;\n+\n+\tconstructor(form: Element) {\n+\t\tthis.form = <HTMLFormElement> form;\n+\t}\n+\n+\tprivate urlEncode(object: Object): string {\n+\t\treturn Object.keys(object).map((key: string) =>\n+\t\t\t\t`${encodeURIComponent(key)}=${encodeURIComponent(object[key])}`\n+\t\t).join('&');\n+\t}\n+\n+\tprivate clearValidationErrors(): void {\n+\t\tvar errorNodes: NodeList = this.form.querySelectorAll('.error');\n+\n+\t\tArray.prototype.forEach.call( errorNodes, (node: HTMLElement): void => {\n+\t\t\tif (node.tagName === 'INPUT') {\n+\t\t\t\tnode.classList.remove('error');\n+\t\t\t} else {\n+\t\t\t\tnode.parentNode.removeChild( node );\n+\t\t\t}\n+\t\t});\n+\t\tthis.generalErrorShown = false;\n+\t}\n+\n+\tprivate displayValidationErrors(errors: Array<HeliosError>): void {\n+\t\tArray.prototype.forEach.call( errors, (err: HeliosError): void => {\n+\t\t\tif (this.generalValidationErrors.indexOf(err.description) === -1) {\n+\t\t\t\tthis.displayFieldValidationError(err);\n+\t\t\t} else {\n+\t\t\t\tthis.displayGeneralError();\n+\t\t\t}\n+\t\t});\n+\t}\n+\n+\tprivate displayFieldValidationError(err: HeliosError): void {\n+\t\tvar errorNode: HTMLElement = this.createValidationErrorHTMLNode(err.description),\n+\t\t\tinput: HTMLFormElement = <HTMLFormElement> this.form.elements[err.additional.field];\n+\t\tinput.parentNode.appendChild(errorNode);\n+\t\tinput.classList.add('error');\n+\t}\n+\n+\tprivate displayGeneralError(): void {\n+\t\tif (!this.generalErrorShown) {\n+\t\t\tvar errorNode: HTMLElement = this.createValidationErrorHTMLNode('registration_error');\n+\t\t\tthis.form.insertBefore(errorNode, document.getElementById('signupNewsletter').parentNode);\n+\t\t\tthis.generalErrorShown = true;\n+\t\t}\n+\t}\n+\n+\tprivate createValidationErrorHTMLNode(errorDescription: string): HTMLElement {\n+\t\tvar errorNode: HTMLElement = window.document.createElement('small');\n+\t\terrorNode.classList.add('error');\n+\t\terrorNode.appendChild(window.document.createTextNode(this.translateValidationError(errorDescription)));\n+\t\treturn errorNode;\n+\t}\n+\n+\tprivate translateValidationError(errCode: string): string {\n+\t\treturn i18n.t('errors.' + errCode);\n+\t}\n+\n+\tprivate onSubmit(event: Event): void {\n+\t\tvar xhr = new XMLHttpRequest(),\n+\t\t\tformElements: HTMLCollection = this.form.elements,\n+\t\t\tdata: HeliosRegisterInput = {\n+\t\t\t\tusername: (<HTMLInputElement> formElements.namedItem('username')).value,\n+\t\t\t\tpassword: (<HTMLInputElement> formElements.namedItem('password')).value,\n+\t\t\t\temail: (<HTMLInputElement> formElements.namedItem('email')).value,\n+\t\t\t\tbirthdate: (<HTMLInputElement> formElements.namedItem('birthdate')).value\n+\t\t\t\t// TODO add langCode\n+\t\t\t},\n+\t\t\tsubmitButton: HTMLElement = <HTMLElement> this.form.querySelector('button'),\n+\t\t\tenableSubmitButton = () => {\n+\t\t\t\tsubmitButton.disabled = false;","path":"front/scripts/auth/signup/SignupForm.ts","position":93,"original_position":93,"commit_id":"11bad6db1a2789b82efd38a8be1b41d2ac7d9852","original_commit_id":"11bad6db1a2789b82efd38a8be1b41d2ac7d9852","user":{"login":"rafalkalinski","id":783239,"avatar_url":"https://avatars.githubusercontent.com/u/783239?v=3","gravatar_id":"","url":"https://api.github.com/users/rafalkalinski","html_url":"https://github.com/rafalkalinski","followers_url":"https://api.github.com/users/rafalkalinski/followers","following_url":"https://api.github.com/users/rafalkalinski/following{/other_user}","gists_url":"https://api.github.com/users/rafalkalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/rafalkalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafalkalinski/subscriptions","organizations_url":"https://api.github.com/users/rafalkalinski/orgs","repos_url":"https://api.github.com/users/rafalkalinski/repos","events_url":"https://api.github.com/users/rafalkalinski/events{/privacy}","received_events_url":"https://api.github.com/users/rafalkalinski/received_events","type":"User","site_admin":false},"body":"why not to remove disabled property?","created_at":"2015-06-12T08:44:26Z","updated_at":"2015-06-12T08:44:26Z","html_url":"https://github.com/Wikia/mercury/pull/900#discussion_r32299021","pull_request_url":"https://api.github.com/repos/Wikia/mercury/pulls/900","_links":{"self":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/comments/32299021"},"html":{"href":"https://github.com/Wikia/mercury/pull/900#discussion_r32299021"},"pull_request":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/900"}}},"pull_request":{"url":"https://api.github.com/repos/Wikia/mercury/pulls/900","id":37236176,"html_url":"https://github.com/Wikia/mercury/pull/900","diff_url":"https://github.com/Wikia/mercury/pull/900.diff","patch_url":"https://github.com/Wikia/mercury/pull/900.patch","issue_url":"https://api.github.com/repos/Wikia/mercury/issues/900","number":900,"state":"open","locked":false,"title":"SOC-684 | Registration screen","user":{"login":"kvas-damian","id":2725894,"avatar_url":"https://avatars.githubusercontent.com/u/2725894?v=3","gravatar_id":"","url":"https://api.github.com/users/kvas-damian","html_url":"https://github.com/kvas-damian","followers_url":"https://api.github.com/users/kvas-damian/followers","following_url":"https://api.github.com/users/kvas-damian/following{/other_user}","gists_url":"https://api.github.com/users/kvas-damian/gists{/gist_id}","starred_url":"https://api.github.com/users/kvas-damian/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/kvas-damian/subscriptions","organizations_url":"https://api.github.com/users/kvas-damian/orgs","repos_url":"https://api.github.com/users/kvas-damian/repos","events_url":"https://api.github.com/users/kvas-damian/events{/privacy}","received_events_url":"https://api.github.com/users/kvas-damian/received_events","type":"User","site_admin":false},"body":"https://wikia-inc.atlassian.net/browse/SOC-684\r\n* Basic logic behind registration screen\r\n* Registration request uses Helios directly via ajax (XHR)\r\n* Email validation ready\r\n* General form validation ready\r\n* Some UI changes to be able to fit in error messages on small screen\r\n* [not ready] - account language selection will be implemented in separate ticket\r\n\r\n@mklucsarits @rafalkalinski Please CR","created_at":"2015-06-09T09:50:53Z","updated_at":"2015-06-12T08:44:26Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1a8d7e5cfbe055e8196e3378588e59bee5b9f6ad","assignee":{"login":"rafalkalinski","id":783239,"avatar_url":"https://avatars.githubusercontent.com/u/783239?v=3","gravatar_id":"","url":"https://api.github.com/users/rafalkalinski","html_url":"https://github.com/rafalkalinski","followers_url":"https://api.github.com/users/rafalkalinski/followers","following_url":"https://api.github.com/users/rafalkalinski/following{/other_user}","gists_url":"https://api.github.com/users/rafalkalinski/gists{/gist_id}","starred_url":"https://api.github.com/users/rafalkalinski/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rafalkalinski/subscriptions","organizations_url":"https://api.github.com/users/rafalkalinski/orgs","repos_url":"https://api.github.com/users/rafalkalinski/repos","events_url":"https://api.github.com/users/rafalkalinski/events{/privacy}","received_events_url":"https://api.github.com/users/rafalkalinski/received_events","type":"User","site_admin":false},"milestone":null,"commits_url":"https://api.github.com/repos/Wikia/mercury/pulls/900/commits","review_comments_url":"https://api.github.com/repos/Wikia/mercury/pulls/900/comments","review_comment_url":"https://api.github.com/repos/Wikia/mercury/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Wikia/mercury/issues/900/comments","statuses_url":"https://api.github.com/repos/Wikia/mercury/statuses/11bad6db1a2789b82efd38a8be1b41d2ac7d9852","head":{"label":"Wikia:SOC-684","ref":"SOC-684","sha":"11bad6db1a2789b82efd38a8be1b41d2ac7d9852","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":16710430,"name":"mercury","full_name":"Wikia/mercury","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/mercury","description":"Wikia Web application","fork":false,"url":"https://api.github.com/repos/Wikia/mercury","forks_url":"https://api.github.com/repos/Wikia/mercury/forks","keys_url":"https://api.github.com/repos/Wikia/mercury/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/mercury/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/mercury/teams","hooks_url":"https://api.github.com/repos/Wikia/mercury/hooks","issue_events_url":"https://api.github.com/repos/Wikia/mercury/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/mercury/events","assignees_url":"https://api.github.com/repos/Wikia/mercury/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/mercury/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/mercury/tags","blobs_url":"https://api.github.com/repos/Wikia/mercury/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/mercury/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/mercury/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/mercury/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/mercury/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/mercury/languages","stargazers_url":"https://api.github.com/repos/Wikia/mercury/stargazers","contributors_url":"https://api.github.com/repos/Wikia/mercury/contributors","subscribers_url":"https://api.github.com/repos/Wikia/mercury/subscribers","subscription_url":"https://api.github.com/repos/Wikia/mercury/subscription","commits_url":"https://api.github.com/repos/Wikia/mercury/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/mercury/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/mercury/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/mercury/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/mercury/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/mercury/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/mercury/merges","archive_url":"https://api.github.com/repos/Wikia/mercury/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/mercury/downloads","issues_url":"https://api.github.com/repos/Wikia/mercury/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/mercury/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/mercury/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/mercury/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/mercury/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/mercury/releases{/id}","created_at":"2014-02-10T21:44:25Z","updated_at":"2015-05-08T20:25:03Z","pushed_at":"2015-06-12T08:30:17Z","git_url":"git://github.com/Wikia/mercury.git","ssh_url":"git@github.com:Wikia/mercury.git","clone_url":"https://github.com/Wikia/mercury.git","svn_url":"https://github.com/Wikia/mercury","homepage":"","size":20420,"stargazers_count":10,"watchers_count":10,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":10,"default_branch":"dev"}},"base":{"label":"Wikia:dev","ref":"dev","sha":"749e4cbec3f4c305c1446902010bc63ca4eebd97","user":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"repo":{"id":16710430,"name":"mercury","full_name":"Wikia/mercury","owner":{"login":"Wikia","id":1171011,"avatar_url":"https://avatars.githubusercontent.com/u/1171011?v=3","gravatar_id":"","url":"https://api.github.com/users/Wikia","html_url":"https://github.com/Wikia","followers_url":"https://api.github.com/users/Wikia/followers","following_url":"https://api.github.com/users/Wikia/following{/other_user}","gists_url":"https://api.github.com/users/Wikia/gists{/gist_id}","starred_url":"https://api.github.com/users/Wikia/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wikia/subscriptions","organizations_url":"https://api.github.com/users/Wikia/orgs","repos_url":"https://api.github.com/users/Wikia/repos","events_url":"https://api.github.com/users/Wikia/events{/privacy}","received_events_url":"https://api.github.com/users/Wikia/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Wikia/mercury","description":"Wikia Web application","fork":false,"url":"https://api.github.com/repos/Wikia/mercury","forks_url":"https://api.github.com/repos/Wikia/mercury/forks","keys_url":"https://api.github.com/repos/Wikia/mercury/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Wikia/mercury/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Wikia/mercury/teams","hooks_url":"https://api.github.com/repos/Wikia/mercury/hooks","issue_events_url":"https://api.github.com/repos/Wikia/mercury/issues/events{/number}","events_url":"https://api.github.com/repos/Wikia/mercury/events","assignees_url":"https://api.github.com/repos/Wikia/mercury/assignees{/user}","branches_url":"https://api.github.com/repos/Wikia/mercury/branches{/branch}","tags_url":"https://api.github.com/repos/Wikia/mercury/tags","blobs_url":"https://api.github.com/repos/Wikia/mercury/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Wikia/mercury/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Wikia/mercury/git/refs{/sha}","trees_url":"https://api.github.com/repos/Wikia/mercury/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Wikia/mercury/statuses/{sha}","languages_url":"https://api.github.com/repos/Wikia/mercury/languages","stargazers_url":"https://api.github.com/repos/Wikia/mercury/stargazers","contributors_url":"https://api.github.com/repos/Wikia/mercury/contributors","subscribers_url":"https://api.github.com/repos/Wikia/mercury/subscribers","subscription_url":"https://api.github.com/repos/Wikia/mercury/subscription","commits_url":"https://api.github.com/repos/Wikia/mercury/commits{/sha}","git_commits_url":"https://api.github.com/repos/Wikia/mercury/git/commits{/sha}","comments_url":"https://api.github.com/repos/Wikia/mercury/comments{/number}","issue_comment_url":"https://api.github.com/repos/Wikia/mercury/issues/comments{/number}","contents_url":"https://api.github.com/repos/Wikia/mercury/contents/{+path}","compare_url":"https://api.github.com/repos/Wikia/mercury/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Wikia/mercury/merges","archive_url":"https://api.github.com/repos/Wikia/mercury/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Wikia/mercury/downloads","issues_url":"https://api.github.com/repos/Wikia/mercury/issues{/number}","pulls_url":"https://api.github.com/repos/Wikia/mercury/pulls{/number}","milestones_url":"https://api.github.com/repos/Wikia/mercury/milestones{/number}","notifications_url":"https://api.github.com/repos/Wikia/mercury/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Wikia/mercury/labels{/name}","releases_url":"https://api.github.com/repos/Wikia/mercury/releases{/id}","created_at":"2014-02-10T21:44:25Z","updated_at":"2015-05-08T20:25:03Z","pushed_at":"2015-06-12T08:30:17Z","git_url":"git://github.com/Wikia/mercury.git","ssh_url":"git@github.com:Wikia/mercury.git","clone_url":"https://github.com/Wikia/mercury.git","svn_url":"https://github.com/Wikia/mercury","homepage":"","size":20420,"stargazers_count":10,"watchers_count":10,"language":"TypeScript","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":13,"forks":1,"open_issues":13,"watchers":10,"default_branch":"dev"}},"_links":{"self":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/900"},"html":{"href":"https://github.com/Wikia/mercury/pull/900"},"issue":{"href":"https://api.github.com/repos/Wikia/mercury/issues/900"},"comments":{"href":"https://api.github.com/repos/Wikia/mercury/issues/900/comments"},"review_comments":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/900/comments"},"review_comment":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Wikia/mercury/pulls/900/commits"},"statuses":{"href":"https://api.github.com/repos/Wikia/mercury/statuses/11bad6db1a2789b82efd38a8be1b41d2ac7d9852"}}}}