Fix edit link visibility, fixes #125
This commit is contained in:
parent
8aaf4b527d
commit
073f12f14e
@ -138,7 +138,7 @@
|
||||
<a id="adduser" class="menu-link" data-bind="onUserAdd"><?= $lang['adduser'] ?></a>
|
||||
<a id="edituser" class="menu-link" data-bind="onUserEdit"><?= $lang['edituser'] ?></a>
|
||||
<?php endif; ?>
|
||||
<a id="edittrack" class="menu-link" data-bind="onTrackEdit"><?= $lang['edittrack'] ?></a>
|
||||
<a id="edittrack" class="menu-link menu-hidden" data-bind="onTrackEdit"><?= $lang['edittrack'] ?></a>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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 = [];
|
||||
|
Loading…
x
Reference in New Issue
Block a user