diff --git a/app/http/endpoints/api/panel/panelresend.go b/app/http/endpoints/api/panel/panelresend.go index 41aa012..2fa692e 100644 --- a/app/http/endpoints/api/panel/panelresend.go +++ b/app/http/endpoints/api/panel/panelresend.go @@ -46,6 +46,11 @@ func ResendPanel(ctx *gin.Context) { return } + if panel.ForceDisabled { + ctx.JSON(400, utils.ErrorStr("This panel is disabled and cannot be modified: please reactivate premium to re-enable it")) + return + } + // delete old message if err := rest.DeleteMessage(botContext.Token, botContext.RateLimiter, panel.ChannelId, panel.GuildId); err != nil { var unwrapped request.RestError diff --git a/app/http/endpoints/api/panel/panelupdate.go b/app/http/endpoints/api/panel/panelupdate.go index 96b4d39..5cce52f 100644 --- a/app/http/endpoints/api/panel/panelupdate.go +++ b/app/http/endpoints/api/panel/panelupdate.go @@ -49,6 +49,11 @@ func UpdatePanel(ctx *gin.Context) { return } + if existing.ForceDisabled { + ctx.JSON(400, utils.ErrorStr("This panel is disabled and cannot be modified: please reactivate premium to re-enable it")) + return + } + if !data.doValidations(ctx, guildId) { return } @@ -162,6 +167,7 @@ func UpdatePanel(ctx *gin.Context) { ButtonLabel: data.ButtonLabel, FormId: data.FormId, NamingScheme: data.NamingScheme, + ForceDisabled: existing.ForceDisabled, } if err = dbclient.Client.Panel.Update(panel); err != nil { diff --git a/frontend/src/views/Panels.svelte b/frontend/src/views/Panels.svelte index 73e524e..c7d2dbd 100644 --- a/frontend/src/views/Panels.svelte +++ b/frontend/src/views/Panels.svelte @@ -50,10 +50,10 @@ {panel.title} {channels.find((c) => c.id === panel.category_id)?.name ?? 'Unknown Category'} - + - + diff --git a/go.mod b/go.mod index 9610723..bc0a184 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/BurntSushi/toml v0.3.1 github.com/TicketsBot/archiverclient v0.0.0-20220326163414-558fd52746dc github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42 - github.com/TicketsBot/database v0.0.0-20220830131231-b5540b57f6cb + github.com/TicketsBot/database v0.0.0-20221213140509-14ca97c65cbf github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c github.com/TicketsBot/worker v0.0.0-20220830131837-12d85aca5c71 github.com/apex/log v1.1.2 diff --git a/go.sum b/go.sum index 1270d51..599fc27 100644 --- a/go.sum +++ b/go.sum @@ -41,6 +41,8 @@ github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42 h1:3/qnbrEfL8gqS github.com/TicketsBot/common v0.0.0-20220703211704-f792aa9f0c42/go.mod h1:WxHh6bY7KhIqdayeOp5f0Zj2NNi/7QqCQfMEqHnpdAM= github.com/TicketsBot/database v0.0.0-20220830131231-b5540b57f6cb h1:mXBn09KBzbVRmg+k1JC67DL8YXisCO74D9nIW/xi9Vg= github.com/TicketsBot/database v0.0.0-20220830131231-b5540b57f6cb/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI= +github.com/TicketsBot/database v0.0.0-20221213140509-14ca97c65cbf h1:85dMD4l9KoOolfkCi32FYJ8A+rsCFJW1nls3ZNNFIaA= +github.com/TicketsBot/database v0.0.0-20221213140509-14ca97c65cbf/go.mod h1:gAtOoQKZfCkQ4AoNWQUSl51Fnlqk+odzD/hZ1e1sXyI= github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c h1:OqGjFH6mbE6gd+NqI2ARJdtH3UUvhiAkD0r0fhGJK2s= github.com/TicketsBot/logarchiver v0.0.0-20220326162808-cdf0310f5e1c/go.mod h1:jgi2OXQKsd5nUnTIRkwvPmeuD/i7OhN68LKMssuQY1c= github.com/TicketsBot/ttlcache v1.6.1-0.20200405150101-acc18e37b261 h1:NHD5GB6cjlkpZFjC76Yli2S63/J2nhr8MuE6KlYJpQM=