From 38dd85daab8e8342ec608d24cf81254c0dfde95c Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Sun, 20 Nov 2016 19:39:18 +0100 Subject: Adding notifications column --- app/assets/javascripts/components/selectors/index.jsx | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'app/assets/javascripts/components/selectors') diff --git a/app/assets/javascripts/components/selectors/index.jsx b/app/assets/javascripts/components/selectors/index.jsx index 33b179cb8..20debe604 100644 --- a/app/assets/javascripts/components/selectors/index.jsx +++ b/app/assets/javascripts/components/selectors/index.jsx @@ -1,5 +1,5 @@ import { createSelector } from 'reselect' -import Immutable from 'immutable'; +import Immutable from 'immutable'; const getStatuses = state => state.get('statuses'); const getAccounts = state => state.get('accounts'); @@ -50,9 +50,9 @@ const assembleStatus = (id, statuses, accounts) => { return status.set('reblog', reblog).set('account', accounts.get(status.get('account'))); }; -const getNotificationsBase = state => state.get('notifications'); +const getAlertsBase = state => state.get('alerts'); -export const getNotifications = createSelector([getNotificationsBase], (base) => { +export const getAlerts = createSelector([getAlertsBase], (base) => { let arr = []; base.forEach(item => { @@ -66,3 +66,12 @@ export const getNotifications = createSelector([getNotificationsBase], (base) => return arr; }); + +export const makeGetNotification = () => { + return createSelector([ + (_, base) => base, + (state, _, accountId) => state.getIn(['accounts', accountId]) + ], (base, account) => { + return base.set('account', account); + }); +}; -- cgit