0

Add terminations to error repsonses in API. (#1872)

This commit is contained in:
funkyhippo 2022-04-23 15:19:17 -05:00 committed by GitHub
parent c0aea77fe4
commit a500a5f975
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 0 deletions

View File

@ -97,6 +97,7 @@ func GetIPAddressBans(w http.ResponseWriter, r *http.Request) {
bans, err := data.GetIPAddressBans()
if err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
}
controllers.WriteResponse(w, bans)

View File

@ -626,6 +626,7 @@ func SetExternalActions(w http.ResponseWriter, r *http.Request) {
if err := data.SetExternalActions(actions.Value); err != nil {
controllers.WriteSimpleResponse(w, false, "unable to update external actions with provided values")
return
}
controllers.WriteSimpleResponse(w, true, "external actions update")
@ -662,6 +663,7 @@ func SetForbiddenUsernameList(w http.ResponseWriter, r *http.Request) {
if err := data.SetForbiddenUsernameList(request.Value); err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
}
controllers.WriteSimpleResponse(w, true, "forbidden username list updated")
@ -683,6 +685,7 @@ func SetSuggestedUsernameList(w http.ResponseWriter, r *http.Request) {
if err := data.SetSuggestedUsernamesList(request.Value); err != nil {
controllers.WriteSimpleResponse(w, false, err.Error())
return
}
controllers.WriteSimpleResponse(w, true, "suggested username list updated")

View File

@ -24,6 +24,7 @@ func SendFederatedMessage(w http.ResponseWriter, r *http.Request) {
message, ok := configValue.Value.(string)
if !ok {
controllers.WriteSimpleResponse(w, false, "unable to send message")
return
}
if err := activitypub.SendPublicFederatedMessage(message); err != nil {