Add support for disabling chat. Closes #472 (#799)

This commit is contained in:
Gabe Kangas
2021-03-14 11:46:27 -07:00
committed by GitHub
parent 40264bec8c
commit bf33d08384
8 changed files with 183 additions and 97 deletions

View File

@@ -435,6 +435,23 @@ func SetSocialHandles(w http.ResponseWriter, r *http.Request) {
controllers.WriteSimpleResponse(w, true, "social handles updated")
}
// SetChatDisabled will disable chat functionality.
func SetChatDisabled(w http.ResponseWriter, r *http.Request) {
if !requirePOST(w, r) {
return
}
configValue, success := getValueFromRequest(w, r)
if !success {
controllers.WriteSimpleResponse(w, false, "unable to update chat disabled")
return
}
data.SetChatDisabled(configValue.Value.(bool))
controllers.WriteSimpleResponse(w, true, "chat disabled status updated")
}
func requirePOST(w http.ResponseWriter, r *http.Request) bool {
if r.Method != controllers.POST {
controllers.WriteSimpleResponse(w, false, r.Method+" not supported")