Skip to content

Commit

Permalink
fix(editor): disable sidebar items if base gtfs not fetched
Browse files Browse the repository at this point in the history
fixes #404
  • Loading branch information
landonreed committed Feb 19, 2019
1 parent d0fe9a2 commit 883eb33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/editor/components/GtfsEditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,8 @@ export default class GtfsEditor extends Component<Props, State> {
const {id, name, projectId, organizationId} = feedSource
editingIsDisabled = !user.permissions ||
!user.permissions.hasFeedPermission(organizationId, projectId, id, 'edit-gtfs') ||
feedIsLocked
feedIsLocked ||
!status.baseFetched
if (editingIsDisabled) {
console.warn(`User does not have permission to edit GTFS for ${name}.`)
}
Expand Down
2 changes: 1 addition & 1 deletion lib/editor/reducers/data.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const data = (state: DataState = defaultState, action: Action): DataState => {
}
return update(state, {
tables: {$set: feed},
status: {$set: {}}
status: {$set: {baseFetched: true}}
})
}
case 'SHOW_EDITOR_MODAL':
Expand Down
1 change: 1 addition & 0 deletions lib/types/reducers.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export type LockState = {
}

export type EditorStatus = {
baseFetched?: boolean,
creatingSnapshot?: boolean,
savePending?: boolean,
saveSuccessful?: boolean,
Expand Down

0 comments on commit 883eb33

Please sign in to comment.