From 2b8c6d585f365cc4668b50dc6037e83156c890f1 Mon Sep 17 00:00:00 2001 From: Dominik Picheta Date: Wed, 16 May 2018 22:50:55 +0100 Subject: [PATCH] Show post edit buttons for admins too. --- redesign/postlist.nim | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/redesign/postlist.nim b/redesign/postlist.nim index 795cb94..5620a06 100644 --- a/redesign/postlist.nim +++ b/redesign/postlist.nim @@ -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"):