Skip to content

Commit

Permalink
fix(GtfsFilter): filter searched feeds based on alert/signs privileges
Browse files Browse the repository at this point in the history
  • Loading branch information
landonreed committed Mar 14, 2017
1 parent 9571d56 commit c8c65d2
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
4 changes: 2 additions & 2 deletions lib/gtfs/actions/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const updatingGtfsFilter = (activeProject, user) => {
}
}

export const updateLoadedFeeds = (loadedFeeds) => {
export function updateLoadedFeeds (loadedFeeds) {
return {
type: 'UPDATE_LOADED_FEEDS',
loadedFeeds
Expand Down Expand Up @@ -46,7 +46,7 @@ export function updateGtfsFilter (activeProject, user) {
}
}

export const updatePermissionFilter = (permission) => {
export function updatePermissionFilter (permission) {
return {
type: 'UPDATE_GTFS_PERMISSION_FILTER',
permission
Expand Down
15 changes: 6 additions & 9 deletions lib/gtfs/components/gtfsmapsearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`)
Expand Down
13 changes: 9 additions & 4 deletions lib/gtfs/containers/GlobalGtfsFilter.js
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -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))
}
Expand Down

0 comments on commit c8c65d2

Please sign in to comment.