{"action":"created","comment":{"url":"https://api.github.com/repos/phanbook/phanbook/pulls/comments/106777646","pull_request_review_id":27721048,"id":106777646,"diff_hunk":"@@ -111,17 +111,53 @@ public function weeklyAction()\n             $this->flashSession->error(t('Please input your Email'));\n             return $this->indexRedirect();\n         }\n-        $subscribe = new Subscribe();\n+        $subscribe = Subscribe::findFirstByEmail($email);\n+        if (!$subscribe) {\n+            $subscribe = new Subscribe();\n+            $subscribe->setEmail($email);\n+        }\n         $subscribe->setStatus('Y');\n-        $subscribe->setEmail($email);\n \n         if (!$subscribe->save()) {\n             foreach ($subscribe->getMessages() as $message) {\n                 $this->flashSession->error($message);\n                 return $this->indexRedirect();\n             }\n         }\n+        $name   = $this->config->application->name;\n+        $link   = ($this->request->isSecure()\n+                ? 'https://' : 'http://') . $this->request->getHttpHost();\n+        $params = [\n+            'link'    => $link,\n+            'unLink'  => $link . '/subscribe/remove?email=' . urlencode($this->crypt->encryptBase64(trim($email))),","path":"core/modules/frontend/controllers/SubscribeController.php","position":24,"original_position":24,"commit_id":"82a0a95565220a5a9a500b894f268395eeaa2bca","original_commit_id":"82a0a95565220a5a9a500b894f268395eeaa2bca","user":{"login":"duythien","id":1762691,"avatar_url":"https://avatars0.githubusercontent.com/u/1762691?v=3","gravatar_id":"","url":"https://api.github.com/users/duythien","html_url":"https://github.com/duythien","followers_url":"https://api.github.com/users/duythien/followers","following_url":"https://api.github.com/users/duythien/following{/other_user}","gists_url":"https://api.github.com/users/duythien/gists{/gist_id}","starred_url":"https://api.github.com/users/duythien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duythien/subscriptions","organizations_url":"https://api.github.com/users/duythien/orgs","repos_url":"https://api.github.com/users/duythien/repos","events_url":"https://api.github.com/users/duythien/events{/privacy}","received_events_url":"https://api.github.com/users/duythien/received_events","type":"User","site_admin":false},"body":"I think It can","created_at":"2017-03-18T09:51:28Z","updated_at":"2017-03-18T09:51:28Z","html_url":"https://github.com/phanbook/phanbook/pull/236#discussion_r106777646","pull_request_url":"https://api.github.com/repos/phanbook/phanbook/pulls/236","_links":{"self":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/comments/106777646"},"html":{"href":"https://github.com/phanbook/phanbook/pull/236#discussion_r106777646"},"pull_request":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/236"}}},"pull_request":{"url":"https://api.github.com/repos/phanbook/phanbook/pulls/236","id":111398554,"html_url":"https://github.com/phanbook/phanbook/pull/236","diff_url":"https://github.com/phanbook/phanbook/pull/236.diff","patch_url":"https://github.com/phanbook/phanbook/pull/236.patch","issue_url":"https://api.github.com/repos/phanbook/phanbook/issues/236","number":236,"state":"open","locked":false,"title":"Add and remove subscribe","user":{"login":"duythien","id":1762691,"avatar_url":"https://avatars0.githubusercontent.com/u/1762691?v=3","gravatar_id":"","url":"https://api.github.com/users/duythien","html_url":"https://github.com/duythien","followers_url":"https://api.github.com/users/duythien/followers","following_url":"https://api.github.com/users/duythien/following{/other_user}","gists_url":"https://api.github.com/users/duythien/gists{/gist_id}","starred_url":"https://api.github.com/users/duythien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duythien/subscriptions","organizations_url":"https://api.github.com/users/duythien/orgs","repos_url":"https://api.github.com/users/duythien/repos","events_url":"https://api.github.com/users/duythien/events{/privacy}","received_events_url":"https://api.github.com/users/duythien/received_events","type":"User","site_admin":false},"body":"","created_at":"2017-03-18T05:54:47Z","updated_at":"2017-03-18T09:51:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"f44ae4402d2769ae9d93218a1d6df4c06cf05489","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/phanbook/phanbook/pulls/236/commits","review_comments_url":"https://api.github.com/repos/phanbook/phanbook/pulls/236/comments","review_comment_url":"https://api.github.com/repos/phanbook/phanbook/pulls/comments{/number}","comments_url":"https://api.github.com/repos/phanbook/phanbook/issues/236/comments","statuses_url":"https://api.github.com/repos/phanbook/phanbook/statuses/82a0a95565220a5a9a500b894f268395eeaa2bca","head":{"label":"duythien:develop","ref":"develop","sha":"82a0a95565220a5a9a500b894f268395eeaa2bca","user":{"login":"duythien","id":1762691,"avatar_url":"https://avatars0.githubusercontent.com/u/1762691?v=3","gravatar_id":"","url":"https://api.github.com/users/duythien","html_url":"https://github.com/duythien","followers_url":"https://api.github.com/users/duythien/followers","following_url":"https://api.github.com/users/duythien/following{/other_user}","gists_url":"https://api.github.com/users/duythien/gists{/gist_id}","starred_url":"https://api.github.com/users/duythien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duythien/subscriptions","organizations_url":"https://api.github.com/users/duythien/orgs","repos_url":"https://api.github.com/users/duythien/repos","events_url":"https://api.github.com/users/duythien/events{/privacy}","received_events_url":"https://api.github.com/users/duythien/received_events","type":"User","site_admin":false},"repo":{"id":72172354,"name":"phanbook","full_name":"duythien/phanbook","owner":{"login":"duythien","id":1762691,"avatar_url":"https://avatars0.githubusercontent.com/u/1762691?v=3","gravatar_id":"","url":"https://api.github.com/users/duythien","html_url":"https://github.com/duythien","followers_url":"https://api.github.com/users/duythien/followers","following_url":"https://api.github.com/users/duythien/following{/other_user}","gists_url":"https://api.github.com/users/duythien/gists{/gist_id}","starred_url":"https://api.github.com/users/duythien/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/duythien/subscriptions","organizations_url":"https://api.github.com/users/duythien/orgs","repos_url":"https://api.github.com/users/duythien/repos","events_url":"https://api.github.com/users/duythien/events{/privacy}","received_events_url":"https://api.github.com/users/duythien/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/duythien/phanbook","description":"A Q&A, CMS and Forum PHP platform","fork":true,"url":"https://api.github.com/repos/duythien/phanbook","forks_url":"https://api.github.com/repos/duythien/phanbook/forks","keys_url":"https://api.github.com/repos/duythien/phanbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/duythien/phanbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/duythien/phanbook/teams","hooks_url":"https://api.github.com/repos/duythien/phanbook/hooks","issue_events_url":"https://api.github.com/repos/duythien/phanbook/issues/events{/number}","events_url":"https://api.github.com/repos/duythien/phanbook/events","assignees_url":"https://api.github.com/repos/duythien/phanbook/assignees{/user}","branches_url":"https://api.github.com/repos/duythien/phanbook/branches{/branch}","tags_url":"https://api.github.com/repos/duythien/phanbook/tags","blobs_url":"https://api.github.com/repos/duythien/phanbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/duythien/phanbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/duythien/phanbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/duythien/phanbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/duythien/phanbook/statuses/{sha}","languages_url":"https://api.github.com/repos/duythien/phanbook/languages","stargazers_url":"https://api.github.com/repos/duythien/phanbook/stargazers","contributors_url":"https://api.github.com/repos/duythien/phanbook/contributors","subscribers_url":"https://api.github.com/repos/duythien/phanbook/subscribers","subscription_url":"https://api.github.com/repos/duythien/phanbook/subscription","commits_url":"https://api.github.com/repos/duythien/phanbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/duythien/phanbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/duythien/phanbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/duythien/phanbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/duythien/phanbook/contents/{+path}","compare_url":"https://api.github.com/repos/duythien/phanbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/duythien/phanbook/merges","archive_url":"https://api.github.com/repos/duythien/phanbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/duythien/phanbook/downloads","issues_url":"https://api.github.com/repos/duythien/phanbook/issues{/number}","pulls_url":"https://api.github.com/repos/duythien/phanbook/pulls{/number}","milestones_url":"https://api.github.com/repos/duythien/phanbook/milestones{/number}","notifications_url":"https://api.github.com/repos/duythien/phanbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/duythien/phanbook/labels{/name}","releases_url":"https://api.github.com/repos/duythien/phanbook/releases{/id}","deployments_url":"https://api.github.com/repos/duythien/phanbook/deployments","created_at":"2016-10-28T04:07:27Z","updated_at":"2016-10-28T04:07:29Z","pushed_at":"2017-03-18T05:53:29Z","git_url":"git://github.com/duythien/phanbook.git","ssh_url":"git@github.com:duythien/phanbook.git","clone_url":"https://github.com/duythien/phanbook.git","svn_url":"https://github.com/duythien/phanbook","homepage":"http://phanbook.com","size":8761,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"phanbook:develop","ref":"develop","sha":"52ba8cdb4b9660f8fb7d3794b1e2f88f8c7c55de","user":{"login":"phanbook","id":12541168,"avatar_url":"https://avatars3.githubusercontent.com/u/12541168?v=3","gravatar_id":"","url":"https://api.github.com/users/phanbook","html_url":"https://github.com/phanbook","followers_url":"https://api.github.com/users/phanbook/followers","following_url":"https://api.github.com/users/phanbook/following{/other_user}","gists_url":"https://api.github.com/users/phanbook/gists{/gist_id}","starred_url":"https://api.github.com/users/phanbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phanbook/subscriptions","organizations_url":"https://api.github.com/users/phanbook/orgs","repos_url":"https://api.github.com/users/phanbook/repos","events_url":"https://api.github.com/users/phanbook/events{/privacy}","received_events_url":"https://api.github.com/users/phanbook/received_events","type":"Organization","site_admin":false},"repo":{"id":36341941,"name":"phanbook","full_name":"phanbook/phanbook","owner":{"login":"phanbook","id":12541168,"avatar_url":"https://avatars3.githubusercontent.com/u/12541168?v=3","gravatar_id":"","url":"https://api.github.com/users/phanbook","html_url":"https://github.com/phanbook","followers_url":"https://api.github.com/users/phanbook/followers","following_url":"https://api.github.com/users/phanbook/following{/other_user}","gists_url":"https://api.github.com/users/phanbook/gists{/gist_id}","starred_url":"https://api.github.com/users/phanbook/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/phanbook/subscriptions","organizations_url":"https://api.github.com/users/phanbook/orgs","repos_url":"https://api.github.com/users/phanbook/repos","events_url":"https://api.github.com/users/phanbook/events{/privacy}","received_events_url":"https://api.github.com/users/phanbook/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/phanbook/phanbook","description":"A Q&A and Forum PHP platform","fork":false,"url":"https://api.github.com/repos/phanbook/phanbook","forks_url":"https://api.github.com/repos/phanbook/phanbook/forks","keys_url":"https://api.github.com/repos/phanbook/phanbook/keys{/key_id}","collaborators_url":"https://api.github.com/repos/phanbook/phanbook/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/phanbook/phanbook/teams","hooks_url":"https://api.github.com/repos/phanbook/phanbook/hooks","issue_events_url":"https://api.github.com/repos/phanbook/phanbook/issues/events{/number}","events_url":"https://api.github.com/repos/phanbook/phanbook/events","assignees_url":"https://api.github.com/repos/phanbook/phanbook/assignees{/user}","branches_url":"https://api.github.com/repos/phanbook/phanbook/branches{/branch}","tags_url":"https://api.github.com/repos/phanbook/phanbook/tags","blobs_url":"https://api.github.com/repos/phanbook/phanbook/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/phanbook/phanbook/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/phanbook/phanbook/git/refs{/sha}","trees_url":"https://api.github.com/repos/phanbook/phanbook/git/trees{/sha}","statuses_url":"https://api.github.com/repos/phanbook/phanbook/statuses/{sha}","languages_url":"https://api.github.com/repos/phanbook/phanbook/languages","stargazers_url":"https://api.github.com/repos/phanbook/phanbook/stargazers","contributors_url":"https://api.github.com/repos/phanbook/phanbook/contributors","subscribers_url":"https://api.github.com/repos/phanbook/phanbook/subscribers","subscription_url":"https://api.github.com/repos/phanbook/phanbook/subscription","commits_url":"https://api.github.com/repos/phanbook/phanbook/commits{/sha}","git_commits_url":"https://api.github.com/repos/phanbook/phanbook/git/commits{/sha}","comments_url":"https://api.github.com/repos/phanbook/phanbook/comments{/number}","issue_comment_url":"https://api.github.com/repos/phanbook/phanbook/issues/comments{/number}","contents_url":"https://api.github.com/repos/phanbook/phanbook/contents/{+path}","compare_url":"https://api.github.com/repos/phanbook/phanbook/compare/{base}...{head}","merges_url":"https://api.github.com/repos/phanbook/phanbook/merges","archive_url":"https://api.github.com/repos/phanbook/phanbook/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/phanbook/phanbook/downloads","issues_url":"https://api.github.com/repos/phanbook/phanbook/issues{/number}","pulls_url":"https://api.github.com/repos/phanbook/phanbook/pulls{/number}","milestones_url":"https://api.github.com/repos/phanbook/phanbook/milestones{/number}","notifications_url":"https://api.github.com/repos/phanbook/phanbook/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/phanbook/phanbook/labels{/name}","releases_url":"https://api.github.com/repos/phanbook/phanbook/releases{/id}","deployments_url":"https://api.github.com/repos/phanbook/phanbook/deployments","created_at":"2015-05-27T04:06:43Z","updated_at":"2017-03-11T07:47:34Z","pushed_at":"2017-03-18T05:54:47Z","git_url":"git://github.com/phanbook/phanbook.git","ssh_url":"git@github.com:phanbook/phanbook.git","clone_url":"https://github.com/phanbook/phanbook.git","svn_url":"https://github.com/phanbook/phanbook","homepage":"http://phanbook.com","size":8758,"stargazers_count":255,"watchers_count":255,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":58,"mirror_url":null,"open_issues_count":23,"forks":58,"open_issues":23,"watchers":255,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/236"},"html":{"href":"https://github.com/phanbook/phanbook/pull/236"},"issue":{"href":"https://api.github.com/repos/phanbook/phanbook/issues/236"},"comments":{"href":"https://api.github.com/repos/phanbook/phanbook/issues/236/comments"},"review_comments":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/236/comments"},"review_comment":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/phanbook/phanbook/pulls/236/commits"},"statuses":{"href":"https://api.github.com/repos/phanbook/phanbook/statuses/82a0a95565220a5a9a500b894f268395eeaa2bca"}}}}
{"actor":{"display_login":"duythien"}}