disable modmail
This commit is contained in:
parent
e07dbed6ca
commit
94289451b1
@ -18,6 +18,7 @@ type Settings struct {
|
||||
PingEveryone bool `json:"ping_everyone"`
|
||||
UsersCanClose bool `json:"users_can_close"`
|
||||
CloseConfirmation bool `json:"close_confirmation"`
|
||||
ModmailEnabled bool `json:"modmail_enabled"`
|
||||
}
|
||||
|
||||
func GetSettingsHandler(ctx *gin.Context) {
|
||||
@ -81,6 +82,12 @@ func GetSettingsHandler(ctx *gin.Context) {
|
||||
return
|
||||
})
|
||||
|
||||
// modmail enabled
|
||||
group.Go(func() (err error) {
|
||||
settings.ModmailEnabled, err = dbclient.Client.ModmailEnabled.Get(guildId)
|
||||
return
|
||||
})
|
||||
|
||||
if err := group.Wait(); err != nil {
|
||||
ctx.AbortWithStatusJSON(500, gin.H{
|
||||
"success": false,
|
||||
|
@ -33,6 +33,7 @@ func UpdateSettingsHandler(ctx *gin.Context) {
|
||||
settings.updatePingEveryone(guildId)
|
||||
settings.updateUsersCanClose(guildId)
|
||||
settings.updateCloseConfirmation(guildId)
|
||||
settings.updateModmailEnabled(guildId)
|
||||
|
||||
ctx.JSON(200, gin.H{
|
||||
"prefix": validPrefix,
|
||||
@ -135,3 +136,7 @@ func (s *Settings) updateUsersCanClose(guildId uint64) {
|
||||
func (s *Settings) updateCloseConfirmation(guildId uint64) {
|
||||
go dbclient.Client.CloseConfirmation.Set(guildId, s.CloseConfirmation)
|
||||
}
|
||||
|
||||
func (s *Settings) updateModmailEnabled(guildId uint64) {
|
||||
go dbclient.Client.ModmailEnabled.Set(guildId, s.ModmailEnabled)
|
||||
}
|
||||
|
2
go.mod
2
go.mod
@ -6,7 +6,7 @@ require (
|
||||
github.com/BurntSushi/toml v0.3.1
|
||||
github.com/TicketsBot/archiverclient v0.0.0-20200425115930-0ca198cc8306
|
||||
github.com/TicketsBot/common v0.0.0-20200529141045-7426ad13f1a4
|
||||
github.com/TicketsBot/database v0.0.0-20200603195715-ce3003c9764c
|
||||
github.com/TicketsBot/database v0.0.0-20200604215726-514be849d31c
|
||||
github.com/apex/log v1.1.2
|
||||
github.com/boj/redistore v0.0.0-20180917114910-cd5dcc76aeff // indirect
|
||||
github.com/dgrijalva/jwt-go v3.2.0+incompatible
|
||||
|
@ -35,7 +35,7 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3 px-1">
|
||||
<div class="col-md-2 px-1">
|
||||
<div class="form-group">
|
||||
<label>Ping @everyone on ticket open</label>
|
||||
<div class="form-check">
|
||||
@ -58,11 +58,21 @@
|
||||
<div class="form-group">
|
||||
<label>Ticket close confirmation</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" name="close_confirmation" value="on"
|
||||
<input class="form-check-input" type="checkbox" value="on"
|
||||
id="close_confirmation" style="width:30px;height:30px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2 px-1">
|
||||
<div class="form-group">
|
||||
<label>Enable modmail</label>
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" value="on"
|
||||
id="enable_modmail" style="width:30px;height:30px;">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
@ -311,6 +321,7 @@
|
||||
document.getElementById("ping_everyone").checked = settings.ping_everyone;
|
||||
document.getElementById("users_can_close").checked = settings.users_can_close;
|
||||
document.getElementById("close_confirmation").checked = settings.close_confirmation;
|
||||
document.getElementById("enable_modmail").checked = settings.modmail_enabled;
|
||||
|
||||
if (settings.naming_scheme === "username") {
|
||||
document.getElementById("naming-by-username").checked = true;
|
||||
@ -433,7 +444,8 @@
|
||||
'close_confirmation': document.getElementById("close_confirmation").checked,
|
||||
'naming_scheme': document.querySelector('input[name="namingscheme"]:checked').value,
|
||||
'archive_channel': document.getElementById('archive_channel').options[document.getElementById('archive_channel').selectedIndex].value,
|
||||
'category': document.getElementById('category').options[document.getElementById('category').selectedIndex].value
|
||||
'category': document.getElementById('category').options[document.getElementById('category').selectedIndex].value,
|
||||
'modmail_enabled': document.getElementById('enable_modmail').checked
|
||||
};
|
||||
|
||||
const res = await axios.post('/api/{{.guildId}}/settings', data);
|
||||
|
Loading…
x
Reference in New Issue
Block a user