{"action":"created","comment":{"url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/comments/85503480","pull_request_review_id":5603497,"id":85503480,"diff_hunk":"@@ -0,0 +1,106 @@\n+import { createSelector } from 'reselect';\n+\n+import { getSlugSelector } from './router';\n+import { getAuthenticatedUserSelector } from './session';\n+\n+import i18nLib from '../lib/i18n';\n+import filterCollection from '../lib/filter_collection';\n+import { formatGithubContributors } from '../lib/github';\n+\n+import { getExpensesSelector } from './expenses';\n+import { getTransactionsSelector } from './transactions';\n+\n+import roles from '../constants/roles';\n+\n+const DEFAULT_COLLECTIVE_SETTINGS = {\n+  lang: 'en',\n+  formatCurrency: {\n+    compact: false,\n+    precision: 2\n+  }\n+};\n+\n+/*\n+ * Collective selectors\n+ */\n+const getCollectivesSelector = (state) => state.collectives;\n+\n+export const getCollectiveSelector = createSelector(\n+  [ getSlugSelector, getCollectivesSelector ],\n+  (slug, collectives) => collectives[slug]);\n+\n+export const getCollectiveSettingsSelector = createSelector(\n+  getCollectiveSelector,\n+  (collective) => collective.settings || DEFAULT_COLLECTIVE_SETTINGS);\n+\n+export const getStripeAccountSelector = createSelector(\n+  getCollectiveSelector,\n+  (collective) => collective.stripeAccount || {});\n+\n+export const getStripePublishableKeySelector = createSelector(\n+  getStripeAccountSelector,\n+  (stripeAccount) => stripeAccount.stripePublishableKey);\n+\n+const getCollectiveUsersByRoleSelector = createSelector(\n+  getCollectiveSelector,\n+  (collective) => collective.usersByRole || {});\n+\n+export const getCollectiveHostSelector = createSelector(\n+  getCollectiveUsersByRoleSelector,\n+  (usersByRole) => usersByRole[roles.HOST] || []);\n+\n+export const getCollectiveMembersSelector = createSelector(\n+  getCollectiveUsersByRoleSelector,\n+  (usersByRole) => usersByRole[roles.MEMBER] || []);\n+\n+export const getCollectiveBackersSelector = createSelector(\n+  getCollectiveUsersByRoleSelector,\n+  (usersByRole) => usersByRole[roles.BACKER] || []);\n+\n+export const hasHostSelector = createSelector(\n+  [getCollectiveHostSelector, getStripePublishableKeySelector],\n+  (host, publishableKey) => host.length === 1 && publishableKey ? true : false);\n+\n+export const getCollectiveDataSelector = createSelector(\n+  getCollectiveSelector,\n+  (collective) => collective.data || {});\n+\n+export const getCollectiveContributorsSelector = createSelector(\n+  getCollectiveDataSelector,\n+  (data) => data.githubContributors ? formatGithubContributors(data.githubContributors) : []);\n+\n+export const getPopulatedCollectiveSelector = createSelector(\n+  [ getCollectiveSelector,\n+    getCollectiveSettingsSelector,\n+    getCollectiveHostSelector,\n+    getCollectiveMembersSelector,\n+    getCollectiveBackersSelector,\n+    getCollectiveContributorsSelector,\n+    getExpensesSelector,\n+    getTransactionsSelector ],\n+    (collective, settings, host, members, backers, contributors, expenses, transactions) =>\n+      Object.assign(\n+        {},\n+        collective,\n+        settings,\n+        { host },\n+        { members },\n+        { backers },\n+        { backersCount: backers.length },\n+        { contributors },\n+        { contributorsCount: contributors.length },\n+        { expenses: filterCollection(expenses, { GroupId: collective.id })},\n+        { transactions: filterCollection(transactions, {GroupId: collective.id })},\n+    ));","path":"frontend/src/selectors/collectives.js","position":94,"original_position":94,"commit_id":"0e6c1b9fc2714c48adbbe0850c5696f98410331e","original_commit_id":"0e6c1b9fc2714c48adbbe0850c5696f98410331e","user":{"login":"xdamman","id":74358,"avatar_url":"https://avatars.githubusercontent.com/u/74358?v=3","gravatar_id":"","url":"https://api.github.com/users/xdamman","html_url":"https://github.com/xdamman","followers_url":"https://api.github.com/users/xdamman/followers","following_url":"https://api.github.com/users/xdamman/following{/other_user}","gists_url":"https://api.github.com/users/xdamman/gists{/gist_id}","starred_url":"https://api.github.com/users/xdamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdamman/subscriptions","organizations_url":"https://api.github.com/users/xdamman/orgs","repos_url":"https://api.github.com/users/xdamman/repos","events_url":"https://api.github.com/users/xdamman/events{/privacy}","received_events_url":"https://api.github.com/users/xdamman/received_events","type":"User","site_admin":false},"body":"I have mixed feeling with those selectors. I understand their utility but it's adding complexity. Is it worth it for us at our stage?\r\n\r\nI'm all for giving it a try, but you'll have to show me more next week.","created_at":"2016-10-28T10:01:26Z","updated_at":"2016-10-28T10:02:44Z","html_url":"https://github.com/OpenCollective/opencollective-website/pull/513#discussion_r85503480","pull_request_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513","_links":{"self":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/comments/85503480"},"html":{"href":"https://github.com/OpenCollective/opencollective-website/pull/513#discussion_r85503480"},"pull_request":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513"}}},"pull_request":{"url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513","id":89900229,"html_url":"https://github.com/OpenCollective/opencollective-website/pull/513","diff_url":"https://github.com/OpenCollective/opencollective-website/pull/513.diff","patch_url":"https://github.com/OpenCollective/opencollective-website/pull/513.patch","issue_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/513","number":513,"state":"open","locked":false,"title":"New collective page","user":{"login":"asood123","id":6106941,"avatar_url":"https://avatars.githubusercontent.com/u/6106941?v=3","gravatar_id":"","url":"https://api.github.com/users/asood123","html_url":"https://github.com/asood123","followers_url":"https://api.github.com/users/asood123/followers","following_url":"https://api.github.com/users/asood123/following{/other_user}","gists_url":"https://api.github.com/users/asood123/gists{/gist_id}","starred_url":"https://api.github.com/users/asood123/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/asood123/subscriptions","organizations_url":"https://api.github.com/users/asood123/orgs","repos_url":"https://api.github.com/users/asood123/repos","events_url":"https://api.github.com/users/asood123/events{/privacy}","received_events_url":"https://api.github.com/users/asood123/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-10-18T21:14:41Z","updated_at":"2016-10-28T10:02:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"506e692408d90a3c40d233e1159260cf16634c07","assignee":{"login":"xdamman","id":74358,"avatar_url":"https://avatars.githubusercontent.com/u/74358?v=3","gravatar_id":"","url":"https://api.github.com/users/xdamman","html_url":"https://github.com/xdamman","followers_url":"https://api.github.com/users/xdamman/followers","following_url":"https://api.github.com/users/xdamman/following{/other_user}","gists_url":"https://api.github.com/users/xdamman/gists{/gist_id}","starred_url":"https://api.github.com/users/xdamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdamman/subscriptions","organizations_url":"https://api.github.com/users/xdamman/orgs","repos_url":"https://api.github.com/users/xdamman/repos","events_url":"https://api.github.com/users/xdamman/events{/privacy}","received_events_url":"https://api.github.com/users/xdamman/received_events","type":"User","site_admin":false},"assignees":[{"login":"xdamman","id":74358,"avatar_url":"https://avatars.githubusercontent.com/u/74358?v=3","gravatar_id":"","url":"https://api.github.com/users/xdamman","html_url":"https://github.com/xdamman","followers_url":"https://api.github.com/users/xdamman/followers","following_url":"https://api.github.com/users/xdamman/following{/other_user}","gists_url":"https://api.github.com/users/xdamman/gists{/gist_id}","starred_url":"https://api.github.com/users/xdamman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/xdamman/subscriptions","organizations_url":"https://api.github.com/users/xdamman/orgs","repos_url":"https://api.github.com/users/xdamman/repos","events_url":"https://api.github.com/users/xdamman/events{/privacy}","received_events_url":"https://api.github.com/users/xdamman/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513/commits","review_comments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513/comments","review_comment_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/comments{/number}","comments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/513/comments","statuses_url":"https://api.github.com/repos/OpenCollective/opencollective-website/statuses/0e6c1b9fc2714c48adbbe0850c5696f98410331e","head":{"label":"OpenCollective:new-collective-page","ref":"new-collective-page","sha":"0e6c1b9fc2714c48adbbe0850c5696f98410331e","user":{"login":"OpenCollective","id":13403593,"avatar_url":"https://avatars.githubusercontent.com/u/13403593?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenCollective","html_url":"https://github.com/OpenCollective","followers_url":"https://api.github.com/users/OpenCollective/followers","following_url":"https://api.github.com/users/OpenCollective/following{/other_user}","gists_url":"https://api.github.com/users/OpenCollective/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenCollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenCollective/subscriptions","organizations_url":"https://api.github.com/users/OpenCollective/orgs","repos_url":"https://api.github.com/users/OpenCollective/repos","events_url":"https://api.github.com/users/OpenCollective/events{/privacy}","received_events_url":"https://api.github.com/users/OpenCollective/received_events","type":"Organization","site_admin":false},"repo":{"id":51088990,"name":"opencollective-website","full_name":"OpenCollective/opencollective-website","owner":{"login":"OpenCollective","id":13403593,"avatar_url":"https://avatars.githubusercontent.com/u/13403593?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenCollective","html_url":"https://github.com/OpenCollective","followers_url":"https://api.github.com/users/OpenCollective/followers","following_url":"https://api.github.com/users/OpenCollective/following{/other_user}","gists_url":"https://api.github.com/users/OpenCollective/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenCollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenCollective/subscriptions","organizations_url":"https://api.github.com/users/OpenCollective/orgs","repos_url":"https://api.github.com/users/OpenCollective/repos","events_url":"https://api.github.com/users/OpenCollective/events{/privacy}","received_events_url":"https://api.github.com/users/OpenCollective/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenCollective/opencollective-website","description":"OpenCollective frontend","fork":false,"url":"https://api.github.com/repos/OpenCollective/opencollective-website","forks_url":"https://api.github.com/repos/OpenCollective/opencollective-website/forks","keys_url":"https://api.github.com/repos/OpenCollective/opencollective-website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenCollective/opencollective-website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenCollective/opencollective-website/teams","hooks_url":"https://api.github.com/repos/OpenCollective/opencollective-website/hooks","issue_events_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/events{/number}","events_url":"https://api.github.com/repos/OpenCollective/opencollective-website/events","assignees_url":"https://api.github.com/repos/OpenCollective/opencollective-website/assignees{/user}","branches_url":"https://api.github.com/repos/OpenCollective/opencollective-website/branches{/branch}","tags_url":"https://api.github.com/repos/OpenCollective/opencollective-website/tags","blobs_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenCollective/opencollective-website/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenCollective/opencollective-website/languages","stargazers_url":"https://api.github.com/repos/OpenCollective/opencollective-website/stargazers","contributors_url":"https://api.github.com/repos/OpenCollective/opencollective-website/contributors","subscribers_url":"https://api.github.com/repos/OpenCollective/opencollective-website/subscribers","subscription_url":"https://api.github.com/repos/OpenCollective/opencollective-website/subscription","commits_url":"https://api.github.com/repos/OpenCollective/opencollective-website/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenCollective/opencollective-website/contents/{+path}","compare_url":"https://api.github.com/repos/OpenCollective/opencollective-website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenCollective/opencollective-website/merges","archive_url":"https://api.github.com/repos/OpenCollective/opencollective-website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenCollective/opencollective-website/downloads","issues_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues{/number}","pulls_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenCollective/opencollective-website/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenCollective/opencollective-website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenCollective/opencollective-website/labels{/name}","releases_url":"https://api.github.com/repos/OpenCollective/opencollective-website/releases{/id}","deployments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/deployments","created_at":"2016-02-04T16:30:42Z","updated_at":"2016-10-23T00:18:16Z","pushed_at":"2016-10-28T03:19:43Z","git_url":"git://github.com/OpenCollective/opencollective-website.git","ssh_url":"git@github.com:OpenCollective/opencollective-website.git","clone_url":"https://github.com/OpenCollective/opencollective-website.git","svn_url":"https://github.com/OpenCollective/opencollective-website","homepage":"","size":44342,"stargazers_count":15,"watchers_count":15,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":10,"forks":13,"open_issues":10,"watchers":15,"default_branch":"master"}},"base":{"label":"OpenCollective:master","ref":"master","sha":"b04dc857103a8a47983f1972e6fd20ce7be78b0e","user":{"login":"OpenCollective","id":13403593,"avatar_url":"https://avatars.githubusercontent.com/u/13403593?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenCollective","html_url":"https://github.com/OpenCollective","followers_url":"https://api.github.com/users/OpenCollective/followers","following_url":"https://api.github.com/users/OpenCollective/following{/other_user}","gists_url":"https://api.github.com/users/OpenCollective/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenCollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenCollective/subscriptions","organizations_url":"https://api.github.com/users/OpenCollective/orgs","repos_url":"https://api.github.com/users/OpenCollective/repos","events_url":"https://api.github.com/users/OpenCollective/events{/privacy}","received_events_url":"https://api.github.com/users/OpenCollective/received_events","type":"Organization","site_admin":false},"repo":{"id":51088990,"name":"opencollective-website","full_name":"OpenCollective/opencollective-website","owner":{"login":"OpenCollective","id":13403593,"avatar_url":"https://avatars.githubusercontent.com/u/13403593?v=3","gravatar_id":"","url":"https://api.github.com/users/OpenCollective","html_url":"https://github.com/OpenCollective","followers_url":"https://api.github.com/users/OpenCollective/followers","following_url":"https://api.github.com/users/OpenCollective/following{/other_user}","gists_url":"https://api.github.com/users/OpenCollective/gists{/gist_id}","starred_url":"https://api.github.com/users/OpenCollective/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/OpenCollective/subscriptions","organizations_url":"https://api.github.com/users/OpenCollective/orgs","repos_url":"https://api.github.com/users/OpenCollective/repos","events_url":"https://api.github.com/users/OpenCollective/events{/privacy}","received_events_url":"https://api.github.com/users/OpenCollective/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/OpenCollective/opencollective-website","description":"OpenCollective frontend","fork":false,"url":"https://api.github.com/repos/OpenCollective/opencollective-website","forks_url":"https://api.github.com/repos/OpenCollective/opencollective-website/forks","keys_url":"https://api.github.com/repos/OpenCollective/opencollective-website/keys{/key_id}","collaborators_url":"https://api.github.com/repos/OpenCollective/opencollective-website/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/OpenCollective/opencollective-website/teams","hooks_url":"https://api.github.com/repos/OpenCollective/opencollective-website/hooks","issue_events_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/events{/number}","events_url":"https://api.github.com/repos/OpenCollective/opencollective-website/events","assignees_url":"https://api.github.com/repos/OpenCollective/opencollective-website/assignees{/user}","branches_url":"https://api.github.com/repos/OpenCollective/opencollective-website/branches{/branch}","tags_url":"https://api.github.com/repos/OpenCollective/opencollective-website/tags","blobs_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/refs{/sha}","trees_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/trees{/sha}","statuses_url":"https://api.github.com/repos/OpenCollective/opencollective-website/statuses/{sha}","languages_url":"https://api.github.com/repos/OpenCollective/opencollective-website/languages","stargazers_url":"https://api.github.com/repos/OpenCollective/opencollective-website/stargazers","contributors_url":"https://api.github.com/repos/OpenCollective/opencollective-website/contributors","subscribers_url":"https://api.github.com/repos/OpenCollective/opencollective-website/subscribers","subscription_url":"https://api.github.com/repos/OpenCollective/opencollective-website/subscription","commits_url":"https://api.github.com/repos/OpenCollective/opencollective-website/commits{/sha}","git_commits_url":"https://api.github.com/repos/OpenCollective/opencollective-website/git/commits{/sha}","comments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/comments{/number}","issue_comment_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/comments{/number}","contents_url":"https://api.github.com/repos/OpenCollective/opencollective-website/contents/{+path}","compare_url":"https://api.github.com/repos/OpenCollective/opencollective-website/compare/{base}...{head}","merges_url":"https://api.github.com/repos/OpenCollective/opencollective-website/merges","archive_url":"https://api.github.com/repos/OpenCollective/opencollective-website/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/OpenCollective/opencollective-website/downloads","issues_url":"https://api.github.com/repos/OpenCollective/opencollective-website/issues{/number}","pulls_url":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls{/number}","milestones_url":"https://api.github.com/repos/OpenCollective/opencollective-website/milestones{/number}","notifications_url":"https://api.github.com/repos/OpenCollective/opencollective-website/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/OpenCollective/opencollective-website/labels{/name}","releases_url":"https://api.github.com/repos/OpenCollective/opencollective-website/releases{/id}","deployments_url":"https://api.github.com/repos/OpenCollective/opencollective-website/deployments","created_at":"2016-02-04T16:30:42Z","updated_at":"2016-10-23T00:18:16Z","pushed_at":"2016-10-28T03:19:43Z","git_url":"git://github.com/OpenCollective/opencollective-website.git","ssh_url":"git@github.com:OpenCollective/opencollective-website.git","clone_url":"https://github.com/OpenCollective/opencollective-website.git","svn_url":"https://github.com/OpenCollective/opencollective-website","homepage":"","size":44342,"stargazers_count":15,"watchers_count":15,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":13,"mirror_url":null,"open_issues_count":10,"forks":13,"open_issues":10,"watchers":15,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513"},"html":{"href":"https://github.com/OpenCollective/opencollective-website/pull/513"},"issue":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/513"},"comments":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/issues/513/comments"},"review_comments":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513/comments"},"review_comment":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/pulls/513/commits"},"statuses":{"href":"https://api.github.com/repos/OpenCollective/opencollective-website/statuses/0e6c1b9fc2714c48adbbe0850c5696f98410331e"}}}}
{"actor":{"display_login":"xdamman"}}