{"action":"created","comment":{"url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/comments/151006367","pull_request_review_id":76644965,"id":151006367,"diff_hunk":"@@ -0,0 +1,63 @@\n+<?php\n+\n+namespace TractorCow\\Fluent\\Tests\\Extension;\n+\n+use Page;\n+use SilverStripe\\CMS\\Model\\SiteTree;\n+use SilverStripe\\Dev\\SapphireTest;\n+use TractorCow\\Fluent\\Extension\\FluentFilteredExtension;\n+use TractorCow\\Fluent\\Extension\\FluentSiteTreeExtension;\n+use TractorCow\\Fluent\\Model\\Domain;\n+use TractorCow\\Fluent\\Model\\Locale;\n+use TractorCow\\Fluent\\State\\FluentState;\n+\n+class FluentFilteredExtensionTest extends SapphireTest\n+{\n+    protected static $fixture_file = 'FluentFilteredExtensionTest.yml';\n+\n+    protected static $required_extensions = [\n+        SiteTree::class => [\n+            FluentSiteTreeExtension::class,\n+            FluentFilteredExtension::class,\n+        ],\n+    ];\n+\n+    protected function setUp()\n+    {\n+        parent::setUp();\n+\n+        // Clear cache\n+        Locale::clearCached();\n+        Domain::clearCached();\n+        FluentState::singleton()\n+            ->setLocale('en_NZ')\n+            ->setIsDomainMode(false);\n+    }\n+\n+    public function testAugmentSQLFrontend()\n+    {\n+        FluentState::singleton()\n+            ->setLocale('en_NZ')\n+            ->setIsFrontend(true);\n+\n+        $this->assertEquals(1, SiteTree::get()->count());","path":"tests/php/Extension/FluentFilteredExtensionTest.php","position":66,"original_position":43,"commit_id":"6abc4374b13e28925c7f324c3e073c9dd46e9ba6","original_commit_id":"b34b08ff3cd45673130927da5b7947fb12cd271f","user":{"login":"chrispenny","id":505788,"avatar_url":"https://avatars1.githubusercontent.com/u/505788?v=4","gravatar_id":"","url":"https://api.github.com/users/chrispenny","html_url":"https://github.com/chrispenny","followers_url":"https://api.github.com/users/chrispenny/followers","following_url":"https://api.github.com/users/chrispenny/following{/other_user}","gists_url":"https://api.github.com/users/chrispenny/gists{/gist_id}","starred_url":"https://api.github.com/users/chrispenny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrispenny/subscriptions","organizations_url":"https://api.github.com/users/chrispenny/orgs","repos_url":"https://api.github.com/users/chrispenny/repos","events_url":"https://api.github.com/users/chrispenny/events{/privacy}","received_events_url":"https://api.github.com/users/chrispenny/received_events","type":"User","site_admin":false},"body":"These are working now (using `FixtureFactory` rather than `yml`), however, I might still be doing wrong as between tests, the number of DB objects continues to increase (it looks like `SiteTree` objects aren't being removed).\r\n\r\nI've got `$factory->clear()` running, but that didn't do the trick. I ended up defining an empty `yml` fixture which looked to clear the objects correctly.\r\n\r\nI was following the docs on Fixtures (https://docs.silverstripe.org/en/4/developer_guides/testing/how_tos/fixturefactories/), but it looked outdated.\r\n\r\nI'll be in the office tomorrow if it's easier to discuss in person.","created_at":"2017-11-15T00:40:43Z","updated_at":"2017-11-15T00:40:43Z","html_url":"https://github.com/tractorcow/silverstripe-fluent/pull/304#discussion_r151006367","pull_request_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304","author_association":"CONTRIBUTOR","_links":{"self":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/comments/151006367"},"html":{"href":"https://github.com/tractorcow/silverstripe-fluent/pull/304#discussion_r151006367"},"pull_request":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304"}},"in_reply_to_id":150683918},"pull_request":{"url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304","id":151808367,"html_url":"https://github.com/tractorcow/silverstripe-fluent/pull/304","diff_url":"https://github.com/tractorcow/silverstripe-fluent/pull/304.diff","patch_url":"https://github.com/tractorcow/silverstripe-fluent/pull/304.patch","issue_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/304","number":304,"state":"open","locked":false,"title":"Added new FluentFilteredExtension","user":{"login":"chrispenny","id":505788,"avatar_url":"https://avatars1.githubusercontent.com/u/505788?v=4","gravatar_id":"","url":"https://api.github.com/users/chrispenny","html_url":"https://github.com/chrispenny","followers_url":"https://api.github.com/users/chrispenny/followers","following_url":"https://api.github.com/users/chrispenny/following{/other_user}","gists_url":"https://api.github.com/users/chrispenny/gists{/gist_id}","starred_url":"https://api.github.com/users/chrispenny/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrispenny/subscriptions","organizations_url":"https://api.github.com/users/chrispenny/orgs","repos_url":"https://api.github.com/users/chrispenny/repos","events_url":"https://api.github.com/users/chrispenny/events{/privacy}","received_events_url":"https://api.github.com/users/chrispenny/received_events","type":"User","site_admin":false},"body":"From a feature POV this is complete (if anyone could please give me some feedback), but I've unfortunately run out of time today to write the unit tests, so I will leave this as WIP until I can do that.\r\n\r\n---\r\n\r\n# Purpose\r\n\r\nIn combination with the new ability to disable`frontend_publish_required`, this `Extension` attempts to add an additional layer of customisation so that any given Page can be specifically shown or hidden on the front-end for a specific Locale.\r\n\r\n# Example\r\n\r\nI have the following Locales for my site:\r\n\r\n* International\r\n* Australia\r\n* United States\r\n* Japan\r\n\r\nI create a new record (EG: a `Page`) which I want the International and Australian Locales to inherit the content for when displaying on the frontend. Within the \"Filtered Locales\" tab of the edit form I add these`Locales` to the `GridField`.\r\n\r\n![screen shot 2017-11-10 at 2 42 57 pm](https://user-images.githubusercontent.com/505788/32638714-7cf240bc-c625-11e7-8103-36e83e01a50d.png)\r\n\r\nBy default, no `Locales` are automatically added to new records.\r\n\r\nYou should now be able to add new `Locales` to this `GridField` without having to save the record (EG: the `Page`), as saving the record would create a localised version, which is not what we want here.\r\n\r\n# Improvements\r\n\r\n1) Add some different CMS Status Flags for whether or not Pages are being displayed in the current Locale (a \"greyed out\" look, maybe).\r\n\r\n2) Change the `GridField` to some sort of Checkbox set. I couldn't do this quickly initially because a `CheckboxSetField` requires you save the `DataObject` to save the relationships, and as mentioned above, we **do not** want to create a localised version of the `DataObject` when we add/remove `FilteredLocales`.\r\n\r\n3) Add some extension points (or whatever) so that devs can easily add in some default `Locale` records that they might want automatically added to new records that are created.\r\n\r\n# Issues\r\n\r\nAn issue has already been raised regarding the `GridField` search field flagging the form as \"changed\" when you start typing into it: https://github.com/silverstripe/silverstripe-admin/issues/350","created_at":"2017-11-10T01:50:07Z","updated_at":"2017-11-15T00:40:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9cf289f2014b8d5c384ef64eb84801b22c96baff","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304/commits","review_comments_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304/comments","review_comment_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/comments{/number}","comments_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/304/comments","statuses_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/statuses/6abc4374b13e28925c7f324c3e073c9dd46e9ba6","head":{"label":"silverstripe-terraformers:feature/fluent-filtered-extension","ref":"feature/fluent-filtered-extension","sha":"6abc4374b13e28925c7f324c3e073c9dd46e9ba6","user":{"login":"silverstripe-terraformers","id":1840409,"avatar_url":"https://avatars1.githubusercontent.com/u/1840409?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe-terraformers","html_url":"https://github.com/silverstripe-terraformers","followers_url":"https://api.github.com/users/silverstripe-terraformers/followers","following_url":"https://api.github.com/users/silverstripe-terraformers/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe-terraformers/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe-terraformers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe-terraformers/subscriptions","organizations_url":"https://api.github.com/users/silverstripe-terraformers/orgs","repos_url":"https://api.github.com/users/silverstripe-terraformers/repos","events_url":"https://api.github.com/users/silverstripe-terraformers/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe-terraformers/received_events","type":"Organization","site_admin":false},"repo":{"id":109873816,"name":"silverstripe-fluent","full_name":"silverstripe-terraformers/silverstripe-fluent","owner":{"login":"silverstripe-terraformers","id":1840409,"avatar_url":"https://avatars1.githubusercontent.com/u/1840409?v=4","gravatar_id":"","url":"https://api.github.com/users/silverstripe-terraformers","html_url":"https://github.com/silverstripe-terraformers","followers_url":"https://api.github.com/users/silverstripe-terraformers/followers","following_url":"https://api.github.com/users/silverstripe-terraformers/following{/other_user}","gists_url":"https://api.github.com/users/silverstripe-terraformers/gists{/gist_id}","starred_url":"https://api.github.com/users/silverstripe-terraformers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/silverstripe-terraformers/subscriptions","organizations_url":"https://api.github.com/users/silverstripe-terraformers/orgs","repos_url":"https://api.github.com/users/silverstripe-terraformers/repos","events_url":"https://api.github.com/users/silverstripe-terraformers/events{/privacy}","received_events_url":"https://api.github.com/users/silverstripe-terraformers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/silverstripe-terraformers/silverstripe-fluent","description":"Multi-language translate module for Silverstripe, without having to manage separate site trees.","fork":true,"url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent","forks_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/forks","keys_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/teams","hooks_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/hooks","issue_events_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/issues/events{/number}","events_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/events","assignees_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/assignees{/user}","branches_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/branches{/branch}","tags_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/tags","blobs_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/git/refs{/sha}","trees_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/statuses/{sha}","languages_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/languages","stargazers_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/stargazers","contributors_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/contributors","subscribers_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/subscribers","subscription_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/subscription","commits_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/commits{/sha}","git_commits_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/git/commits{/sha}","comments_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/comments{/number}","issue_comment_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/issues/comments{/number}","contents_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/contents/{+path}","compare_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/merges","archive_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/downloads","issues_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/issues{/number}","pulls_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/pulls{/number}","milestones_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/milestones{/number}","notifications_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/labels{/name}","releases_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/releases{/id}","deployments_url":"https://api.github.com/repos/silverstripe-terraformers/silverstripe-fluent/deployments","created_at":"2017-11-07T18:21:34Z","updated_at":"2017-11-07T18:21:36Z","pushed_at":"2017-11-15T00:20:37Z","git_url":"git://github.com/silverstripe-terraformers/silverstripe-fluent.git","ssh_url":"git@github.com:silverstripe-terraformers/silverstripe-fluent.git","clone_url":"https://github.com/silverstripe-terraformers/silverstripe-fluent.git","svn_url":"https://github.com/silverstripe-terraformers/silverstripe-fluent","homepage":null,"size":860,"stargazers_count":0,"watchers_count":0,"language":"PHP","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"tractorcow:master","ref":"master","sha":"2331482d5d53d1a5f7a6dda0b0f1c2cbb2f397af","user":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars2.githubusercontent.com/u/936064?v=4","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"repo":{"id":10893201,"name":"silverstripe-fluent","full_name":"tractorcow/silverstripe-fluent","owner":{"login":"tractorcow","id":936064,"avatar_url":"https://avatars2.githubusercontent.com/u/936064?v=4","gravatar_id":"","url":"https://api.github.com/users/tractorcow","html_url":"https://github.com/tractorcow","followers_url":"https://api.github.com/users/tractorcow/followers","following_url":"https://api.github.com/users/tractorcow/following{/other_user}","gists_url":"https://api.github.com/users/tractorcow/gists{/gist_id}","starred_url":"https://api.github.com/users/tractorcow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tractorcow/subscriptions","organizations_url":"https://api.github.com/users/tractorcow/orgs","repos_url":"https://api.github.com/users/tractorcow/repos","events_url":"https://api.github.com/users/tractorcow/events{/privacy}","received_events_url":"https://api.github.com/users/tractorcow/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/tractorcow/silverstripe-fluent","description":"Multi-language translate module for Silverstripe, without having to manage separate site trees.","fork":false,"url":"https://api.github.com/repos/tractorcow/silverstripe-fluent","forks_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/forks","keys_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/keys{/key_id}","collaborators_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/teams","hooks_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/hooks","issue_events_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/events{/number}","events_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/events","assignees_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/assignees{/user}","branches_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/branches{/branch}","tags_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/tags","blobs_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/git/refs{/sha}","trees_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/git/trees{/sha}","statuses_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/statuses/{sha}","languages_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/languages","stargazers_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/stargazers","contributors_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/contributors","subscribers_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/subscribers","subscription_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/subscription","commits_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/commits{/sha}","git_commits_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/git/commits{/sha}","comments_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/comments{/number}","issue_comment_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/comments{/number}","contents_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/contents/{+path}","compare_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/compare/{base}...{head}","merges_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/merges","archive_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/downloads","issues_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues{/number}","pulls_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls{/number}","milestones_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/milestones{/number}","notifications_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/labels{/name}","releases_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/releases{/id}","deployments_url":"https://api.github.com/repos/tractorcow/silverstripe-fluent/deployments","created_at":"2013-06-23T22:23:33Z","updated_at":"2017-11-09T01:38:03Z","pushed_at":"2017-11-15T00:20:38Z","git_url":"git://github.com/tractorcow/silverstripe-fluent.git","ssh_url":"git@github.com:tractorcow/silverstripe-fluent.git","clone_url":"https://github.com/tractorcow/silverstripe-fluent.git","svn_url":"https://github.com/tractorcow/silverstripe-fluent","homepage":null,"size":862,"stargazers_count":70,"watchers_count":70,"language":"PHP","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":48,"mirror_url":null,"archived":false,"open_issues_count":52,"forks":48,"open_issues":52,"watchers":70,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304"},"html":{"href":"https://github.com/tractorcow/silverstripe-fluent/pull/304"},"issue":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/304"},"comments":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/issues/304/comments"},"review_comments":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304/comments"},"review_comment":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/pulls/304/commits"},"statuses":{"href":"https://api.github.com/repos/tractorcow/silverstripe-fluent/statuses/6abc4374b13e28925c7f324c3e073c9dd46e9ba6"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"chrispenny"}}