{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/63874536","id":63874536,"diff_hunk":"@@ -0,0 +1,50 @@\n+/**\n+ * External dependencies\n+ */\n+import { combineReducers } from 'redux';\n+import has from 'lodash/has';\n+import get from 'lodash/get';\n+import forOwn from 'lodash/forOwn';\n+/**\n+ * Internal dependencies\n+ */\n+import {\n+\tPREFERENCES_SET,\n+\tPREFERENCES_RECEIVE,\n+\tPREFERENCES_REMOVE,\n+\tPREFERENCES_FETCH\n+} from 'state/action-types';\n+import { USER_SETTING_KEY } from './actions';\n+\n+function values( state = {}, action ) {\n+\tif ( action.type === PREFERENCES_RECEIVE && has( action, [ 'data', USER_SETTING_KEY ] ) ) {\n+\t\tstate = Object.assign( {}, state, get( action, [ 'data', USER_SETTING_KEY ] ) );\n+\t\tforOwn( state, ( value, key ) => {\n+\t\t\tif ( null === value ) {\n+\t\t\t\tdelete state[ key ];\n+\t\t\t}\n+\t\t} );\n+\t} else if ( action.type === PREFERENCES_SET && action.key && action.value ) {","path":"client/state/preferences/reducer.js","position":null,"original_position":27,"commit_id":"8b6a7b62ab92dd032f686d0adb5fa5b7cd369f69","original_commit_id":"31023d5a4a3455a9de25c09e081321c6f9a25822","user":{"login":"artpi","id":3775068,"avatar_url":"https://avatars.githubusercontent.com/u/3775068?v=3","gravatar_id":"","url":"https://api.github.com/users/artpi","html_url":"https://github.com/artpi","followers_url":"https://api.github.com/users/artpi/followers","following_url":"https://api.github.com/users/artpi/following{/other_user}","gists_url":"https://api.github.com/users/artpi/gists{/gist_id}","starred_url":"https://api.github.com/users/artpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artpi/subscriptions","organizations_url":"https://api.github.com/users/artpi/orgs","repos_url":"https://api.github.com/users/artpi/repos","events_url":"https://api.github.com/users/artpi/events{/privacy}","received_events_url":"https://api.github.com/users/artpi/received_events","type":"User","site_admin":false},"body":"Yes, I hate switch!\r\nI don't think it improves anything over IF, but I rewrote it to use switches :)","created_at":"2016-05-19T13:09:52Z","updated_at":"2016-05-19T13:09:52Z","html_url":"https://github.com/Automattic/wp-calypso/pull/5401#discussion_r63874536","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/63874536"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/5401#discussion_r63874536"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401"}}},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401","id":70249881,"html_url":"https://github.com/Automattic/wp-calypso/pull/5401","diff_url":"https://github.com/Automattic/wp-calypso/pull/5401.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/5401.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5401","number":5401,"state":"open","locked":false,"title":"Move preferences to redux","user":{"login":"artpi","id":3775068,"avatar_url":"https://avatars.githubusercontent.com/u/3775068?v=3","gravatar_id":"","url":"https://api.github.com/users/artpi","html_url":"https://github.com/artpi","followers_url":"https://api.github.com/users/artpi/followers","following_url":"https://api.github.com/users/artpi/following{/other_user}","gists_url":"https://api.github.com/users/artpi/gists{/gist_id}","starred_url":"https://api.github.com/users/artpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artpi/subscriptions","organizations_url":"https://api.github.com/users/artpi/orgs","repos_url":"https://api.github.com/users/artpi/repos","events_url":"https://api.github.com/users/artpi/events{/privacy}","received_events_url":"https://api.github.com/users/artpi/received_events","type":"User","site_admin":false},"body":"Moves Preferences data to redux, as listed in #5046 \r\n\r\n- Introduces `preferences` redux tree\r\n- Introduces `QueryPreferences` component\r\n- Uses this in `post-editor`\r\n\r\n### TODO\r\n- README's\r\n- Tests\r\n- Other places where preferences flux store is used\r\n\r\n\r\n### Motivation\r\n- We need it for offline - its in the editor\r\n- I want to create `calypso-labs` to let users enable experimental features and need a place to store data\r\n \r\n\r\nCC @rralian @gwwar @mtias @aduth @retrofox \r\n","created_at":"2016-05-16T19:46:48Z","updated_at":"2016-05-19T13:09:52Z","closed_at":null,"merged_at":null,"merge_commit_sha":"aa37ce280ca80cb184fede6b513a5d21af74d4fa","assignee":{"login":"artpi","id":3775068,"avatar_url":"https://avatars.githubusercontent.com/u/3775068?v=3","gravatar_id":"","url":"https://api.github.com/users/artpi","html_url":"https://github.com/artpi","followers_url":"https://api.github.com/users/artpi/followers","following_url":"https://api.github.com/users/artpi/following{/other_user}","gists_url":"https://api.github.com/users/artpi/gists{/gist_id}","starred_url":"https://api.github.com/users/artpi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/artpi/subscriptions","organizations_url":"https://api.github.com/users/artpi/orgs","repos_url":"https://api.github.com/users/artpi/repos","events_url":"https://api.github.com/users/artpi/events{/privacy}","received_events_url":"https://api.github.com/users/artpi/received_events","type":"User","site_admin":false},"milestone":{"url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/70","html_url":"https://github.com/Automattic/wp-calypso/milestones/Offline%20i1:%20State%20tree%20consolidation","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones/70/labels","id":1664615,"number":70,"title":"Offline i1: State tree consolidation","description":"Move all the disparate pieces of data we have into the single redux state tree.","creator":{"login":"mtias","id":548849,"avatar_url":"https://avatars.githubusercontent.com/u/548849?v=3","gravatar_id":"","url":"https://api.github.com/users/mtias","html_url":"https://github.com/mtias","followers_url":"https://api.github.com/users/mtias/followers","following_url":"https://api.github.com/users/mtias/following{/other_user}","gists_url":"https://api.github.com/users/mtias/gists{/gist_id}","starred_url":"https://api.github.com/users/mtias/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mtias/subscriptions","organizations_url":"https://api.github.com/users/mtias/orgs","repos_url":"https://api.github.com/users/mtias/repos","events_url":"https://api.github.com/users/mtias/events{/privacy}","received_events_url":"https://api.github.com/users/mtias/received_events","type":"User","site_admin":false},"open_issues":5,"closed_issues":8,"state":"open","created_at":"2016-03-24T19:44:24Z","updated_at":"2016-05-19T12:26:19Z","due_on":null,"closed_at":null},"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401/comments","review_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/5401/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/8b6a7b62ab92dd032f686d0adb5fa5b7cd369f69","head":{"label":"Automattic:new/redux-preferences","ref":"new/redux-preferences","sha":"8b6a7b62ab92dd032f686d0adb5fa5b7cd369f69","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-05-19T12:35:27Z","pushed_at":"2016-05-19T13:05:55Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":76497,"stargazers_count":7306,"watchers_count":7306,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":883,"mirror_url":null,"open_issues_count":1311,"forks":883,"open_issues":1311,"watchers":7306,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"0a0262eb1a488d7c4c6ee636ebe57160e019711f","user":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"repo":{"id":45936895,"name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"avatar_url":"https://avatars.githubusercontent.com/u/887802?v=3","gravatar_id":"","url":"https://api.github.com/users/Automattic","html_url":"https://github.com/Automattic","followers_url":"https://api.github.com/users/Automattic/followers","following_url":"https://api.github.com/users/Automattic/following{/other_user}","gists_url":"https://api.github.com/users/Automattic/gists{/gist_id}","starred_url":"https://api.github.com/users/Automattic/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Automattic/subscriptions","organizations_url":"https://api.github.com/users/Automattic/orgs","repos_url":"https://api.github.com/users/Automattic/repos","events_url":"https://api.github.com/users/Automattic/events{/privacy}","received_events_url":"https://api.github.com/users/Automattic/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Automattic/wp-calypso","description":"The new JavaScript- and API-powered WordPress.com","fork":false,"url":"https://api.github.com/repos/Automattic/wp-calypso","forks_url":"https://api.github.com/repos/Automattic/wp-calypso/forks","keys_url":"https://api.github.com/repos/Automattic/wp-calypso/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Automattic/wp-calypso/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Automattic/wp-calypso/teams","hooks_url":"https://api.github.com/repos/Automattic/wp-calypso/hooks","issue_events_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/events{/number}","events_url":"https://api.github.com/repos/Automattic/wp-calypso/events","assignees_url":"https://api.github.com/repos/Automattic/wp-calypso/assignees{/user}","branches_url":"https://api.github.com/repos/Automattic/wp-calypso/branches{/branch}","tags_url":"https://api.github.com/repos/Automattic/wp-calypso/tags","blobs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Automattic/wp-calypso/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Automattic/wp-calypso/git/refs{/sha}","trees_url":"https://api.github.com/repos/Automattic/wp-calypso/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/{sha}","languages_url":"https://api.github.com/repos/Automattic/wp-calypso/languages","stargazers_url":"https://api.github.com/repos/Automattic/wp-calypso/stargazers","contributors_url":"https://api.github.com/repos/Automattic/wp-calypso/contributors","subscribers_url":"https://api.github.com/repos/Automattic/wp-calypso/subscribers","subscription_url":"https://api.github.com/repos/Automattic/wp-calypso/subscription","commits_url":"https://api.github.com/repos/Automattic/wp-calypso/commits{/sha}","git_commits_url":"https://api.github.com/repos/Automattic/wp-calypso/git/commits{/sha}","comments_url":"https://api.github.com/repos/Automattic/wp-calypso/comments{/number}","issue_comment_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/comments{/number}","contents_url":"https://api.github.com/repos/Automattic/wp-calypso/contents/{+path}","compare_url":"https://api.github.com/repos/Automattic/wp-calypso/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Automattic/wp-calypso/merges","archive_url":"https://api.github.com/repos/Automattic/wp-calypso/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Automattic/wp-calypso/downloads","issues_url":"https://api.github.com/repos/Automattic/wp-calypso/issues{/number}","pulls_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls{/number}","milestones_url":"https://api.github.com/repos/Automattic/wp-calypso/milestones{/number}","notifications_url":"https://api.github.com/repos/Automattic/wp-calypso/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Automattic/wp-calypso/labels{/name}","releases_url":"https://api.github.com/repos/Automattic/wp-calypso/releases{/id}","deployments_url":"https://api.github.com/repos/Automattic/wp-calypso/deployments","created_at":"2015-11-10T20:00:16Z","updated_at":"2016-05-19T12:35:27Z","pushed_at":"2016-05-19T13:05:55Z","git_url":"git://github.com/Automattic/wp-calypso.git","ssh_url":"git@github.com:Automattic/wp-calypso.git","clone_url":"https://github.com/Automattic/wp-calypso.git","svn_url":"https://github.com/Automattic/wp-calypso","homepage":"https://developer.wordpress.com/calypso/","size":76497,"stargazers_count":7306,"watchers_count":7306,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":883,"mirror_url":null,"open_issues_count":1311,"forks":883,"open_issues":1311,"watchers":7306,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/5401"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/5401"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/5401/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401/comments"},"review_comment":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/5401/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/8b6a7b62ab92dd032f686d0adb5fa5b7cd369f69"}}}}