Only show delete button when it's deletable

This commit is contained in:
Eduard Urbach 2018-03-22 20:56:10 +01:00
parent fca33e240c
commit 95b5224011

View File

@ -7,6 +7,7 @@ import (
"strconv" "strconv"
"strings" "strings"
"github.com/aerogo/api"
"github.com/animenotifier/arn" "github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils" "github.com/animenotifier/notify.moe/utils"
@ -49,7 +50,9 @@ func Render(obj interface{}, title string, user *arn.User) string {
} }
// Delete button // Delete button
if user.Role == "editor" || user.Role == "admin" { _, isDeletable := obj.(api.Deletable)
if isDeletable && (user.Role == "editor" || user.Role == "admin") {
returnPath := "" returnPath := ""
switch lowerCaseTypeName { switch lowerCaseTypeName {