{"action":"created","comment":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/comments/200220650","pull_request_review_id":134489017,"id":200220650,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwMDIyMDY1MA==","diff_hunk":"@@ -0,0 +1,198 @@\n+<?php\n+\n+namespace SilverStripe\\Forms\\GridField;\n+\n+use SilverStripe\\CMS\\Controllers\\CMSMain;\n+use SilverStripe\\Forms\\GridField\\GridField_ActionMenuItem;\n+use SilverStripe\\Forms\\GridField\\GridField_ActionProvider;\n+use SilverStripe\\Forms\\GridField\\GridField_ColumnProvider;\n+use SilverStripe\\Forms\\GridField\\GridField_FormAction;\n+use SilverStripe\\Forms\\GridField\\GridFieldFooter;\n+use SilverStripe\\Forms\\RestoreAction;\n+use SilverStripe\\ORM\\DataObject;\n+use SilverStripe\\ORM\\ValidationException;\n+use SilverStripe\\ORM\\ValidationResult;\n+use SilverStripe\\Versioned\\Versioned;\n+\n+/**\n+ * This class is a {@link GridField} component that adds a restore action for\n+ * versioned objects.\n+ */\n+class GridFieldRestoreAction implements GridField_ColumnProvider, GridField_ActionProvider, GridField_ActionMenuItem\n+{\n+    /**\n+     * @inheritdoc\n+     */\n+    public function getTitle($gridField, $record, $columnName)\n+    {\n+        return _t(__CLASS__ . '.RESTORE', \"Restore draft\");\n+    }\n+\n+    /**\n+     * @inheritdoc\n+     */\n+    public function getGroup($gridField, $record, $columnName)\n+    {\n+        $field = $this->getRestoreAction($gridField, $record, $columnName);\n+\n+        return $field ? GridField_ActionMenuItem::DEFAULT_GROUP: null;\n+    }\n+\n+    /**\n+     * @inheritdoc\n+     */\n+    public function getExtraData($gridField, $record, $columnName)\n+    {\n+        $field = $this->getRestoreAction($gridField, $record, $columnName);\n+\n+        return $field ? $field->getAttributes() : [];\n+    }\n+\n+    /**\n+     * Add a column 'Delete'\n+     *\n+     * @param GridField $gridField\n+     * @param array $columns\n+     */\n+    public function augmentColumns($gridField, &$columns)\n+    {\n+        if (!in_array('Actions', $columns)) {\n+            $columns[] = 'Actions';\n+        }\n+    }\n+\n+    /**\n+     * Return any special attributes that will be used for FormField::create_tag()\n+     *\n+     * @param GridField $gridField\n+     * @param DataObject $record\n+     * @param string $columnName\n+     * @return array\n+     */\n+    public function getColumnAttributes($gridField, $record, $columnName)\n+    {\n+        return ['class' => 'grid-field__col-compact'];\n+    }\n+\n+    /**\n+     * Add the title\n+     *\n+     * @param GridField $gridField\n+     * @param string $columnName\n+     * @return array\n+     */\n+    public function getColumnMetadata($gridField, $columnName)\n+    {\n+        if ($columnName == 'Actions') {\n+            return ['title' => ''];\n+        }\n+        return [];\n+    }\n+\n+    /**\n+     * Which columns are handled by this component\n+     *\n+     * @param GridField $gridField\n+     * @return array\n+     */\n+    public function getColumnsHandled($gridField)\n+    {\n+        return ['Actions'];\n+    }\n+\n+    /**\n+     * Which GridField actions are this component handling.\n+     *\n+     * @param GridField $gridField\n+     * @return array\n+     */\n+    public function getActions($gridField)\n+    {\n+        return ['restore'];\n+    }\n+\n+    /**\n+     * Creates a restore action if the action is able to be preformed\n+     *\n+     * @param GridField $gridField\n+     * @param DataObject $record\n+     * @param string $columnName\n+     * @return GridField_FormAction|null\n+     */\n+    public function getRestoreAction($gridField, $record, $columnName)\n+    {\n+        $isOnDraft = $record->isOnDraft();\n+        $isPublished = $record->isPublished();\n+        $canEdit = $record->canEdit();\n+\n+        if ($canEdit && !$isOnDraft && !$isPublished) {\n+            $restoreToRoot = RestoreAction::shouldRestoreToRoot($record);\n+\n+            $title = $restoreToRoot\n+                ? _t('SilverStripe\\\\Admin\\\\ArchiveAdmin.RESTORE_TO_ROOT', 'Restore draft at top level')","path":"src/Forms/GridField/GridFieldRestoreAction.php","position":132,"original_position":132,"commit_id":"9c552e95a8a7e0632ea9f44c51d0be5f89d2f24a","original_commit_id":"9c552e95a8a7e0632ea9f44c51d0be5f89d2f24a","user":{"login":"maxime-rainville","id":1168676,"node_id":"MDQ6VXNlcjExNjg2NzY=","avatar_url":"https://avatars0.githubusercontent.com/u/1168676?v=4","gravatar_id":"","url":"https://api.github.com/users/maxime-rainville","html_url":"https://github.com/maxime-rainville","followers_url":"https://api.github.com/users/maxime-rainville/followers","following_url":"https://api.github.com/users/maxime-rainville/following{/other_user}","gists_url":"https://api.github.com/users/maxime-rainville/gists{/gist_id}","starred_url":"https://api.github.com/users/maxime-rainville/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/maxime-rainville/subscriptions","organizations_url":"https://api.github.com/users/maxime-rainville/orgs","repos_url":"https://api.github.com/users/maxime-rainville/repos","events_url":"https://api.github.com/users/maxime-rainville/events{/privacy}","received_events_url":"https://api.github.com/users/maxime-rainville/received_events","type":"User","site_admin":false},"body":"Not sure about referencing Admin translation in framework.","created_at":"2018-07-05T02:28:38Z","updated_at":"2018-07-05T02:31:07Z","html_url":"https://github.com/silverstripe/silverstripe-framework/pull/8240#discussion_r200220650","pull_request_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/comments/200220650"},"html":{"href":"https://github.com/silverstripe/silverstripe-framework/pull/8240#discussion_r200220650"},"pull_request":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240"}}},"pull_request":{"url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240","id":199105600,"node_id":"MDExOlB1bGxSZXF1ZXN0MTk5MTA1NjAw","html_url":"https://github.com/silverstripe/silverstripe-framework/pull/8240","diff_url":"https://github.com/silverstripe/silverstripe-framework/pull/8240.diff","patch_url":"https://github.com/silverstripe/silverstripe-framework/pull/8240.patch","issue_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/8240","number":8240,"state":"open","locked":false,"title":"ADD: Archive admin to manage archived records","user":{"login":"lukereative","id":1415622,"node_id":"MDQ6VXNlcjE0MTU2MjI=","avatar_url":"https://avatars3.githubusercontent.com/u/1415622?v=4","gravatar_id":"","url":"https://api.github.com/users/lukereative","html_url":"https://github.com/lukereative","followers_url":"https://api.github.com/users/lukereative/followers","following_url":"https://api.github.com/users/lukereative/following{/other_user}","gists_url":"https://api.github.com/users/lukereative/gists{/gist_id}","starred_url":"https://api.github.com/users/lukereative/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukereative/subscriptions","organizations_url":"https://api.github.com/users/lukereative/orgs","repos_url":"https://api.github.com/users/lukereative/repos","events_url":"https://api.github.com/users/lukereative/events{/privacy}","received_events_url":"https://api.github.com/users/lukereative/received_events","type":"User","site_admin":false},"body":"Implements restore action for GridField and forms which is needed for #6202\r\n\r\nDependent PR: https://github.com/silverstripe/silverstripe-admin/pull/559","created_at":"2018-07-03T23:22:19Z","updated_at":"2018-07-05T02:31:07Z","closed_at":null,"merged_at":null,"merge_commit_sha":"d93c8c9be654333ffcbb4c5f021b2f58264009ec","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240/commits","review_comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240/comments","review_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/comments{/number}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/8240/comments","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/statuses/9c552e95a8a7e0632ea9f44c51d0be5f89d2f24a","head":{"label":"open-sausages:pulls/4/the-lost-archives","ref":"pulls/4/the-lost-archives","sha":"9c552e95a8a7e0632ea9f44c51d0be5f89d2f24a","user":{"login":"open-sausages","id":12824172,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyODI0MTcy","avatar_url":"https://avatars2.githubusercontent.com/u/12824172?v=4","gravatar_id":"","url":"https://api.github.com/users/open-sausages","html_url":"https://github.com/open-sausages","followers_url":"https://api.github.com/users/open-sausages/followers","following_url":"https://api.github.com/users/open-sausages/following{/other_user}","gists_url":"https://api.github.com/users/open-sausages/gists{/gist_id}","starred_url":"https://api.github.com/users/open-sausages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-sausages/subscriptions","organizations_url":"https://api.github.com/users/open-sausages/orgs","repos_url":"https://api.github.com/users/open-sausages/repos","events_url":"https://api.github.com/users/open-sausages/events{/privacy}","received_events_url":"https://api.github.com/users/open-sausages/received_events","type":"Organization","site_admin":false},"repo":{"id":37888247,"node_id":"MDEwOlJlcG9zaXRvcnkzNzg4ODI0Nw==","name":"silverstripe-framework","full_name":"open-sausages/silverstripe-framework","owner":{"login":"open-sausages","id":12824172,"node_id":"MDEyOk9yZ2FuaXphdGlvbjEyODI0MTcy","avatar_url":"https://avatars2.githubusercontent.com/u/12824172?v=4","gravatar_id":"","url":"https://api.github.com/users/open-sausages","html_url":"https://github.com/open-sausages","followers_url":"https://api.github.com/users/open-sausages/followers","following_url":"https://api.github.com/users/open-sausages/following{/other_user}","gists_url":"https://api.github.com/users/open-sausages/gists{/gist_id}","starred_url":"https://api.github.com/users/open-sausages/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/open-sausages/subscriptions","organizations_url":"https://api.github.com/users/open-sausages/orgs","repos_url":"https://api.github.com/users/open-sausages/repos","events_url":"https://api.github.com/users/open-sausages/events{/privacy}","received_events_url":"https://api.github.com/users/open-sausages/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/open-sausages/silverstripe-framework","description":"SilverStripe Framework, the MVC framework that powers SilverStripe CMS","fork":true,"url":"https://api.github.com/repos/open-sausages/silverstripe-framework","forks_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/forks","keys_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/teams","hooks_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/hooks","issue_events_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/issues/events{/number}","events_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/events","assignees_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/assignees{/user}","branches_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/branches{/branch}","tags_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/tags","blobs_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/languages","stargazers_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/stargazers","contributors_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/contributors","subscribers_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/subscribers","subscription_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/subscription","commits_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/contents/{+path}","compare_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/merges","archive_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/downloads","issues_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/issues{/number}","pulls_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/labels{/name}","releases_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/releases{/id}","deployments_url":"https://api.github.com/repos/open-sausages/silverstripe-framework/deployments","created_at":"2015-06-23T00:36:38Z","updated_at":"2017-03-09T23:09:16Z","pushed_at":"2018-07-04T10:41:54Z","git_url":"git://github.com/open-sausages/silverstripe-framework.git","ssh_url":"git@github.com:open-sausages/silverstripe-framework.git","clone_url":"https://github.com/open-sausages/silverstripe-framework.git","svn_url":"https://github.com/open-sausages/silverstripe-framework","homepage":"http://silverstripe.org/","size":101915,"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":1,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":1,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"silverstripe:4","ref":"4","sha":"e4d1cf8818e1eab919a842afb7afd9db36170c31","user":{"login":"silverstripe","id":379348,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3OTM0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/379348?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"repo":{"id":1318892,"node_id":"MDEwOlJlcG9zaXRvcnkxMzE4ODky","name":"silverstripe-framework","full_name":"silverstripe/silverstripe-framework","owner":{"login":"silverstripe","id":379348,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM3OTM0OA==","avatar_url":"https://avatars0.githubusercontent.com/u/379348?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe","html_url":"https://github.com/silverstripe","followers_url":"https://api.github.com/users/silverstripe/followers","following_url":"https://api.github.com/users/silverstripe/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe/subscriptions","organizations_url":"https://api.github.com/users/silverstripe/orgs","repos_url":"https://api.github.com/users/silverstripe/repos","events_url":"https://api.github.com/users/silverstripe/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe/silverstripe-framework","description":"SilverStripe Framework, the MVC framework that powers SilverStripe CMS","fork":false,"url":"https://api.github.com/repos/silverstripe/silverstripe-framework","forks_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/forks","keys_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/teams","hooks_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/hooks","issue_events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/events","assignees_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/tags","blobs_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/languages","stargazers_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/stargazers","contributors_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/contributors","subscribers_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/subscribers","subscription_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/subscription","commits_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/merges","archive_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/downloads","issues_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/releases{/id}","deployments_url":"https://api.github.com/repos/silverstripe/silverstripe-framework/deployments","created_at":"2011-02-02T02:04:13Z","updated_at":"2018-07-03T22:56:24Z","pushed_at":"2018-07-05T02:19:59Z","git_url":"git://github.com/silverstripe/silverstripe-framework.git","ssh_url":"git@github.com:silverstripe/silverstripe-framework.git","clone_url":"https://github.com/silverstripe/silverstripe-framework.git","svn_url":"https://github.com/silverstripe/silverstripe-framework","homepage":"http://silverstripe.org/","size":100506,"stargazers_count":601,"watchers_count":601,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":700,"mirror_url":null,"archived":false,"open_issues_count":516,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":700,"open_issues":516,"watchers":601,"default_branch":"4"}},"_links":{"self":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240"},"html":{"href":"https://github.com/silverstripe/silverstripe-framework/pull/8240"},"issue":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/8240"},"comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/issues/8240/comments"},"review_comments":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240/comments"},"review_comment":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/pulls/8240/commits"},"statuses":{"href":"https://api.github.com/repos/silverstripe/silverstripe-framework/statuses/9c552e95a8a7e0632ea9f44c51d0be5f89d2f24a"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"maxime-rainville"}}