{"action":"created","comment":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/26050041","id":26050041,"diff_hunk":"@@ -1987,14 +1987,19 @@ public function delete($recursive = true) {\n \t\t\treturn false;\n \t\t}\n \t\t\n-\t\tif (!_elgg_services()->events->trigger('delete', $this->type, $this)) {\n-\t\t\treturn false;\n-\t\t}\n-\t\t\n+\t\t// first check if we have edit access to this entity\n+\t\t// NOTE: in Elgg <= 1.10.3 this was after the delete event, \n+\t\t// which could potentialy remove some content if the user didn't have access","path":"engine/classes/ElggEntity.php","position":10,"original_position":10,"commit_id":"1e2aa00c2f2df04e9b9e56dabcc892d357ca1e33","original_commit_id":"1e2aa00c2f2df04e9b9e56dabcc892d357ca1e33","user":{"login":"juho-jaakkola","id":883920,"avatar_url":"https://avatars.githubusercontent.com/u/883920?v=3","gravatar_id":"","url":"https://api.github.com/users/juho-jaakkola","html_url":"https://github.com/juho-jaakkola","followers_url":"https://api.github.com/users/juho-jaakkola/followers","following_url":"https://api.github.com/users/juho-jaakkola/following{/other_user}","gists_url":"https://api.github.com/users/juho-jaakkola/gists{/gist_id}","starred_url":"https://api.github.com/users/juho-jaakkola/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/juho-jaakkola/subscriptions","organizations_url":"https://api.github.com/users/juho-jaakkola/orgs","repos_url":"https://api.github.com/users/juho-jaakkola/repos","events_url":"https://api.github.com/users/juho-jaakkola/events{/privacy}","received_events_url":"https://api.github.com/users/juho-jaakkola/received_events","type":"User","site_admin":false},"body":"potentially","created_at":"2015-03-09T16:20:20Z","updated_at":"2015-03-09T16:20:20Z","html_url":"https://github.com/Elgg/Elgg/pull/7992#discussion_r26050041","pull_request_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7992","_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments/26050041"},"html":{"href":"https://github.com/Elgg/Elgg/pull/7992#discussion_r26050041"},"pull_request":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7992"}}},"pull_request":{"url":"https://api.github.com/repos/Elgg/Elgg/pulls/7992","id":29811696,"html_url":"https://github.com/Elgg/Elgg/pull/7992","diff_url":"https://github.com/Elgg/Elgg/pull/7992.diff","patch_url":"https://github.com/Elgg/Elgg/pull/7992.patch","issue_url":"https://api.github.com/repos/Elgg/Elgg/issues/7992","number":7992,"state":"open","locked":false,"title":"fix(core): don't trigger delete event when you can't edit the entity","user":{"login":"jeabakker","id":881958,"avatar_url":"https://avatars.githubusercontent.com/u/881958?v=3","gravatar_id":"","url":"https://api.github.com/users/jeabakker","html_url":"https://github.com/jeabakker","followers_url":"https://api.github.com/users/jeabakker/followers","following_url":"https://api.github.com/users/jeabakker/following{/other_user}","gists_url":"https://api.github.com/users/jeabakker/gists{/gist_id}","starred_url":"https://api.github.com/users/jeabakker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeabakker/subscriptions","organizations_url":"https://api.github.com/users/jeabakker/orgs","repos_url":"https://api.github.com/users/jeabakker/repos","events_url":"https://api.github.com/users/jeabakker/events{/privacy}","received_events_url":"https://api.github.com/users/jeabakker/received_events","type":"User","site_admin":false},"body":"No longer first trigger the delete event and then check if you canEdit()\r\nthe entity. This could cause data to be lost.\r\n\r\nexample use case:\r\n$group->delete();\r\nthe groups plugin listens to this event and removes the group_acl\r\nbut if ->canEdit() results in false the access collection is removed but the group still exists, meaning nobody can access any content shared with the group","created_at":"2015-02-23T14:18:58Z","updated_at":"2015-03-09T16:20:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"542ae0da9833603e66560fcb36c1786c3e3f0aed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7992/commits","review_comments_url":"https://api.github.com/repos/Elgg/Elgg/pulls/7992/comments","review_comment_url":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Elgg/Elgg/issues/7992/comments","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/1e2aa00c2f2df04e9b9e56dabcc892d357ca1e33","head":{"label":"jeabakker:entity-delete-event","ref":"entity-delete-event","sha":"1e2aa00c2f2df04e9b9e56dabcc892d357ca1e33","user":{"login":"jeabakker","id":881958,"avatar_url":"https://avatars.githubusercontent.com/u/881958?v=3","gravatar_id":"","url":"https://api.github.com/users/jeabakker","html_url":"https://github.com/jeabakker","followers_url":"https://api.github.com/users/jeabakker/followers","following_url":"https://api.github.com/users/jeabakker/following{/other_user}","gists_url":"https://api.github.com/users/jeabakker/gists{/gist_id}","starred_url":"https://api.github.com/users/jeabakker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeabakker/subscriptions","organizations_url":"https://api.github.com/users/jeabakker/orgs","repos_url":"https://api.github.com/users/jeabakker/repos","events_url":"https://api.github.com/users/jeabakker/events{/privacy}","received_events_url":"https://api.github.com/users/jeabakker/received_events","type":"User","site_admin":false},"repo":{"id":3210349,"name":"Elgg","full_name":"jeabakker/Elgg","owner":{"login":"jeabakker","id":881958,"avatar_url":"https://avatars.githubusercontent.com/u/881958?v=3","gravatar_id":"","url":"https://api.github.com/users/jeabakker","html_url":"https://github.com/jeabakker","followers_url":"https://api.github.com/users/jeabakker/followers","following_url":"https://api.github.com/users/jeabakker/following{/other_user}","gists_url":"https://api.github.com/users/jeabakker/gists{/gist_id}","starred_url":"https://api.github.com/users/jeabakker/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jeabakker/subscriptions","organizations_url":"https://api.github.com/users/jeabakker/orgs","repos_url":"https://api.github.com/users/jeabakker/repos","events_url":"https://api.github.com/users/jeabakker/events{/privacy}","received_events_url":"https://api.github.com/users/jeabakker/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/jeabakker/Elgg","description":"A social networking engine","fork":true,"url":"https://api.github.com/repos/jeabakker/Elgg","forks_url":"https://api.github.com/repos/jeabakker/Elgg/forks","keys_url":"https://api.github.com/repos/jeabakker/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/jeabakker/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/jeabakker/Elgg/teams","hooks_url":"https://api.github.com/repos/jeabakker/Elgg/hooks","issue_events_url":"https://api.github.com/repos/jeabakker/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/jeabakker/Elgg/events","assignees_url":"https://api.github.com/repos/jeabakker/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/jeabakker/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/jeabakker/Elgg/tags","blobs_url":"https://api.github.com/repos/jeabakker/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/jeabakker/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/jeabakker/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/jeabakker/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/jeabakker/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/jeabakker/Elgg/languages","stargazers_url":"https://api.github.com/repos/jeabakker/Elgg/stargazers","contributors_url":"https://api.github.com/repos/jeabakker/Elgg/contributors","subscribers_url":"https://api.github.com/repos/jeabakker/Elgg/subscribers","subscription_url":"https://api.github.com/repos/jeabakker/Elgg/subscription","commits_url":"https://api.github.com/repos/jeabakker/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/jeabakker/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/jeabakker/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/jeabakker/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/jeabakker/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/jeabakker/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/jeabakker/Elgg/merges","archive_url":"https://api.github.com/repos/jeabakker/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/jeabakker/Elgg/downloads","issues_url":"https://api.github.com/repos/jeabakker/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/jeabakker/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/jeabakker/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/jeabakker/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/jeabakker/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/jeabakker/Elgg/releases{/id}","created_at":"2012-01-18T16:53:11Z","updated_at":"2014-06-24T10:34:53Z","pushed_at":"2015-03-09T14:58:57Z","git_url":"git://github.com/jeabakker/Elgg.git","ssh_url":"git@github.com:jeabakker/Elgg.git","clone_url":"https://github.com/jeabakker/Elgg.git","svn_url":"https://github.com/jeabakker/Elgg","homepage":"http://elgg.org","size":38577,"stargazers_count":1,"watchers_count":1,"language":"PHP","has_issues":false,"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":1,"default_branch":"master"}},"base":{"label":"Elgg:1.10","ref":"1.10","sha":"757ed1fc9d20da265333f34d8436a6432cc8bbf7","user":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"repo":{"id":299271,"name":"Elgg","full_name":"Elgg/Elgg","owner":{"login":"Elgg","id":79167,"avatar_url":"https://avatars.githubusercontent.com/u/79167?v=3","gravatar_id":"","url":"https://api.github.com/users/Elgg","html_url":"https://github.com/Elgg","followers_url":"https://api.github.com/users/Elgg/followers","following_url":"https://api.github.com/users/Elgg/following{/other_user}","gists_url":"https://api.github.com/users/Elgg/gists{/gist_id}","starred_url":"https://api.github.com/users/Elgg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Elgg/subscriptions","organizations_url":"https://api.github.com/users/Elgg/orgs","repos_url":"https://api.github.com/users/Elgg/repos","events_url":"https://api.github.com/users/Elgg/events{/privacy}","received_events_url":"https://api.github.com/users/Elgg/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Elgg/Elgg","description":"A social networking engine","fork":false,"url":"https://api.github.com/repos/Elgg/Elgg","forks_url":"https://api.github.com/repos/Elgg/Elgg/forks","keys_url":"https://api.github.com/repos/Elgg/Elgg/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Elgg/Elgg/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Elgg/Elgg/teams","hooks_url":"https://api.github.com/repos/Elgg/Elgg/hooks","issue_events_url":"https://api.github.com/repos/Elgg/Elgg/issues/events{/number}","events_url":"https://api.github.com/repos/Elgg/Elgg/events","assignees_url":"https://api.github.com/repos/Elgg/Elgg/assignees{/user}","branches_url":"https://api.github.com/repos/Elgg/Elgg/branches{/branch}","tags_url":"https://api.github.com/repos/Elgg/Elgg/tags","blobs_url":"https://api.github.com/repos/Elgg/Elgg/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Elgg/Elgg/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Elgg/Elgg/git/refs{/sha}","trees_url":"https://api.github.com/repos/Elgg/Elgg/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Elgg/Elgg/statuses/{sha}","languages_url":"https://api.github.com/repos/Elgg/Elgg/languages","stargazers_url":"https://api.github.com/repos/Elgg/Elgg/stargazers","contributors_url":"https://api.github.com/repos/Elgg/Elgg/contributors","subscribers_url":"https://api.github.com/repos/Elgg/Elgg/subscribers","subscription_url":"https://api.github.com/repos/Elgg/Elgg/subscription","commits_url":"https://api.github.com/repos/Elgg/Elgg/commits{/sha}","git_commits_url":"https://api.github.com/repos/Elgg/Elgg/git/commits{/sha}","comments_url":"https://api.github.com/repos/Elgg/Elgg/comments{/number}","issue_comment_url":"https://api.github.com/repos/Elgg/Elgg/issues/comments{/number}","contents_url":"https://api.github.com/repos/Elgg/Elgg/contents/{+path}","compare_url":"https://api.github.com/repos/Elgg/Elgg/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Elgg/Elgg/merges","archive_url":"https://api.github.com/repos/Elgg/Elgg/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Elgg/Elgg/downloads","issues_url":"https://api.github.com/repos/Elgg/Elgg/issues{/number}","pulls_url":"https://api.github.com/repos/Elgg/Elgg/pulls{/number}","milestones_url":"https://api.github.com/repos/Elgg/Elgg/milestones{/number}","notifications_url":"https://api.github.com/repos/Elgg/Elgg/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Elgg/Elgg/labels{/name}","releases_url":"https://api.github.com/repos/Elgg/Elgg/releases{/id}","created_at":"2009-09-06T17:10:11Z","updated_at":"2015-03-08T07:29:02Z","pushed_at":"2015-03-09T11:11:56Z","git_url":"git://github.com/Elgg/Elgg.git","ssh_url":"git@github.com:Elgg/Elgg.git","clone_url":"https://github.com/Elgg/Elgg.git","svn_url":"https://github.com/Elgg/Elgg","homepage":"http://elgg.org","size":74421,"stargazers_count":682,"watchers_count":682,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":418,"mirror_url":null,"open_issues_count":744,"forks":418,"open_issues":744,"watchers":682,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7992"},"html":{"href":"https://github.com/Elgg/Elgg/pull/7992"},"issue":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/7992"},"comments":{"href":"https://api.github.com/repos/Elgg/Elgg/issues/7992/comments"},"review_comments":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7992/comments"},"review_comment":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Elgg/Elgg/pulls/7992/commits"},"statuses":{"href":"https://api.github.com/repos/Elgg/Elgg/statuses/1e2aa00c2f2df04e9b9e56dabcc892d357ca1e33"}}}}