{"action":"created","comment":{"url":"https://api.github.com/repos/hawk2889/LK/pulls/comments/89771827","pull_request_review_id":10297867,"id":89771827,"diff_hunk":"@@ -0,0 +1,259 @@\n+import {Component} from 'react';\n+import template from './templ';\n+import DateParser from '../../../helpers/date-parser'\n+import Dispatcher from '../../dispatcher';\n+import Store from '../../store';\n+import _ from 'lodash';\n+\n+\n+class UserProfile extends Component {\n+    constructor(props) {\n+        super(props);\n+        let newState = _.clone(Store.profileCache);\n+        newState.formErrors = Store.formErrors;\n+        this.state = newState;\n+        this.updateStateVerificationPhone = this.updateStateVerificationPhone.bind(this);\n+    }\n+\n+    chancel() {\n+        this.setState(_.clone(Store.profileCache));\n+        this.refs.firstName.updateValue(Store.profileCache.firstName);\n+        this.refs.lastName.updateValue(Store.profileCache.lastName);\n+        this.refs.gender.updateValue(Store.profileCache.gender);\n+        this.refs.publicName.updateValue(Store.profileCache.publicName);\n+        this.refs.birthday.updateValue(Store.profileCache.birthday ? DateParser(Store.profileCache.birthday, 'date') : '');\n+        this.refs.email.updateValue(Store.profileCache.email);\n+        this.refs.residence.updateValue(Store.profileCache.residence);\n+        this.refs.phone.updateValue(Store.profileCache.phone);\n+        Dispatcher.dispatch({\n+            eventName: 'profile:update',\n+            value: _.clone(Store.profileCache)\n+        });\n+        setTimeout(function () {\n+            $('.user-profile').valid();\n+        }, 100);\n+    }\n+\n+    render() {\n+        return template.call(this);\n+    }\n+\n+    _changeResidence(Residence, Route) {\n+        var newState = _.clone(this.state);\n+        newState.residence = Residence;\n+        newState.residenceRoute = Route;\n+        this.compare(newState);\n+        Dispatcher.dispatch({\n+            eventName: 'profile:update',\n+            value: newState\n+        });\n+    }\n+\n+    _changeField(name, val) {\n+        if (name == 'birthday') {\n+            if (val == '') {\n+                val = null;\n+            } else {\n+                val = DateParser(val, 'unix');\n+            }\n+        }\n+        var newState = _.clone(this.state);\n+        newState[name] = val;\n+        this.compare(newState);\n+        Dispatcher.dispatch({\n+            eventName: 'profile:update',\n+            value: newState\n+        });\n+    }\n+\n+    compare(val) {\n+        if (_.isEqual(val, _.clone(Store.profileCache))) {\n+            Dispatcher.dispatch({\n+                eventName: 'all:buttons:disabled',\n+                value: {\n+                    target: 'profile',\n+                    value: true\n+                }\n+            });\n+        } else {\n+            Dispatcher.dispatch({\n+                eventName: 'all:buttons:disabled',\n+                value: {\n+                    target: 'profile',\n+                    value: false\n+                }\n+            });\n+        }\n+    }\n+\n+    _updateProfile() {\n+        let newState=_.clone(Store.profileCache);\n+        newState.formErrors=Store.formErrors;\n+        this.setState(newState);\n+    }\n+\n+    updateStateVerificationPhone() {\n+        this.setState({\n+            phoneIsConfirmed: true\n+        })\n+    }\n+\n+    componentWillUnmount() {\n+        Store.removeListener('profile:update', this._updateProfile.bind(this));\n+        Store.removeListener('profile:verification:phone', this.updateStateVerificationPhone);\n+        Store.removeListener('profile:updatedVerificationPhone', this._updateProfile.bind(this));\n+    }\n+\n+    componentDidMount() {\n+        Store.addListener('profile:update', this._updateProfile.bind(this));\n+        Store.addListener('profile:verification:phone', this.updateStateVerificationPhone);\n+        Store.addListener('profile:updatedVerificationPhone', this._updateProfile.bind(this));\n+        $.validator.addMethod(\n+            \"dateITA\",\n+            function (value, element) {\n+                var check = false;\n+                var re = /^\\d{1,2}\\.\\d{1,2}\\.\\d{4}$/;\n+                if (re.test(value)) {\n+                    var adata = value.split('.');\n+                    var gg = parseInt(adata[0], 10);\n+                    var mm = parseInt(adata[1], 10);\n+                    var aaaa = parseInt(adata[2], 10);\n+                    var xdata = new Date(aaaa, mm - 1, gg);\n+                    if (( xdata.getFullYear() == aaaa ) && ( xdata.getMonth() == mm - 1 ) && ( xdata.getDate() == gg )) {\n+                        check = true;\n+                    }\n+                    else {\n+                        check = false;\n+                    }\n+                } else {\n+                    check = false;\n+                }\n+                return this.optional(element) || check;\n+            },\n+            \"Please enter a correct date\"\n+        );\n+\n+        $.validator.addMethod(\n+            \"isOld\",\n+            function (value) {\n+                return !DateParser(value, 'isOld')\n+            },\n+            \"Это было слишком давно\"\n+        );\n+\n+        $.validator.addMethod(\n+            \"isFuture\",\n+            function (value) {\n+                return !DateParser(value, 'isFuture')\n+            },\n+            \"Дата не должна быть в будущем\"\n+        );\n+\n+        $.validator.addMethod(\n+            \"isPhone\",\n+            function (value) {\n+                var re = /^\\+7 \\([0-9]{3}\\) [0-9]{3} - [0-9]{2} - [0-9]{2}$/;\n+                if (value == \"\") {\n+                    return true;\n+                }\n+                if (re.test(value)) {\n+                    return true;\n+                } else {\n+                    return false;\n+                }\n+            },\n+            \"Введите корректный номер\"\n+        );\n+\n+        var emailFerify = function (data) {\n+            if (data.status == 200) {\n+                return true;\n+            }\n+            if (data.status == 409) {\n+                return false\n+            }\n+            if (data.status == 400) {\n+                return false\n+            }\n+        };\n+\n+        $('.user-profile').validate({\n+            onfocusin: function (element) {\n+                $(element).removeClass(this.settings.errorClass);\n+                $(\"label[for='\" + element.name + \"']\").hide();\n+            },\n+            onfocusout: function (element) {\n+                this.element(element);\n+            },\n+            onkeyup: false,\n+            onclick: false,\n+            rules: {\n+                firstName: {\n+                    required: true,\n+                    maxlength: 64\n+                },\n+                lastName: {\n+                    minlength: 1,\n+                    maxlength: 64\n+                },\n+                publicName: {\n+                    required: true,\n+                    maxlength: 64\n+                },\n+                email: {\n+                    required: true,\n+                    email: true,\n+                   // validateRemote: true,","path":"user-profile/user-profilee.js","position":206,"original_position":206,"commit_id":"9e662f88215d9d467fb7baa8ecabf3a9ab4856cb","original_commit_id":"9e662f88215d9d467fb7baa8ecabf3a9ab4856cb","user":{"login":"Zhurbin","id":5123981,"avatar_url":"https://avatars.githubusercontent.com/u/5123981?v=3","gravatar_id":"","url":"https://api.github.com/users/Zhurbin","html_url":"https://github.com/Zhurbin","followers_url":"https://api.github.com/users/Zhurbin/followers","following_url":"https://api.github.com/users/Zhurbin/following{/other_user}","gists_url":"https://api.github.com/users/Zhurbin/gists{/gist_id}","starred_url":"https://api.github.com/users/Zhurbin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Zhurbin/subscriptions","organizations_url":"https://api.github.com/users/Zhurbin/orgs","repos_url":"https://api.github.com/users/Zhurbin/repos","events_url":"https://api.github.com/users/Zhurbin/events{/privacy}","received_events_url":"https://api.github.com/users/Zhurbin/received_events","type":"User","site_admin":false},"body":"лишние комменты выкинь","created_at":"2016-11-28T12:31:20Z","updated_at":"2016-11-28T12:31:59Z","html_url":"https://github.com/hawk2889/LK/pull/1#discussion_r89771827","pull_request_url":"https://api.github.com/repos/hawk2889/LK/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/hawk2889/LK/pulls/comments/89771827"},"html":{"href":"https://github.com/hawk2889/LK/pull/1#discussion_r89771827"},"pull_request":{"href":"https://api.github.com/repos/hawk2889/LK/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/hawk2889/LK/pulls/1","id":95480174,"html_url":"https://github.com/hawk2889/LK/pull/1","diff_url":"https://github.com/hawk2889/LK/pull/1.diff","patch_url":"https://github.com/hawk2889/LK/pull/1.patch","issue_url":"https://api.github.com/repos/hawk2889/LK/issues/1","number":1,"state":"open","locked":false,"title":"test","user":{"login":"hawk2889","id":8145044,"avatar_url":"https://avatars.githubusercontent.com/u/8145044?v=3","gravatar_id":"","url":"https://api.github.com/users/hawk2889","html_url":"https://github.com/hawk2889","followers_url":"https://api.github.com/users/hawk2889/followers","following_url":"https://api.github.com/users/hawk2889/following{/other_user}","gists_url":"https://api.github.com/users/hawk2889/gists{/gist_id}","starred_url":"https://api.github.com/users/hawk2889/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawk2889/subscriptions","organizations_url":"https://api.github.com/users/hawk2889/orgs","repos_url":"https://api.github.com/users/hawk2889/repos","events_url":"https://api.github.com/users/hawk2889/events{/privacy}","received_events_url":"https://api.github.com/users/hawk2889/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-11-28T11:19:56Z","updated_at":"2016-11-28T12:31:59Z","closed_at":null,"merged_at":null,"merge_commit_sha":"058bbb56008b9a7335491ea9e1caf53577114963","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/hawk2889/LK/pulls/1/commits","review_comments_url":"https://api.github.com/repos/hawk2889/LK/pulls/1/comments","review_comment_url":"https://api.github.com/repos/hawk2889/LK/pulls/comments{/number}","comments_url":"https://api.github.com/repos/hawk2889/LK/issues/1/comments","statuses_url":"https://api.github.com/repos/hawk2889/LK/statuses/9e662f88215d9d467fb7baa8ecabf3a9ab4856cb","head":{"label":"hawk2889:dev","ref":"dev","sha":"9e662f88215d9d467fb7baa8ecabf3a9ab4856cb","user":{"login":"hawk2889","id":8145044,"avatar_url":"https://avatars.githubusercontent.com/u/8145044?v=3","gravatar_id":"","url":"https://api.github.com/users/hawk2889","html_url":"https://github.com/hawk2889","followers_url":"https://api.github.com/users/hawk2889/followers","following_url":"https://api.github.com/users/hawk2889/following{/other_user}","gists_url":"https://api.github.com/users/hawk2889/gists{/gist_id}","starred_url":"https://api.github.com/users/hawk2889/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawk2889/subscriptions","organizations_url":"https://api.github.com/users/hawk2889/orgs","repos_url":"https://api.github.com/users/hawk2889/repos","events_url":"https://api.github.com/users/hawk2889/events{/privacy}","received_events_url":"https://api.github.com/users/hawk2889/received_events","type":"User","site_admin":false},"repo":{"id":74964662,"name":"LK","full_name":"hawk2889/LK","owner":{"login":"hawk2889","id":8145044,"avatar_url":"https://avatars.githubusercontent.com/u/8145044?v=3","gravatar_id":"","url":"https://api.github.com/users/hawk2889","html_url":"https://github.com/hawk2889","followers_url":"https://api.github.com/users/hawk2889/followers","following_url":"https://api.github.com/users/hawk2889/following{/other_user}","gists_url":"https://api.github.com/users/hawk2889/gists{/gist_id}","starred_url":"https://api.github.com/users/hawk2889/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawk2889/subscriptions","organizations_url":"https://api.github.com/users/hawk2889/orgs","repos_url":"https://api.github.com/users/hawk2889/repos","events_url":"https://api.github.com/users/hawk2889/events{/privacy}","received_events_url":"https://api.github.com/users/hawk2889/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hawk2889/LK","description":null,"fork":false,"url":"https://api.github.com/repos/hawk2889/LK","forks_url":"https://api.github.com/repos/hawk2889/LK/forks","keys_url":"https://api.github.com/repos/hawk2889/LK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hawk2889/LK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hawk2889/LK/teams","hooks_url":"https://api.github.com/repos/hawk2889/LK/hooks","issue_events_url":"https://api.github.com/repos/hawk2889/LK/issues/events{/number}","events_url":"https://api.github.com/repos/hawk2889/LK/events","assignees_url":"https://api.github.com/repos/hawk2889/LK/assignees{/user}","branches_url":"https://api.github.com/repos/hawk2889/LK/branches{/branch}","tags_url":"https://api.github.com/repos/hawk2889/LK/tags","blobs_url":"https://api.github.com/repos/hawk2889/LK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hawk2889/LK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hawk2889/LK/git/refs{/sha}","trees_url":"https://api.github.com/repos/hawk2889/LK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hawk2889/LK/statuses/{sha}","languages_url":"https://api.github.com/repos/hawk2889/LK/languages","stargazers_url":"https://api.github.com/repos/hawk2889/LK/stargazers","contributors_url":"https://api.github.com/repos/hawk2889/LK/contributors","subscribers_url":"https://api.github.com/repos/hawk2889/LK/subscribers","subscription_url":"https://api.github.com/repos/hawk2889/LK/subscription","commits_url":"https://api.github.com/repos/hawk2889/LK/commits{/sha}","git_commits_url":"https://api.github.com/repos/hawk2889/LK/git/commits{/sha}","comments_url":"https://api.github.com/repos/hawk2889/LK/comments{/number}","issue_comment_url":"https://api.github.com/repos/hawk2889/LK/issues/comments{/number}","contents_url":"https://api.github.com/repos/hawk2889/LK/contents/{+path}","compare_url":"https://api.github.com/repos/hawk2889/LK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hawk2889/LK/merges","archive_url":"https://api.github.com/repos/hawk2889/LK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hawk2889/LK/downloads","issues_url":"https://api.github.com/repos/hawk2889/LK/issues{/number}","pulls_url":"https://api.github.com/repos/hawk2889/LK/pulls{/number}","milestones_url":"https://api.github.com/repos/hawk2889/LK/milestones{/number}","notifications_url":"https://api.github.com/repos/hawk2889/LK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hawk2889/LK/labels{/name}","releases_url":"https://api.github.com/repos/hawk2889/LK/releases{/id}","deployments_url":"https://api.github.com/repos/hawk2889/LK/deployments","created_at":"2016-11-28T11:01:58Z","updated_at":"2016-11-28T11:14:14Z","pushed_at":"2016-11-28T11:25:42Z","git_url":"git://github.com/hawk2889/LK.git","ssh_url":"git@github.com:hawk2889/LK.git","clone_url":"https://github.com/hawk2889/LK.git","svn_url":"https://github.com/hawk2889/LK","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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":"hawk2889:master","ref":"master","sha":"8fb8fdc70f2bb21ed1fc145d8f35f3fed19076ba","user":{"login":"hawk2889","id":8145044,"avatar_url":"https://avatars.githubusercontent.com/u/8145044?v=3","gravatar_id":"","url":"https://api.github.com/users/hawk2889","html_url":"https://github.com/hawk2889","followers_url":"https://api.github.com/users/hawk2889/followers","following_url":"https://api.github.com/users/hawk2889/following{/other_user}","gists_url":"https://api.github.com/users/hawk2889/gists{/gist_id}","starred_url":"https://api.github.com/users/hawk2889/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawk2889/subscriptions","organizations_url":"https://api.github.com/users/hawk2889/orgs","repos_url":"https://api.github.com/users/hawk2889/repos","events_url":"https://api.github.com/users/hawk2889/events{/privacy}","received_events_url":"https://api.github.com/users/hawk2889/received_events","type":"User","site_admin":false},"repo":{"id":74964662,"name":"LK","full_name":"hawk2889/LK","owner":{"login":"hawk2889","id":8145044,"avatar_url":"https://avatars.githubusercontent.com/u/8145044?v=3","gravatar_id":"","url":"https://api.github.com/users/hawk2889","html_url":"https://github.com/hawk2889","followers_url":"https://api.github.com/users/hawk2889/followers","following_url":"https://api.github.com/users/hawk2889/following{/other_user}","gists_url":"https://api.github.com/users/hawk2889/gists{/gist_id}","starred_url":"https://api.github.com/users/hawk2889/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hawk2889/subscriptions","organizations_url":"https://api.github.com/users/hawk2889/orgs","repos_url":"https://api.github.com/users/hawk2889/repos","events_url":"https://api.github.com/users/hawk2889/events{/privacy}","received_events_url":"https://api.github.com/users/hawk2889/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/hawk2889/LK","description":null,"fork":false,"url":"https://api.github.com/repos/hawk2889/LK","forks_url":"https://api.github.com/repos/hawk2889/LK/forks","keys_url":"https://api.github.com/repos/hawk2889/LK/keys{/key_id}","collaborators_url":"https://api.github.com/repos/hawk2889/LK/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/hawk2889/LK/teams","hooks_url":"https://api.github.com/repos/hawk2889/LK/hooks","issue_events_url":"https://api.github.com/repos/hawk2889/LK/issues/events{/number}","events_url":"https://api.github.com/repos/hawk2889/LK/events","assignees_url":"https://api.github.com/repos/hawk2889/LK/assignees{/user}","branches_url":"https://api.github.com/repos/hawk2889/LK/branches{/branch}","tags_url":"https://api.github.com/repos/hawk2889/LK/tags","blobs_url":"https://api.github.com/repos/hawk2889/LK/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/hawk2889/LK/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/hawk2889/LK/git/refs{/sha}","trees_url":"https://api.github.com/repos/hawk2889/LK/git/trees{/sha}","statuses_url":"https://api.github.com/repos/hawk2889/LK/statuses/{sha}","languages_url":"https://api.github.com/repos/hawk2889/LK/languages","stargazers_url":"https://api.github.com/repos/hawk2889/LK/stargazers","contributors_url":"https://api.github.com/repos/hawk2889/LK/contributors","subscribers_url":"https://api.github.com/repos/hawk2889/LK/subscribers","subscription_url":"https://api.github.com/repos/hawk2889/LK/subscription","commits_url":"https://api.github.com/repos/hawk2889/LK/commits{/sha}","git_commits_url":"https://api.github.com/repos/hawk2889/LK/git/commits{/sha}","comments_url":"https://api.github.com/repos/hawk2889/LK/comments{/number}","issue_comment_url":"https://api.github.com/repos/hawk2889/LK/issues/comments{/number}","contents_url":"https://api.github.com/repos/hawk2889/LK/contents/{+path}","compare_url":"https://api.github.com/repos/hawk2889/LK/compare/{base}...{head}","merges_url":"https://api.github.com/repos/hawk2889/LK/merges","archive_url":"https://api.github.com/repos/hawk2889/LK/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/hawk2889/LK/downloads","issues_url":"https://api.github.com/repos/hawk2889/LK/issues{/number}","pulls_url":"https://api.github.com/repos/hawk2889/LK/pulls{/number}","milestones_url":"https://api.github.com/repos/hawk2889/LK/milestones{/number}","notifications_url":"https://api.github.com/repos/hawk2889/LK/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/hawk2889/LK/labels{/name}","releases_url":"https://api.github.com/repos/hawk2889/LK/releases{/id}","deployments_url":"https://api.github.com/repos/hawk2889/LK/deployments","created_at":"2016-11-28T11:01:58Z","updated_at":"2016-11-28T11:14:14Z","pushed_at":"2016-11-28T11:25:42Z","git_url":"git://github.com/hawk2889/LK.git","ssh_url":"git@github.com:hawk2889/LK.git","clone_url":"https://github.com/hawk2889/LK.git","svn_url":"https://github.com/hawk2889/LK","homepage":null,"size":4,"stargazers_count":0,"watchers_count":0,"language":"JavaScript","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/hawk2889/LK/pulls/1"},"html":{"href":"https://github.com/hawk2889/LK/pull/1"},"issue":{"href":"https://api.github.com/repos/hawk2889/LK/issues/1"},"comments":{"href":"https://api.github.com/repos/hawk2889/LK/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/hawk2889/LK/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/hawk2889/LK/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/hawk2889/LK/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/hawk2889/LK/statuses/9e662f88215d9d467fb7baa8ecabf3a9ab4856cb"}}}}
{"actor":{"display_login":"Zhurbin"}}