Display favorites count on profile, fixes #126
This commit is contained in:
parent
0e17641f12
commit
bccb9a6f9c
@ -1,7 +1,7 @@
|
|||||||
import { defineMessages, injectIntl } from 'react-intl'
|
import { defineMessages, injectIntl } from 'react-intl'
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component'
|
import ImmutablePureComponent from 'react-immutable-pure-component'
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes'
|
import ImmutablePropTypes from 'react-immutable-proptypes'
|
||||||
import { me } from '../../initial_state'
|
import { me, favouritesCount } from '../../initial_state'
|
||||||
import { shortNumberFormat } from '../../utils/numbers'
|
import { shortNumberFormat } from '../../utils/numbers'
|
||||||
import PanelLayout from './panel_layout'
|
import PanelLayout from './panel_layout'
|
||||||
import UserStat from '../user_stat'
|
import UserStat from '../user_stat'
|
||||||
@ -51,7 +51,7 @@ class ProfileStatsPanel extends ImmutablePureComponent {
|
|||||||
account.get('id') === me &&
|
account.get('id') === me &&
|
||||||
<UserStat
|
<UserStat
|
||||||
title={intl.formatMessage(messages.favorites)}
|
title={intl.formatMessage(messages.favorites)}
|
||||||
value={shortNumberFormat(account.get('favourite_count'))} /* : todo : */
|
value={shortNumberFormat(favouritesCount)}
|
||||||
to={`/${account.get('acct')}/favorites`}
|
to={`/${account.get('acct')}/favorites`}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
|
@ -26,5 +26,6 @@ export const forceSingleColumn = !getMeta('advanced_layout');
|
|||||||
export const promotions = initialState && initialState.promotions;
|
export const promotions = initialState && initialState.promotions;
|
||||||
export const unreadCount = getMeta('unread_count');
|
export const unreadCount = getMeta('unread_count');
|
||||||
export const monthlyExpensesComplete = getMeta('monthly_expenses_complete');
|
export const monthlyExpensesComplete = getMeta('monthly_expenses_complete');
|
||||||
|
export const favouritesCount = getMeta('favourites_count');
|
||||||
|
|
||||||
export default initialState;
|
export default initialState;
|
||||||
|
@ -38,6 +38,7 @@ class InitialStateSerializer < ActiveModel::Serializer
|
|||||||
store[:is_staff] = object.current_account.user.staff?
|
store[:is_staff] = object.current_account.user.staff?
|
||||||
store[:unread_count] = unread_count object.current_account
|
store[:unread_count] = unread_count object.current_account
|
||||||
store[:monthly_expenses_complete] = Redis.current.get("monthly_funding_ammount") || 0
|
store[:monthly_expenses_complete] = Redis.current.get("monthly_funding_ammount") || 0
|
||||||
|
store[:favourites_count] = object.current_account.favourites.count.to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
store
|
store
|
||||||
|
Loading…
Reference in New Issue
Block a user