Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

Commit

Permalink
✨ hide sorting by rating in proposals list, when enabled for event (#749
Browse files Browse the repository at this point in the history
)
  • Loading branch information
bpetetot authored Jan 1, 2020
1 parent 47ed49b commit 7b6480f
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ import get from 'lodash/get'

import ProposalFilters from './proposalsFilters'

const filterSortOrders = (sortOrders, hideRatings) => {
return sortOrders.filter(order => !(/Rating/gm.test(order) && hideRatings))
}

const mapStore = (store, props, { router }) => {
const eventId = router.getParam('eventId')
const sortOrders = router.getParam('sortOrders')
Expand All @@ -11,15 +15,16 @@ const mapStore = (store, props, { router }) => {
const { formats, categories } = store.data.events.get(eventId) || {}
const settings = store.data.eventsSettings.get(eventId)
const filters = store.ui.organizer.proposals.get()
const hideRatings = get(settings, 'deliberation.hideRatings')

return {
eventId,
statuses,
ratings,
formats,
categories,
sortOrders,
filters,
sortOrders: filterSortOrders(sortOrders, hideRatings),
deliberationActive: get(settings, 'deliberation.enabled'),
onChange: ({ target }) => {
store.ui.organizer.proposals.update({ [target.id]: target.value })
Expand Down

0 comments on commit 7b6480f

Please sign in to comment.