From c8c65d2a0ffa137278d7a82c2763e5dbe09f42d3 Mon Sep 17 00:00:00 2001 From: Landon Reed Date: Thu, 9 Mar 2017 09:44:45 -0500 Subject: [PATCH] fix(GtfsFilter): filter searched feeds based on alert/signs privileges --- lib/gtfs/actions/filter.js | 4 ++-- lib/gtfs/components/gtfsmapsearch.js | 15 ++++++--------- lib/gtfs/containers/GlobalGtfsFilter.js | 13 +++++++++---- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/lib/gtfs/actions/filter.js b/lib/gtfs/actions/filter.js index 558b853bd..1da54b938 100644 --- a/lib/gtfs/actions/filter.js +++ b/lib/gtfs/actions/filter.js @@ -8,7 +8,7 @@ export const updatingGtfsFilter = (activeProject, user) => { } } -export const updateLoadedFeeds = (loadedFeeds) => { +export function updateLoadedFeeds (loadedFeeds) { return { type: 'UPDATE_LOADED_FEEDS', loadedFeeds @@ -46,7 +46,7 @@ export function updateGtfsFilter (activeProject, user) { } } -export const updatePermissionFilter = (permission) => { +export function updatePermissionFilter (permission) { return { type: 'UPDATE_GTFS_PERMISSION_FILTER', permission diff --git a/lib/gtfs/components/gtfsmapsearch.js b/lib/gtfs/components/gtfsmapsearch.js index 17b86f4c0..cbd067f55 100644 --- a/lib/gtfs/components/gtfsmapsearch.js +++ b/lib/gtfs/components/gtfsmapsearch.js @@ -9,15 +9,12 @@ export default class GtfsMapSearch extends Component { static propTypes = { placeholder: PropTypes.string } - constructor (props) { - super(props) - this.state = { - stop: null, - pattern: null, - message: '', - searching: ['stops', 'routes'], - map: {} - } + state = { + stop: null, + pattern: null, + message: '', + searching: ['stops', 'routes'], + map: {} } getPatterns (input) { return fetch(`/api/manager/patterns?route=${input.route.route_id}&feed=${input.route.feed_id}`) diff --git a/lib/gtfs/containers/GlobalGtfsFilter.js b/lib/gtfs/containers/GlobalGtfsFilter.js index 25f5e7080..b5d8d710b 100644 --- a/lib/gtfs/containers/GlobalGtfsFilter.js +++ b/lib/gtfs/containers/GlobalGtfsFilter.js @@ -1,8 +1,13 @@ import { connect } from 'react-redux' import GtfsFilter from '../components/GtfsFilter' -import { addActiveFeed, removeActiveFeed, addAllActiveFeeds, - removeAllActiveFeeds, updateGtfsFilter } from '../actions/filter' +import { addActiveFeed, + removeActiveFeed, + addAllActiveFeeds, + removeAllActiveFeeds, + updateGtfsFilter, + updatePermissionFilter +} from '../actions/filter' const mapStateToProps = (state, ownProps) => { return { @@ -17,8 +22,8 @@ const mapStateToProps = (state, ownProps) => { const mapDispatchToProps = (dispatch, ownProps) => { return { onComponentMount: (initialProps) => { - // let filter = initialProps.permissionFilter || 'view-feed' - // dispatch(updatePermissionFilter(filter)) + let filter = initialProps.permissionFilter || 'view-feed' + dispatch(updatePermissionFilter(filter)) if (initialProps.project && initialProps.user) { dispatch(updateGtfsFilter(initialProps.project, initialProps.user)) }