diff --git a/index.php b/index.php index cbf0743..b2ebcc3 100644 --- a/index.php +++ b/index.php @@ -138,7 +138,7 @@ - + diff --git a/js/src/mapviewmodel.js b/js/src/mapviewmodel.js index a8e3e22..e178d34 100644 --- a/js/src/mapviewmodel.js +++ b/js/src/mapviewmodel.js @@ -193,7 +193,7 @@ export default class MapViewModel extends ViewModel { const pos = this.state.currentTrack.positions[id]; const count = this.state.currentTrack.length; const user = this.state.currentTrack.user; - const isEditable = auth.user && (auth.isAdmin || auth.user === user); + const isEditable = auth.user && (auth.isAdmin || auth.user.id === user.id); let date = '–––'; let time = '–––'; if (pos.timestamp > 0) { diff --git a/js/src/trackviewmodel.js b/js/src/trackviewmodel.js index 7318546..61b34ac 100644 --- a/js/src/trackviewmodel.js +++ b/js/src/trackviewmodel.js @@ -98,7 +98,10 @@ export default class TrackViewModel extends ViewModel { this.state.onChanged('currentUser', (user) => { if (user) { this.loadTrackList(); - TrackViewModel.setMenuVisible(this.editEl, true); + const isEditable = auth.user && (auth.isAdmin || auth.user.id === user.id); + if (isEditable) { + TrackViewModel.setMenuVisible(this.editEl, true); + } } else { this.model.currentTrackId = ''; this.model.trackList = [];