From 95b52240111f65c40b7dae5e4d4f961e126f6abb Mon Sep 17 00:00:00 2001 From: Eduard Urbach Date: Thu, 22 Mar 2018 20:56:10 +0100 Subject: [PATCH] Only show delete button when it's deletable --- utils/editform/editform.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/utils/editform/editform.go b/utils/editform/editform.go index 789f78cb..a6dd3e0b 100644 --- a/utils/editform/editform.go +++ b/utils/editform/editform.go @@ -7,6 +7,7 @@ import ( "strconv" "strings" + "github.com/aerogo/api" "github.com/animenotifier/arn" "github.com/animenotifier/notify.moe/components" "github.com/animenotifier/notify.moe/utils" @@ -49,7 +50,9 @@ func Render(obj interface{}, title string, user *arn.User) string { } // Delete button - if user.Role == "editor" || user.Role == "admin" { + _, isDeletable := obj.(api.Deletable) + + if isDeletable && (user.Role == "editor" || user.Role == "admin") { returnPath := "" switch lowerCaseTypeName {