{"action":"created","comment":{"url":"https://api.github.com/repos/discourse/discourse/pulls/comments/208112351","pull_request_review_id":143855499,"id":208112351,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwODExMjM1MQ==","diff_hunk":"@@ -33,4 +33,67 @@\n     end\n   end\n \n+  describe \"#handle_theme\" do\n+    let(:theme) { Theme.create!(user_id: -1, name: 'bob', user_selectable: true) }\n+    let(:theme2) { Theme.create!(user_id: -1, name: 'bobbob', user_selectable: true) }\n+    let(:user) { Fabricate(:user) }\n+    let(:admin) { Fabricate(:admin) }\n+\n+    before do\n+      sign_in(user)\n+    end\n+\n+    it \"selects the theme the user has selected\" do\n+      user.user_option.update_columns(theme_ids: [theme.id])\n+\n+      get \"/\"\n+      expect(controller.theme_ids).to eq([theme.id])\n+\n+      theme.update_attribute(:user_selectable, false)\n+\n+      get \"/\"\n+      expect(controller.theme_ids).not_to eq([theme.id])\n+    end\n+\n+    it \"can be overridden with a cookie\" do\n+      user.user_option.update_columns(theme_ids: [theme.id])\n+\n+      cookies['theme_ids'] = \"#{theme2.id}|#{user.user_option.theme_key_seq}\"\n+\n+      get \"/\"\n+      expect(controller.theme_ids).to eq([theme2.id])\n+\n+      theme2.update!(user_selectable: false)\n+      theme.add_child_theme!(theme2)\n+      cookies['theme_ids'] = \"#{theme.id},#{theme2.id}|#{user.user_option.theme_key_seq}\"\n+\n+      get \"/\"\n+      expect(controller.theme_ids).to eq([theme.id, theme2.id])\n+    end\n+\n+    it \"falls back to the default theme when the user has no cookies or preferences\" do\n+      user.user_option.update_columns(theme_ids: [])\n+      cookies[\"theme_ids\"] = nil\n+      theme2.set_default!\n+\n+      get \"/\"\n+      expect(controller.theme_ids).to eq([theme2.id])\n+    end\n+\n+    it \"can be overridden with preview_theme_id param\" do\n+      sign_in(admin)\n+      cookies['theme_ids'] = \"#{theme.id},#{theme2.id}|#{admin.user_option.theme_key_seq}\"\n+\n+      get \"/?preview_theme_id=#{theme2.id}\"","path":"spec/requests/application_controller_spec.rb","position":55,"original_position":55,"commit_id":"ae0fe2daf56b06bc0ac8ac1656b249db8763df08","original_commit_id":"ae0fe2daf56b06bc0ac8ac1656b249db8763df08","user":{"login":"tgxworld","id":4335742,"node_id":"MDQ6VXNlcjQzMzU3NDI=","avatar_url":"https://avatars3.githubusercontent.com/u/4335742?v=4","gravatar_id":"","url":"https://api.github.com/users/tgxworld","html_url":"https://github.com/tgxworld","followers_url":"https://api.github.com/users/tgxworld/followers","following_url":"https://api.github.com/users/tgxworld/following{/other_user}","gists_url":"https://api.github.com/users/tgxworld/gists{/gist_id}","starred_url":"https://api.github.com/users/tgxworld/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tgxworld/subscriptions","organizations_url":"https://api.github.com/users/tgxworld/orgs","repos_url":"https://api.github.com/users/tgxworld/repos","events_url":"https://api.github.com/users/tgxworld/events{/privacy}","received_events_url":"https://api.github.com/users/tgxworld/received_events","type":"User","site_admin":false},"body":"This is OK but it'll be better to just pass the parameters via `params`","created_at":"2018-08-07T06:31:03Z","updated_at":"2018-08-07T06:31:03Z","html_url":"https://github.com/discourse/discourse/pull/6199#discussion_r208112351","pull_request_url":"https://api.github.com/repos/discourse/discourse/pulls/6199","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments/208112351"},"html":{"href":"https://github.com/discourse/discourse/pull/6199#discussion_r208112351"},"pull_request":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6199"}}},"pull_request":{"url":"https://api.github.com/repos/discourse/discourse/pulls/6199","id":204706263,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA0NzA2MjYz","html_url":"https://github.com/discourse/discourse/pull/6199","diff_url":"https://github.com/discourse/discourse/pull/6199.diff","patch_url":"https://github.com/discourse/discourse/pull/6199.patch","issue_url":"https://api.github.com/repos/discourse/discourse/issues/6199","number":6199,"state":"open","locked":false,"title":"FEATURE: backend support for user-selectable components","user":{"login":"OsamaSayegh","id":17474474,"node_id":"MDQ6VXNlcjE3NDc0NDc0","avatar_url":"https://avatars2.githubusercontent.com/u/17474474?v=4","gravatar_id":"","url":"https://api.github.com/users/OsamaSayegh","html_url":"https://github.com/OsamaSayegh","followers_url":"https://api.github.com/users/OsamaSayegh/followers","following_url":"https://api.github.com/users/OsamaSayegh/following{/other_user}","gists_url":"https://api.github.com/users/OsamaSayegh/gists{/gist_id}","starred_url":"https://api.github.com/users/OsamaSayegh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OsamaSayegh/subscriptions","organizations_url":"https://api.github.com/users/OsamaSayegh/orgs","repos_url":"https://api.github.com/users/OsamaSayegh/repos","events_url":"https://api.github.com/users/OsamaSayegh/events{/privacy}","received_events_url":"https://api.github.com/users/OsamaSayegh/received_events","type":"User","site_admin":false},"body":"","created_at":"2018-07-30T06:31:51Z","updated_at":"2018-08-07T06:31:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e0789e952eb2bb91f4d96ccf263ad0df57c053a4","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/discourse/discourse/pulls/6199/commits","review_comments_url":"https://api.github.com/repos/discourse/discourse/pulls/6199/comments","review_comment_url":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}","comments_url":"https://api.github.com/repos/discourse/discourse/issues/6199/comments","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/ae0fe2daf56b06bc0ac8ac1656b249db8763df08","head":{"label":"OsamaSayegh:user-selectable-phase-1","ref":"user-selectable-phase-1","sha":"ae0fe2daf56b06bc0ac8ac1656b249db8763df08","user":{"login":"OsamaSayegh","id":17474474,"node_id":"MDQ6VXNlcjE3NDc0NDc0","avatar_url":"https://avatars2.githubusercontent.com/u/17474474?v=4","gravatar_id":"","url":"https://api.github.com/users/OsamaSayegh","html_url":"https://github.com/OsamaSayegh","followers_url":"https://api.github.com/users/OsamaSayegh/followers","following_url":"https://api.github.com/users/OsamaSayegh/following{/other_user}","gists_url":"https://api.github.com/users/OsamaSayegh/gists{/gist_id}","starred_url":"https://api.github.com/users/OsamaSayegh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OsamaSayegh/subscriptions","organizations_url":"https://api.github.com/users/OsamaSayegh/orgs","repos_url":"https://api.github.com/users/OsamaSayegh/repos","events_url":"https://api.github.com/users/OsamaSayegh/events{/privacy}","received_events_url":"https://api.github.com/users/OsamaSayegh/received_events","type":"User","site_admin":false},"repo":{"id":90944442,"node_id":"MDEwOlJlcG9zaXRvcnk5MDk0NDQ0Mg==","name":"discourse","full_name":"OsamaSayegh/discourse","owner":{"login":"OsamaSayegh","id":17474474,"node_id":"MDQ6VXNlcjE3NDc0NDc0","avatar_url":"https://avatars2.githubusercontent.com/u/17474474?v=4","gravatar_id":"","url":"https://api.github.com/users/OsamaSayegh","html_url":"https://github.com/OsamaSayegh","followers_url":"https://api.github.com/users/OsamaSayegh/followers","following_url":"https://api.github.com/users/OsamaSayegh/following{/other_user}","gists_url":"https://api.github.com/users/OsamaSayegh/gists{/gist_id}","starred_url":"https://api.github.com/users/OsamaSayegh/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OsamaSayegh/subscriptions","organizations_url":"https://api.github.com/users/OsamaSayegh/orgs","repos_url":"https://api.github.com/users/OsamaSayegh/repos","events_url":"https://api.github.com/users/OsamaSayegh/events{/privacy}","received_events_url":"https://api.github.com/users/OsamaSayegh/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/OsamaSayegh/discourse","description":"A platform for community discussion. Free, open, simple.","fork":true,"url":"https://api.github.com/repos/OsamaSayegh/discourse","forks_url":"https://api.github.com/repos/OsamaSayegh/discourse/forks","keys_url":"https://api.github.com/repos/OsamaSayegh/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OsamaSayegh/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OsamaSayegh/discourse/teams","hooks_url":"https://api.github.com/repos/OsamaSayegh/discourse/hooks","issue_events_url":"https://api.github.com/repos/OsamaSayegh/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/OsamaSayegh/discourse/events","assignees_url":"https://api.github.com/repos/OsamaSayegh/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/OsamaSayegh/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/OsamaSayegh/discourse/tags","blobs_url":"https://api.github.com/repos/OsamaSayegh/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OsamaSayegh/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OsamaSayegh/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/OsamaSayegh/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OsamaSayegh/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/OsamaSayegh/discourse/languages","stargazers_url":"https://api.github.com/repos/OsamaSayegh/discourse/stargazers","contributors_url":"https://api.github.com/repos/OsamaSayegh/discourse/contributors","subscribers_url":"https://api.github.com/repos/OsamaSayegh/discourse/subscribers","subscription_url":"https://api.github.com/repos/OsamaSayegh/discourse/subscription","commits_url":"https://api.github.com/repos/OsamaSayegh/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/OsamaSayegh/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/OsamaSayegh/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/OsamaSayegh/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/OsamaSayegh/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/OsamaSayegh/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OsamaSayegh/discourse/merges","archive_url":"https://api.github.com/repos/OsamaSayegh/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OsamaSayegh/discourse/downloads","issues_url":"https://api.github.com/repos/OsamaSayegh/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/OsamaSayegh/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/OsamaSayegh/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/OsamaSayegh/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OsamaSayegh/discourse/labels{/name}","releases_url":"https://api.github.com/repos/OsamaSayegh/discourse/releases{/id}","deployments_url":"https://api.github.com/repos/OsamaSayegh/discourse/deployments","created_at":"2017-05-11T06:17:38Z","updated_at":"2018-08-06T20:58:14Z","pushed_at":"2018-08-06T21:56:46Z","git_url":"git://github.com/OsamaSayegh/discourse.git","ssh_url":"git@github.com:OsamaSayegh/discourse.git","clone_url":"https://github.com/OsamaSayegh/discourse.git","svn_url":"https://github.com/OsamaSayegh/discourse","homepage":"http://www.discourse.org","size":225906,"stargazers_count":0,"watchers_count":0,"language":"Ruby","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,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"discourse:master","ref":"master","sha":"8477501e83921aa6810a6cb3fbd86285643651b7","user":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"repo":{"id":7569578,"node_id":"MDEwOlJlcG9zaXRvcnk3NTY5NTc4","name":"discourse","full_name":"discourse/discourse","owner":{"login":"discourse","id":3220138,"node_id":"MDEyOk9yZ2FuaXphdGlvbjMyMjAxMzg=","avatar_url":"https://avatars2.githubusercontent.com/u/3220138?v=4","gravatar_id":"","url":"https://api.github.com/users/discourse","html_url":"https://github.com/discourse","followers_url":"https://api.github.com/users/discourse/followers","following_url":"https://api.github.com/users/discourse/following{/other_user}","gists_url":"https://api.github.com/users/discourse/gists{/gist_id}","starred_url":"https://api.github.com/users/discourse/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/discourse/subscriptions","organizations_url":"https://api.github.com/users/discourse/orgs","repos_url":"https://api.github.com/users/discourse/repos","events_url":"https://api.github.com/users/discourse/events{/privacy}","received_events_url":"https://api.github.com/users/discourse/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/discourse/discourse","description":"A platform for community discussion. Free, open, simple.","fork":false,"url":"https://api.github.com/repos/discourse/discourse","forks_url":"https://api.github.com/repos/discourse/discourse/forks","keys_url":"https://api.github.com/repos/discourse/discourse/keys{/key_id}","collaborators_url":"https://api.github.com/repos/discourse/discourse/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/discourse/discourse/teams","hooks_url":"https://api.github.com/repos/discourse/discourse/hooks","issue_events_url":"https://api.github.com/repos/discourse/discourse/issues/events{/number}","events_url":"https://api.github.com/repos/discourse/discourse/events","assignees_url":"https://api.github.com/repos/discourse/discourse/assignees{/user}","branches_url":"https://api.github.com/repos/discourse/discourse/branches{/branch}","tags_url":"https://api.github.com/repos/discourse/discourse/tags","blobs_url":"https://api.github.com/repos/discourse/discourse/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/discourse/discourse/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/discourse/discourse/git/refs{/sha}","trees_url":"https://api.github.com/repos/discourse/discourse/git/trees{/sha}","statuses_url":"https://api.github.com/repos/discourse/discourse/statuses/{sha}","languages_url":"https://api.github.com/repos/discourse/discourse/languages","stargazers_url":"https://api.github.com/repos/discourse/discourse/stargazers","contributors_url":"https://api.github.com/repos/discourse/discourse/contributors","subscribers_url":"https://api.github.com/repos/discourse/discourse/subscribers","subscription_url":"https://api.github.com/repos/discourse/discourse/subscription","commits_url":"https://api.github.com/repos/discourse/discourse/commits{/sha}","git_commits_url":"https://api.github.com/repos/discourse/discourse/git/commits{/sha}","comments_url":"https://api.github.com/repos/discourse/discourse/comments{/number}","issue_comment_url":"https://api.github.com/repos/discourse/discourse/issues/comments{/number}","contents_url":"https://api.github.com/repos/discourse/discourse/contents/{+path}","compare_url":"https://api.github.com/repos/discourse/discourse/compare/{base}...{head}","merges_url":"https://api.github.com/repos/discourse/discourse/merges","archive_url":"https://api.github.com/repos/discourse/discourse/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/discourse/discourse/downloads","issues_url":"https://api.github.com/repos/discourse/discourse/issues{/number}","pulls_url":"https://api.github.com/repos/discourse/discourse/pulls{/number}","milestones_url":"https://api.github.com/repos/discourse/discourse/milestones{/number}","notifications_url":"https://api.github.com/repos/discourse/discourse/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/discourse/discourse/labels{/name}","releases_url":"https://api.github.com/repos/discourse/discourse/releases{/id}","deployments_url":"https://api.github.com/repos/discourse/discourse/deployments","created_at":"2013-01-12T00:25:55Z","updated_at":"2018-08-07T05:22:36Z","pushed_at":"2018-08-07T05:35:36Z","git_url":"git://github.com/discourse/discourse.git","ssh_url":"git@github.com:discourse/discourse.git","clone_url":"https://github.com/discourse/discourse.git","svn_url":"https://github.com/discourse/discourse","homepage":"https://www.discourse.org","size":226754,"stargazers_count":25710,"watchers_count":25710,"language":"Ruby","has_issues":false,"has_projects":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":6150,"mirror_url":null,"archived":false,"open_issues_count":5,"license":{"key":"other","name":"Other","spdx_id":null,"url":null,"node_id":"MDc6TGljZW5zZTA="},"forks":6150,"open_issues":5,"watchers":25710,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6199"},"html":{"href":"https://github.com/discourse/discourse/pull/6199"},"issue":{"href":"https://api.github.com/repos/discourse/discourse/issues/6199"},"comments":{"href":"https://api.github.com/repos/discourse/discourse/issues/6199/comments"},"review_comments":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6199/comments"},"review_comment":{"href":"https://api.github.com/repos/discourse/discourse/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/discourse/discourse/pulls/6199/commits"},"statuses":{"href":"https://api.github.com/repos/discourse/discourse/statuses/ae0fe2daf56b06bc0ac8ac1656b249db8763df08"}},"author_association":"CONTRIBUTOR"}}
{"actor":{"display_login":"tgxworld"}}