Only show delete button when it's deletable
This commit is contained in:
parent
fca33e240c
commit
95b5224011
@ -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 {
|
||||||
|
Loading…
Reference in New Issue
Block a user