Show post edit buttons for admins too.
This commit is contained in:
parent
fc7dabddda
commit
2b8c6d585f
1 changed files with 4 additions and 1 deletions
|
|
@ -151,13 +151,16 @@ when defined(js):
|
|||
let loggedIn = currentUser.isSome()
|
||||
let authoredByUser =
|
||||
loggedIn and currentUser.get().name == post.author.name
|
||||
let currentAdmin =
|
||||
currentUser.isSome() and currentUser.get().rank == Admin
|
||||
|
||||
# Don't show buttons if the post is being edited.
|
||||
if state.editing.isSome() and state.editing.get() == post:
|
||||
return buildHtml(tdiv())
|
||||
|
||||
result = buildHtml():
|
||||
tdiv(class="post-buttons"):
|
||||
if authoredByUser:
|
||||
if authoredByUser or currentAdmin:
|
||||
tdiv(class="edit-button", onClick=(e: Event, n: VNode) =>
|
||||
onEditClick(e, n, post)):
|
||||
button(class="btn"):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue