{"action":"created","comment":{"url":"https://api.github.com/repos/Viktik/Yii/pulls/comments/214037772","pull_request_review_id":151003066,"id":214037772,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIxNDAzNzc3Mg==","diff_hunk":"@@ -33,18 +37,161 @@ public function behaviors()\n         ];\n     }\n \n-    public function actionIndex()\n+    public function actionIndex($id = null)\n     {\n+        $user = $this->findModel($id);\n         $model = new UploadForm();\n-        $user = Yii::$app->user->identity;\n+        $quantity = Posts::find()\n+            ->where(['user_id' => $user->id])\n+            ->count();\n+\n+        $sub = $this->findSub($id);\n+        if ($sub->status == 1) {\n+            $isSub = true;\n+        } else {\n+            $isSub = false;\n+        }\n \n         if (Yii::$app->request->isPost) {\n             $model->imageFile = UploadedFile::getInstance($model, 'imageFile');\n             if ($model->upload($filename = 'user' . $user->id)) {\n                 // file is uploaded successfully\n-                return $this->render('index', compact('user', 'model'));\n+                return $this->render('index', compact('user', 'model', 'quantity', 'id', 'isSub'));\n+            }\n+        }\n+        return $this->render('index', compact('user', 'model', 'quantity', 'id', 'isSub'));\n+    }\n+\n+    public function actionUpdate()\n+    {\n+        $model = new SignupForm();\n+        $currentUser = $this->findModel();\n+\n+        if ($model->load(Yii::$app->request->post())) {\n+            if ($user = $model->update($currentUser)) {\n+                    return $this->redirect(['profile/index']);\n             }\n         }\n-        return $this->render('index', compact('user', 'model'));\n+\n+        return $this->render('update', [\n+            'model' => $model,\n+        ]);\n+    }\n+\n+    protected function findModel($id = null)\n+    {\n+        if ($id == null){\n+            $id = Yii::$app->user->identity->id;\n+        }\n+        if (($model = User::findOne($id)) !== null) {\n+            return $model;\n+        }\n+\n+        throw new NotFoundHttpException('The requested page does not exist.');\n+    }\n+\n+    protected function findSub($user_id)\n+    {\n+        $subscriber_id = Yii::$app->user->identity->id;\n+        $model = Subscribes::findOne([\n+            'subscriber_id' => $subscriber_id,\n+            'user_id' => $user_id,\n+        ]);\n+\n+        if ($model) {\n+            return $model;\n+        } else {\n+            return false;\n+        }\n+    }\n+\n+    public function actionCreate()","path":"backend/controllers/ProfileController.php","position":100,"original_position":100,"commit_id":"490cb5ffc8ee9fb784f017b2431793f10a589193","original_commit_id":"490cb5ffc8ee9fb784f017b2431793f10a589193","user":{"login":"alguret","id":7387185,"node_id":"MDQ6VXNlcjczODcxODU=","avatar_url":"https://avatars3.githubusercontent.com/u/7387185?v=4","gravatar_id":"","url":"https://api.github.com/users/alguret","html_url":"https://github.com/alguret","followers_url":"https://api.github.com/users/alguret/followers","following_url":"https://api.github.com/users/alguret/following{/other_user}","gists_url":"https://api.github.com/users/alguret/gists{/gist_id}","starred_url":"https://api.github.com/users/alguret/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alguret/subscriptions","organizations_url":"https://api.github.com/users/alguret/orgs","repos_url":"https://api.github.com/users/alguret/repos","events_url":"https://api.github.com/users/alguret/events{/privacy}","received_events_url":"https://api.github.com/users/alguret/received_events","type":"User","site_admin":false},"body":"create в ProfileController'e? looks strange. новый пост наверное не тут должен создаваться)","created_at":"2018-08-30T13:49:03Z","updated_at":"2018-08-30T13:49:04Z","html_url":"https://github.com/Viktik/Yii/pull/12#discussion_r214037772","pull_request_url":"https://api.github.com/repos/Viktik/Yii/pulls/12","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/comments/214037772"},"html":{"href":"https://github.com/Viktik/Yii/pull/12#discussion_r214037772"},"pull_request":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/12"}}},"pull_request":{"url":"https://api.github.com/repos/Viktik/Yii/pulls/12","id":211013506,"node_id":"MDExOlB1bGxSZXF1ZXN0MjExMDEzNTA2","html_url":"https://github.com/Viktik/Yii/pull/12","diff_url":"https://github.com/Viktik/Yii/pull/12.diff","patch_url":"https://github.com/Viktik/Yii/pull/12.patch","issue_url":"https://api.github.com/repos/Viktik/Yii/issues/12","number":12,"state":"open","locked":false,"title":"Tasks/fat 1902","user":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-08-27T06:06:36Z","updated_at":"2018-08-30T13:49:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"51390ee251c9c73fd45fc8b2db441b6a1b95ce5f","assignee":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"assignees":[{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false}],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":1004209690,"node_id":"MDU6TGFiZWwxMDA0MjA5Njkw","url":"https://api.github.com/repos/Viktik/Yii/labels/enhancement","name":"enhancement","color":"a2eeef","default":true}],"milestone":null,"commits_url":"https://api.github.com/repos/Viktik/Yii/pulls/12/commits","review_comments_url":"https://api.github.com/repos/Viktik/Yii/pulls/12/comments","review_comment_url":"https://api.github.com/repos/Viktik/Yii/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Viktik/Yii/issues/12/comments","statuses_url":"https://api.github.com/repos/Viktik/Yii/statuses/490cb5ffc8ee9fb784f017b2431793f10a589193","head":{"label":"Viktik:tasks/FAT-1902","ref":"tasks/FAT-1902","sha":"490cb5ffc8ee9fb784f017b2431793f10a589193","user":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"repo":{"id":142258745,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIyNTg3NDU=","name":"Yii","full_name":"Viktik/Yii","owner":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Viktik/Yii","description":null,"fork":false,"url":"https://api.github.com/repos/Viktik/Yii","forks_url":"https://api.github.com/repos/Viktik/Yii/forks","keys_url":"https://api.github.com/repos/Viktik/Yii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Viktik/Yii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Viktik/Yii/teams","hooks_url":"https://api.github.com/repos/Viktik/Yii/hooks","issue_events_url":"https://api.github.com/repos/Viktik/Yii/issues/events{/number}","events_url":"https://api.github.com/repos/Viktik/Yii/events","assignees_url":"https://api.github.com/repos/Viktik/Yii/assignees{/user}","branches_url":"https://api.github.com/repos/Viktik/Yii/branches{/branch}","tags_url":"https://api.github.com/repos/Viktik/Yii/tags","blobs_url":"https://api.github.com/repos/Viktik/Yii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Viktik/Yii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Viktik/Yii/git/refs{/sha}","trees_url":"https://api.github.com/repos/Viktik/Yii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Viktik/Yii/statuses/{sha}","languages_url":"https://api.github.com/repos/Viktik/Yii/languages","stargazers_url":"https://api.github.com/repos/Viktik/Yii/stargazers","contributors_url":"https://api.github.com/repos/Viktik/Yii/contributors","subscribers_url":"https://api.github.com/repos/Viktik/Yii/subscribers","subscription_url":"https://api.github.com/repos/Viktik/Yii/subscription","commits_url":"https://api.github.com/repos/Viktik/Yii/commits{/sha}","git_commits_url":"https://api.github.com/repos/Viktik/Yii/git/commits{/sha}","comments_url":"https://api.github.com/repos/Viktik/Yii/comments{/number}","issue_comment_url":"https://api.github.com/repos/Viktik/Yii/issues/comments{/number}","contents_url":"https://api.github.com/repos/Viktik/Yii/contents/{+path}","compare_url":"https://api.github.com/repos/Viktik/Yii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Viktik/Yii/merges","archive_url":"https://api.github.com/repos/Viktik/Yii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Viktik/Yii/downloads","issues_url":"https://api.github.com/repos/Viktik/Yii/issues{/number}","pulls_url":"https://api.github.com/repos/Viktik/Yii/pulls{/number}","milestones_url":"https://api.github.com/repos/Viktik/Yii/milestones{/number}","notifications_url":"https://api.github.com/repos/Viktik/Yii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Viktik/Yii/labels{/name}","releases_url":"https://api.github.com/repos/Viktik/Yii/releases{/id}","deployments_url":"https://api.github.com/repos/Viktik/Yii/deployments","created_at":"2018-07-25T06:43:21Z","updated_at":"2018-07-25T06:50:50Z","pushed_at":"2018-08-27T07:33:29Z","git_url":"git://github.com/Viktik/Yii.git","ssh_url":"git@github.com:Viktik/Yii.git","clone_url":"https://github.com/Viktik/Yii.git","svn_url":"https://github.com/Viktik/Yii","homepage":null,"size":204,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"base":{"label":"Viktik:develop","ref":"develop","sha":"b9d52d3484fa721a2eecc4087dfd01c9a566ae69","user":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"repo":{"id":142258745,"node_id":"MDEwOlJlcG9zaXRvcnkxNDIyNTg3NDU=","name":"Yii","full_name":"Viktik/Yii","owner":{"login":"Viktik","id":30257465,"node_id":"MDQ6VXNlcjMwMjU3NDY1","avatar_url":"https://avatars1.githubusercontent.com/u/30257465?v=4","gravatar_id":"","url":"https://api.github.com/users/Viktik","html_url":"https://github.com/Viktik","followers_url":"https://api.github.com/users/Viktik/followers","following_url":"https://api.github.com/users/Viktik/following{/other_user}","gists_url":"https://api.github.com/users/Viktik/gists{/gist_id}","starred_url":"https://api.github.com/users/Viktik/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Viktik/subscriptions","organizations_url":"https://api.github.com/users/Viktik/orgs","repos_url":"https://api.github.com/users/Viktik/repos","events_url":"https://api.github.com/users/Viktik/events{/privacy}","received_events_url":"https://api.github.com/users/Viktik/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/Viktik/Yii","description":null,"fork":false,"url":"https://api.github.com/repos/Viktik/Yii","forks_url":"https://api.github.com/repos/Viktik/Yii/forks","keys_url":"https://api.github.com/repos/Viktik/Yii/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Viktik/Yii/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Viktik/Yii/teams","hooks_url":"https://api.github.com/repos/Viktik/Yii/hooks","issue_events_url":"https://api.github.com/repos/Viktik/Yii/issues/events{/number}","events_url":"https://api.github.com/repos/Viktik/Yii/events","assignees_url":"https://api.github.com/repos/Viktik/Yii/assignees{/user}","branches_url":"https://api.github.com/repos/Viktik/Yii/branches{/branch}","tags_url":"https://api.github.com/repos/Viktik/Yii/tags","blobs_url":"https://api.github.com/repos/Viktik/Yii/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Viktik/Yii/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Viktik/Yii/git/refs{/sha}","trees_url":"https://api.github.com/repos/Viktik/Yii/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Viktik/Yii/statuses/{sha}","languages_url":"https://api.github.com/repos/Viktik/Yii/languages","stargazers_url":"https://api.github.com/repos/Viktik/Yii/stargazers","contributors_url":"https://api.github.com/repos/Viktik/Yii/contributors","subscribers_url":"https://api.github.com/repos/Viktik/Yii/subscribers","subscription_url":"https://api.github.com/repos/Viktik/Yii/subscription","commits_url":"https://api.github.com/repos/Viktik/Yii/commits{/sha}","git_commits_url":"https://api.github.com/repos/Viktik/Yii/git/commits{/sha}","comments_url":"https://api.github.com/repos/Viktik/Yii/comments{/number}","issue_comment_url":"https://api.github.com/repos/Viktik/Yii/issues/comments{/number}","contents_url":"https://api.github.com/repos/Viktik/Yii/contents/{+path}","compare_url":"https://api.github.com/repos/Viktik/Yii/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Viktik/Yii/merges","archive_url":"https://api.github.com/repos/Viktik/Yii/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Viktik/Yii/downloads","issues_url":"https://api.github.com/repos/Viktik/Yii/issues{/number}","pulls_url":"https://api.github.com/repos/Viktik/Yii/pulls{/number}","milestones_url":"https://api.github.com/repos/Viktik/Yii/milestones{/number}","notifications_url":"https://api.github.com/repos/Viktik/Yii/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Viktik/Yii/labels{/name}","releases_url":"https://api.github.com/repos/Viktik/Yii/releases{/id}","deployments_url":"https://api.github.com/repos/Viktik/Yii/deployments","created_at":"2018-07-25T06:43:21Z","updated_at":"2018-07-25T06:50:50Z","pushed_at":"2018-08-27T07:33:29Z","git_url":"git://github.com/Viktik/Yii.git","ssh_url":"git@github.com:Viktik/Yii.git","clone_url":"https://github.com/Viktik/Yii.git","svn_url":"https://github.com/Viktik/Yii","homepage":null,"size":204,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":6,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":6,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/12"},"html":{"href":"https://github.com/Viktik/Yii/pull/12"},"issue":{"href":"https://api.github.com/repos/Viktik/Yii/issues/12"},"comments":{"href":"https://api.github.com/repos/Viktik/Yii/issues/12/comments"},"review_comments":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/12/comments"},"review_comment":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Viktik/Yii/pulls/12/commits"},"statuses":{"href":"https://api.github.com/repos/Viktik/Yii/statuses/490cb5ffc8ee9fb784f017b2431793f10a589193"}},"author_association":"OWNER"}}
{"actor":{"display_login":"alguret"}}