{"action":"created","comment":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/209674702","pull_request_review_id":145733683,"id":209674702,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwOTY3NDcwMg==","diff_hunk":"@@ -0,0 +1,25 @@\n+/** @format */\n+\n+/**\n+ * Internal dependencies\n+ */\n+\n+import getUnseenCount from 'state/selectors/get-notification-unseen-count';\n+import { getCurrentUser } from 'state/current-user/selectors';\n+\n+export const hasUnseenNotifications = getUser => state => {","path":"client/state/selectors/has-unseen-notifications.js","position":10,"original_position":10,"commit_id":"2a92794eb0a3d132e1783fc3860af8cf3c7b6c62","original_commit_id":"2a92794eb0a3d132e1783fc3860af8cf3c7b6c62","user":{"login":"gwwar","id":1270189,"node_id":"MDQ6VXNlcjEyNzAxODk=","avatar_url":"https://avatars3.githubusercontent.com/u/1270189?v=4","gravatar_id":"","url":"https://api.github.com/users/gwwar","html_url":"https://github.com/gwwar","followers_url":"https://api.github.com/users/gwwar/followers","following_url":"https://api.github.com/users/gwwar/following{/other_user}","gists_url":"https://api.github.com/users/gwwar/gists{/gist_id}","starred_url":"https://api.github.com/users/gwwar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gwwar/subscriptions","organizations_url":"https://api.github.com/users/gwwar/orgs","repos_url":"https://api.github.com/users/gwwar/repos","events_url":"https://api.github.com/users/gwwar/events{/privacy}","received_events_url":"https://api.github.com/users/gwwar/received_events","type":"User","site_admin":false},"body":"> the sad thing here is that all we really care about is a property on the current user object \r\n\r\nSelectors can access anything in the global state tree, so this coupling in tests, I don't particularly mind. If we end up modifying the user tree structure, this test is easy to update, and also marks that we care about a specific user prop. (Sometimes we don't know what we can trim from an endpoint response, and for example when we trimmed down the site object, we just had to guess and see what broke later.)\r\n\r\nI won't block here, but at least leave a comment that it's meant for testing purposes only. When I see an interface like that I assume we have use cases for them, where we swap actual `getUser` implementations.","created_at":"2018-08-13T16:28:03Z","updated_at":"2018-08-13T16:28:03Z","html_url":"https://github.com/Automattic/wp-calypso/pull/26491#discussion_r209674702","pull_request_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/comments/209674702"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/26491#discussion_r209674702"},"pull_request":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491"}},"in_reply_to_id":209319508},"pull_request":{"url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491","id":206053015,"node_id":"MDExOlB1bGxSZXF1ZXN0MjA2MDUzMDE1","html_url":"https://github.com/Automattic/wp-calypso/pull/26491","diff_url":"https://github.com/Automattic/wp-calypso/pull/26491.diff","patch_url":"https://github.com/Automattic/wp-calypso/pull/26491.patch","issue_url":"https://api.github.com/repos/Automattic/wp-calypso/issues/26491","number":26491,"state":"open","locked":false,"title":"Add notification unseen count to redux store","user":{"login":"adlk","id":3265004,"node_id":"MDQ6VXNlcjMyNjUwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3265004?v=4","gravatar_id":"","url":"https://api.github.com/users/adlk","html_url":"https://github.com/adlk","followers_url":"https://api.github.com/users/adlk/followers","following_url":"https://api.github.com/users/adlk/following{/other_user}","gists_url":"https://api.github.com/users/adlk/gists{/gist_id}","starred_url":"https://api.github.com/users/adlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adlk/subscriptions","organizations_url":"https://api.github.com/users/adlk/orgs","repos_url":"https://api.github.com/users/adlk/repos","events_url":"https://api.github.com/users/adlk/events{/privacy}","received_events_url":"https://api.github.com/users/adlk/received_events","type":"User","site_admin":false},"body":"This PR adds the notification unseen count to the redux state. \r\n\r\n### Motivation & Context\r\nIn WP-Desktop we'd like to subscribe to changes in the redux state for e.g. displaying/updating the dock badge and bouncing the dock icon (+ hundreds of other 😎things). Therefore, being able to subscribe to changes gives us tons of new opportunities for interacting with the desktop app.\r\n\r\nThe way it's currently shared with wp-desktop is quite faulty as parts of the communication with the app has been deprecated a while ago. (`message` event) \r\n\r\n@dmsnell has been so kind to walk be through the migration process.\r\n\r\n### How to test\r\n- Start the dev server and open calypso\r\n- Create a new notification\r\n- In console enter `actionLog.filter(/NOTIFICATIONS/i);`\r\n- You should see something like: \r\n   ```js\r\n   [{type: \"NOTIFICATIONS_UNSEEN_COUNT_SET\", unseenCount: 1, meta: {…}}]\r\n   ```\r\n\r\n### Gotchas/Todos\r\n- The notification count is only updated when e.g. a new notification is created. We might need to update this during the initial load as well.\r\n- We need to expose the redux state to files like `client/lib/desktop.js` to be able to subscribe to changes. /cc @jsnajdr, @gwwar ","created_at":"2018-08-03T14:47:05Z","updated_at":"2018-08-13T16:28:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"55633c665c57631572f7a63fb259e04a60a0b62b","assignee":{"login":"adlk","id":3265004,"node_id":"MDQ6VXNlcjMyNjUwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3265004?v=4","gravatar_id":"","url":"https://api.github.com/users/adlk","html_url":"https://github.com/adlk","followers_url":"https://api.github.com/users/adlk/followers","following_url":"https://api.github.com/users/adlk/following{/other_user}","gists_url":"https://api.github.com/users/adlk/gists{/gist_id}","starred_url":"https://api.github.com/users/adlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adlk/subscriptions","organizations_url":"https://api.github.com/users/adlk/orgs","repos_url":"https://api.github.com/users/adlk/repos","events_url":"https://api.github.com/users/adlk/events{/privacy}","received_events_url":"https://api.github.com/users/adlk/received_events","type":"User","site_admin":false},"assignees":[{"login":"adlk","id":3265004,"node_id":"MDQ6VXNlcjMyNjUwMDQ=","avatar_url":"https://avatars1.githubusercontent.com/u/3265004?v=4","gravatar_id":"","url":"https://api.github.com/users/adlk","html_url":"https://github.com/adlk","followers_url":"https://api.github.com/users/adlk/followers","following_url":"https://api.github.com/users/adlk/following{/other_user}","gists_url":"https://api.github.com/users/adlk/gists{/gist_id}","starred_url":"https://api.github.com/users/adlk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adlk/subscriptions","organizations_url":"https://api.github.com/users/adlk/orgs","repos_url":"https://api.github.com/users/adlk/repos","events_url":"https://api.github.com/users/adlk/events{/privacy}","received_events_url":"https://api.github.com/users/adlk/received_events","type":"User","site_admin":false}],"requested_reviewers":[{"login":"jsnajdr","id":664258,"node_id":"MDQ6VXNlcjY2NDI1OA==","avatar_url":"https://avatars3.githubusercontent.com/u/664258?v=4","gravatar_id":"","url":"https://api.github.com/users/jsnajdr","html_url":"https://github.com/jsnajdr","followers_url":"https://api.github.com/users/jsnajdr/followers","following_url":"https://api.github.com/users/jsnajdr/following{/other_user}","gists_url":"https://api.github.com/users/jsnajdr/gists{/gist_id}","starred_url":"https://api.github.com/users/jsnajdr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsnajdr/subscriptions","organizations_url":"https://api.github.com/users/jsnajdr/orgs","repos_url":"https://api.github.com/users/jsnajdr/repos","events_url":"https://api.github.com/users/jsnajdr/events{/privacy}","received_events_url":"https://api.github.com/users/jsnajdr/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[{"id":285010018,"node_id":"MDU6TGFiZWwyODUwMTAwMTg=","url":"https://api.github.com/repos/Automattic/wp-calypso/labels/[Status]%20Needs%20Review","name":"[Status] Needs Review","color":"fbca04","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491/commits","review_comments_url":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491/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/26491/comments","statuses_url":"https://api.github.com/repos/Automattic/wp-calypso/statuses/2a92794eb0a3d132e1783fc3860af8cf3c7b6c62","head":{"label":"Automattic:update/reduxify-notification-count","ref":"update/reduxify-notification-count","sha":"2a92794eb0a3d132e1783fc3860af8cf3c7b6c62","user":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk0NTkzNjg5NQ==","name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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 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":"2018-08-13T15:43:27Z","pushed_at":"2018-08-13T16:21:56Z","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":106228,"stargazers_count":10278,"watchers_count":10278,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1449,"mirror_url":null,"archived":false,"open_issues_count":1569,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":1449,"open_issues":1569,"watchers":10278,"default_branch":"master"}},"base":{"label":"Automattic:master","ref":"master","sha":"7957b4d52a4de81506196a4d5fee9f7dfc64b250","user":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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,"node_id":"MDEwOlJlcG9zaXRvcnk0NTkzNjg5NQ==","name":"wp-calypso","full_name":"Automattic/wp-calypso","owner":{"login":"Automattic","id":887802,"node_id":"MDEyOk9yZ2FuaXphdGlvbjg4NzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/887802?v=4","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 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":"2018-08-13T15:43:27Z","pushed_at":"2018-08-13T16:21:56Z","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":106228,"stargazers_count":10278,"watchers_count":10278,"language":"JavaScript","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1449,"mirror_url":null,"archived":false,"open_issues_count":1569,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0","node_id":"MDc6TGljZW5zZTg="},"forks":1449,"open_issues":1569,"watchers":10278,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491"},"html":{"href":"https://github.com/Automattic/wp-calypso/pull/26491"},"issue":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/26491"},"comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/issues/26491/comments"},"review_comments":{"href":"https://api.github.com/repos/Automattic/wp-calypso/pulls/26491/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/26491/commits"},"statuses":{"href":"https://api.github.com/repos/Automattic/wp-calypso/statuses/2a92794eb0a3d132e1783fc3860af8cf3c7b6c62"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"gwwar"}}