Hide claim button

This commit is contained in:
rxdn 2021-08-01 13:32:22 +01:00
parent 2fed274263
commit d35ae1f243
5 changed files with 16 additions and 4 deletions

View File

@ -9,6 +9,7 @@ import (
)
type Settings struct {
database.Settings
Prefix string `json:"prefix"`
WelcomeMessaage string `json:"welcome_message"`
TicketLimit uint8 `json:"ticket_limit"`
@ -28,6 +29,11 @@ func GetSettingsHandler(ctx *gin.Context) {
group, _ := errgroup.WithContext(context.Background())
group.Go(func() (err error) {
settings.Settings, err = dbclient.Client.Settings.Get(guildId)
return
})
// prefix
group.Go(func() (err error) {
settings.Prefix, err = dbclient.Client.Prefix.Get(guildId)

View File

@ -24,6 +24,7 @@ func UpdateSettingsHandler(ctx *gin.Context) {
channels := cache.Instance.GetGuildChannels(guildId)
// TODO: Errors
settings.updateSettings(guildId)
validPrefix := settings.updatePrefix(guildId)
validWelcomeMessage := settings.updateWelcomeMessage(guildId)
validTicketLimit := settings.updateTicketLimit(guildId)
@ -46,6 +47,10 @@ func UpdateSettingsHandler(ctx *gin.Context) {
}
// TODO: Return error
func (s *Settings) updateSettings(guildId uint64) {
go dbclient.Client.Settings.Set(guildId, s.Settings)
}
func (s *Settings) updatePrefix(guildId uint64) bool {
if s.Prefix == "" || len(s.Prefix) > 8 {
return false

View File

@ -19,11 +19,12 @@
<ChannelDropdown label="Archive Channel" col2=true channels={channels} bind:value={data.archive_channel}/>
<CategoryDropdown label="Channel Category" col2=true channels={channels} bind:value={data.category}/>
</div>
<div class="row">
<div class="row" style="justify-content: flex-start">
<NamingScheme col4=true bind:value={data.naming_scheme}/>
<Checkbox label="Enable User Feedback" col4=true bind:value={data.feedback_enabled}/>
<Checkbox label="Hide Claim Button" col4=true bind:value={data.hide_claim_button}/>
</div>
<div class="row" style="justify-content: flex-start">
<div class="row">
<div class="col-1">
<Button icon="fas fa-paper-plane" fullWidth=true>Submit</Button>
</div>

View File

@ -1,4 +1,4 @@
export const API_URL = env.API_URL || "http://192.168.90.213:3000"
export const API_URL = env.API_URL || "http://localhost:3000"
export const PLACEHOLDER_DOCS_URL = "https://docs.ticketsbot.net/setup/placeholders.html"
export const OAUTH = {

2
go.mod
View File

@ -6,7 +6,7 @@ require (
github.com/BurntSushi/toml v0.3.1
github.com/TicketsBot/archiverclient v0.0.0-20210220155137-a562b2f1bbbb
github.com/TicketsBot/common v0.0.0-20210727134627-35eb7ed03a44
github.com/TicketsBot/database v0.0.0-20210728151044-f205b228de2d
github.com/TicketsBot/database v0.0.0-20210801121328-1e2e1c5e3346
github.com/TicketsBot/worker v0.0.0-20210727130432-3df3cd1246a3
github.com/apex/log v1.1.2
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect