{"action":"created","comment":{"url":"https://api.github.com/repos/forkcms/forkcms/pulls/comments/122239261","pull_request_review_id":44332823,"id":122239261,"diff_hunk":"@@ -31,33 +31,32 @@ public function execute(): void\n         $this->id = (int) $deleteFormData['id'];\n \n         // does the item exist\n-        if ($this->id !== 0 && BackendBlogModel::existsCategory($this->id)) {\n-            // get data\n-            $this->record = (array) BackendBlogModel::getCategory($this->id);\n-\n-            // allowed to delete the category?\n-            if (BackendBlogModel::deleteCategoryAllowed($this->id)) {\n-                // call parent, this will probably add some general CSS/JS or other required files\n-                parent::execute();\n-\n-                // delete item\n-                BackendBlogModel::deleteCategory($this->id);\n-\n-                // category was deleted, so redirect\n-                $this->redirect(\n-                    BackendModel::createURLForAction('Categories') . '&report=deleted-category&var=' .\n-                    rawurlencode($this->record['title'])\n-                );\n-            } else {\n-                $this->redirect(\n-                    // delete category not allowed\n-                    BackendModel::createURLForAction('Categories') . '&error=delete-category-not-allowed&var=' .\n-                    rawurlencode($this->record['title'])\n-                );\n-            }\n-        } else {\n-            // something went wrong\n+        if ($this->id === 0 || !BackendBlogModel::existsCategory($this->id)) {\n             $this->redirect(BackendModel::createURLForAction('Categories') . '&error=non-existing');\n         }\n+\n+        // get data\n+        $this->record = (array) BackendBlogModel::getCategory($this->id);\n+\n+        // allowed to delete the category?\n+        if (BackendBlogModel::deleteCategoryAllowed($this->id)) {\n+            // call parent, this will probably add some general CSS/JS or other required files\n+            parent::execute();\n+\n+            // delete item\n+            BackendBlogModel::deleteCategory($this->id);\n+\n+            // category was deleted, so redirect\n+            $this->redirect(\n+                BackendModel::createURLForAction('Categories') . '&report=deleted-category&var=' .\n+                rawurlencode($this->record['title'])\n+            );\n+        } else {","path":"src/Backend/Modules/Blog/Actions/DeleteCategory.php","position":69,"original_position":50,"commit_id":"7834b66b0678bfca60c182b4fe201e4ff45d5d27","original_commit_id":"7e0f84d838c4c1268cfc5a51a2346d588db4f5d5","user":{"login":"carakas","id":3634654,"avatar_url":"https://avatars0.githubusercontent.com/u/3634654?v=3","gravatar_id":"","url":"https://api.github.com/users/carakas","html_url":"https://github.com/carakas","followers_url":"https://api.github.com/users/carakas/followers","following_url":"https://api.github.com/users/carakas/following{/other_user}","gists_url":"https://api.github.com/users/carakas/gists{/gist_id}","starred_url":"https://api.github.com/users/carakas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/carakas/subscriptions","organizations_url":"https://api.github.com/users/carakas/orgs","repos_url":"https://api.github.com/users/carakas/repos","events_url":"https://api.github.com/users/carakas/events{/privacy}","received_events_url":"https://api.github.com/users/carakas/received_events","type":"User","site_admin":false},"body":"we usually add a `return` below the redirect, the redirect will throw an exception but by adding the return it is more clear that the code stops there (if needed maybe also add that in other places)","created_at":"2017-06-15T15:48:50Z","updated_at":"2017-06-15T15:59:39Z","html_url":"https://github.com/forkcms/forkcms/pull/2090#discussion_r122239261","pull_request_url":"https://api.github.com/repos/forkcms/forkcms/pulls/2090","_links":{"self":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/comments/122239261"},"html":{"href":"https://github.com/forkcms/forkcms/pull/2090#discussion_r122239261"},"pull_request":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/2090"}}},"pull_request":{"url":"https://api.github.com/repos/forkcms/forkcms/pulls/2090","id":125358364,"html_url":"https://github.com/forkcms/forkcms/pull/2090","diff_url":"https://github.com/forkcms/forkcms/pull/2090.diff","patch_url":"https://github.com/forkcms/forkcms/pull/2090.patch","issue_url":"https://api.github.com/repos/forkcms/forkcms/issues/2090","number":2090,"state":"open","locked":false,"title":"Use POST request for deleting items","user":{"login":"jonasdekeukelaere","id":4092903,"avatar_url":"https://avatars3.githubusercontent.com/u/4092903?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasdekeukelaere","html_url":"https://github.com/jonasdekeukelaere","followers_url":"https://api.github.com/users/jonasdekeukelaere/followers","following_url":"https://api.github.com/users/jonasdekeukelaere/following{/other_user}","gists_url":"https://api.github.com/users/jonasdekeukelaere/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasdekeukelaere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasdekeukelaere/subscriptions","organizations_url":"https://api.github.com/users/jonasdekeukelaere/orgs","repos_url":"https://api.github.com/users/jonasdekeukelaere/repos","events_url":"https://api.github.com/users/jonasdekeukelaere/events{/privacy}","received_events_url":"https://api.github.com/users/jonasdekeukelaere/received_events","type":"User","site_admin":false},"body":"## Type\r\n- Enhancement\r\n\r\n## Resolves the following issues\r\nfixes #2086 \r\n\r\n## Pull request description\r\nUse post request for deleting items instead of get request.\r\n\r\n","created_at":"2017-06-13T13:04:43Z","updated_at":"2017-06-15T15:59:39Z","closed_at":null,"merged_at":null,"merge_commit_sha":"dc4e19056edc537b567f96da698278d915d09193","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/forkcms/forkcms/pulls/2090/commits","review_comments_url":"https://api.github.com/repos/forkcms/forkcms/pulls/2090/comments","review_comment_url":"https://api.github.com/repos/forkcms/forkcms/pulls/comments{/number}","comments_url":"https://api.github.com/repos/forkcms/forkcms/issues/2090/comments","statuses_url":"https://api.github.com/repos/forkcms/forkcms/statuses/7834b66b0678bfca60c182b4fe201e4ff45d5d27","head":{"label":"jonasdekeukelaere:2086-post-deleting","ref":"2086-post-deleting","sha":"7834b66b0678bfca60c182b4fe201e4ff45d5d27","user":{"login":"jonasdekeukelaere","id":4092903,"avatar_url":"https://avatars3.githubusercontent.com/u/4092903?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasdekeukelaere","html_url":"https://github.com/jonasdekeukelaere","followers_url":"https://api.github.com/users/jonasdekeukelaere/followers","following_url":"https://api.github.com/users/jonasdekeukelaere/following{/other_user}","gists_url":"https://api.github.com/users/jonasdekeukelaere/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasdekeukelaere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasdekeukelaere/subscriptions","organizations_url":"https://api.github.com/users/jonasdekeukelaere/orgs","repos_url":"https://api.github.com/users/jonasdekeukelaere/repos","events_url":"https://api.github.com/users/jonasdekeukelaere/events{/privacy}","received_events_url":"https://api.github.com/users/jonasdekeukelaere/received_events","type":"User","site_admin":false},"repo":{"id":17401003,"name":"forkcms","full_name":"jonasdekeukelaere/forkcms","owner":{"login":"jonasdekeukelaere","id":4092903,"avatar_url":"https://avatars3.githubusercontent.com/u/4092903?v=3","gravatar_id":"","url":"https://api.github.com/users/jonasdekeukelaere","html_url":"https://github.com/jonasdekeukelaere","followers_url":"https://api.github.com/users/jonasdekeukelaere/followers","following_url":"https://api.github.com/users/jonasdekeukelaere/following{/other_user}","gists_url":"https://api.github.com/users/jonasdekeukelaere/gists{/gist_id}","starred_url":"https://api.github.com/users/jonasdekeukelaere/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jonasdekeukelaere/subscriptions","organizations_url":"https://api.github.com/users/jonasdekeukelaere/orgs","repos_url":"https://api.github.com/users/jonasdekeukelaere/repos","events_url":"https://api.github.com/users/jonasdekeukelaere/events{/privacy}","received_events_url":"https://api.github.com/users/jonasdekeukelaere/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jonasdekeukelaere/forkcms","description":"Fork is an open source CMS.","fork":true,"url":"https://api.github.com/repos/jonasdekeukelaere/forkcms","forks_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/forks","keys_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/teams","hooks_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/hooks","issue_events_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/issues/events{/number}","events_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/events","assignees_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/assignees{/user}","branches_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/branches{/branch}","tags_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/tags","blobs_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/git/refs{/sha}","trees_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/statuses/{sha}","languages_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/languages","stargazers_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/stargazers","contributors_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/contributors","subscribers_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/subscribers","subscription_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/subscription","commits_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/commits{/sha}","git_commits_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/git/commits{/sha}","comments_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/comments{/number}","issue_comment_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/issues/comments{/number}","contents_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/contents/{+path}","compare_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/merges","archive_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/downloads","issues_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/issues{/number}","pulls_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/pulls{/number}","milestones_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/milestones{/number}","notifications_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/labels{/name}","releases_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/releases{/id}","deployments_url":"https://api.github.com/repos/jonasdekeukelaere/forkcms/deployments","created_at":"2014-03-04T12:21:34Z","updated_at":"2016-01-12T11:19:43Z","pushed_at":"2017-06-15T14:22:27Z","git_url":"git://github.com/jonasdekeukelaere/forkcms.git","ssh_url":"git@github.com:jonasdekeukelaere/forkcms.git","clone_url":"https://github.com/jonasdekeukelaere/forkcms.git","svn_url":"https://github.com/jonasdekeukelaere/forkcms","homepage":"http://www.fork-cms.com","size":65584,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"forkcms:5.0.0-dev","ref":"5.0.0-dev","sha":"7cb62564c68088d7b155b01377ec11125b49b538","user":{"login":"forkcms","id":312505,"avatar_url":"https://avatars2.githubusercontent.com/u/312505?v=3","gravatar_id":"","url":"https://api.github.com/users/forkcms","html_url":"https://github.com/forkcms","followers_url":"https://api.github.com/users/forkcms/followers","following_url":"https://api.github.com/users/forkcms/following{/other_user}","gists_url":"https://api.github.com/users/forkcms/gists{/gist_id}","starred_url":"https://api.github.com/users/forkcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forkcms/subscriptions","organizations_url":"https://api.github.com/users/forkcms/orgs","repos_url":"https://api.github.com/users/forkcms/repos","events_url":"https://api.github.com/users/forkcms/events{/privacy}","received_events_url":"https://api.github.com/users/forkcms/received_events","type":"Organization","site_admin":false},"repo":{"id":1138583,"name":"forkcms","full_name":"forkcms/forkcms","owner":{"login":"forkcms","id":312505,"avatar_url":"https://avatars2.githubusercontent.com/u/312505?v=3","gravatar_id":"","url":"https://api.github.com/users/forkcms","html_url":"https://github.com/forkcms","followers_url":"https://api.github.com/users/forkcms/followers","following_url":"https://api.github.com/users/forkcms/following{/other_user}","gists_url":"https://api.github.com/users/forkcms/gists{/gist_id}","starred_url":"https://api.github.com/users/forkcms/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/forkcms/subscriptions","organizations_url":"https://api.github.com/users/forkcms/orgs","repos_url":"https://api.github.com/users/forkcms/repos","events_url":"https://api.github.com/users/forkcms/events{/privacy}","received_events_url":"https://api.github.com/users/forkcms/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/forkcms/forkcms","description":"Fork is an easy to use open source CMS using Symfony Components.","fork":false,"url":"https://api.github.com/repos/forkcms/forkcms","forks_url":"https://api.github.com/repos/forkcms/forkcms/forks","keys_url":"https://api.github.com/repos/forkcms/forkcms/keys{/key_id}","collaborators_url":"https://api.github.com/repos/forkcms/forkcms/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/forkcms/forkcms/teams","hooks_url":"https://api.github.com/repos/forkcms/forkcms/hooks","issue_events_url":"https://api.github.com/repos/forkcms/forkcms/issues/events{/number}","events_url":"https://api.github.com/repos/forkcms/forkcms/events","assignees_url":"https://api.github.com/repos/forkcms/forkcms/assignees{/user}","branches_url":"https://api.github.com/repos/forkcms/forkcms/branches{/branch}","tags_url":"https://api.github.com/repos/forkcms/forkcms/tags","blobs_url":"https://api.github.com/repos/forkcms/forkcms/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/forkcms/forkcms/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/forkcms/forkcms/git/refs{/sha}","trees_url":"https://api.github.com/repos/forkcms/forkcms/git/trees{/sha}","statuses_url":"https://api.github.com/repos/forkcms/forkcms/statuses/{sha}","languages_url":"https://api.github.com/repos/forkcms/forkcms/languages","stargazers_url":"https://api.github.com/repos/forkcms/forkcms/stargazers","contributors_url":"https://api.github.com/repos/forkcms/forkcms/contributors","subscribers_url":"https://api.github.com/repos/forkcms/forkcms/subscribers","subscription_url":"https://api.github.com/repos/forkcms/forkcms/subscription","commits_url":"https://api.github.com/repos/forkcms/forkcms/commits{/sha}","git_commits_url":"https://api.github.com/repos/forkcms/forkcms/git/commits{/sha}","comments_url":"https://api.github.com/repos/forkcms/forkcms/comments{/number}","issue_comment_url":"https://api.github.com/repos/forkcms/forkcms/issues/comments{/number}","contents_url":"https://api.github.com/repos/forkcms/forkcms/contents/{+path}","compare_url":"https://api.github.com/repos/forkcms/forkcms/compare/{base}...{head}","merges_url":"https://api.github.com/repos/forkcms/forkcms/merges","archive_url":"https://api.github.com/repos/forkcms/forkcms/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/forkcms/forkcms/downloads","issues_url":"https://api.github.com/repos/forkcms/forkcms/issues{/number}","pulls_url":"https://api.github.com/repos/forkcms/forkcms/pulls{/number}","milestones_url":"https://api.github.com/repos/forkcms/forkcms/milestones{/number}","notifications_url":"https://api.github.com/repos/forkcms/forkcms/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/forkcms/forkcms/labels{/name}","releases_url":"https://api.github.com/repos/forkcms/forkcms/releases{/id}","deployments_url":"https://api.github.com/repos/forkcms/forkcms/deployments","created_at":"2010-12-04T18:06:15Z","updated_at":"2017-06-13T12:03:54Z","pushed_at":"2017-06-15T15:49:19Z","git_url":"git://github.com/forkcms/forkcms.git","ssh_url":"git@github.com:forkcms/forkcms.git","clone_url":"https://github.com/forkcms/forkcms.git","svn_url":"https://github.com/forkcms/forkcms","homepage":"http://www.fork-cms.com","size":61131,"stargazers_count":968,"watchers_count":968,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":246,"mirror_url":null,"open_issues_count":55,"forks":246,"open_issues":55,"watchers":968,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/2090"},"html":{"href":"https://github.com/forkcms/forkcms/pull/2090"},"issue":{"href":"https://api.github.com/repos/forkcms/forkcms/issues/2090"},"comments":{"href":"https://api.github.com/repos/forkcms/forkcms/issues/2090/comments"},"review_comments":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/2090/comments"},"review_comment":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/forkcms/forkcms/pulls/2090/commits"},"statuses":{"href":"https://api.github.com/repos/forkcms/forkcms/statuses/7834b66b0678bfca60c182b4fe201e4ff45d5d27"}}}}
{"actor":{"display_login":"carakas"}}