Add terminations to error repsonses in API. (#1872)
This commit is contained in:
parent
c0aea77fe4
commit
a500a5f975
@ -97,6 +97,7 @@ func GetIPAddressBans(w http.ResponseWriter, r *http.Request) {
|
|||||||
bans, err := data.GetIPAddressBans()
|
bans, err := data.GetIPAddressBans()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
controllers.WriteSimpleResponse(w, false, err.Error())
|
controllers.WriteSimpleResponse(w, false, err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers.WriteResponse(w, bans)
|
controllers.WriteResponse(w, bans)
|
||||||
|
@ -626,6 +626,7 @@ func SetExternalActions(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if err := data.SetExternalActions(actions.Value); err != nil {
|
if err := data.SetExternalActions(actions.Value); err != nil {
|
||||||
controllers.WriteSimpleResponse(w, false, "unable to update external actions with provided values")
|
controllers.WriteSimpleResponse(w, false, "unable to update external actions with provided values")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers.WriteSimpleResponse(w, true, "external actions update")
|
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 {
|
if err := data.SetForbiddenUsernameList(request.Value); err != nil {
|
||||||
controllers.WriteSimpleResponse(w, false, err.Error())
|
controllers.WriteSimpleResponse(w, false, err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers.WriteSimpleResponse(w, true, "forbidden username list updated")
|
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 {
|
if err := data.SetSuggestedUsernamesList(request.Value); err != nil {
|
||||||
controllers.WriteSimpleResponse(w, false, err.Error())
|
controllers.WriteSimpleResponse(w, false, err.Error())
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
controllers.WriteSimpleResponse(w, true, "suggested username list updated")
|
controllers.WriteSimpleResponse(w, true, "suggested username list updated")
|
||||||
|
@ -24,6 +24,7 @@ func SendFederatedMessage(w http.ResponseWriter, r *http.Request) {
|
|||||||
message, ok := configValue.Value.(string)
|
message, ok := configValue.Value.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
controllers.WriteSimpleResponse(w, false, "unable to send message")
|
controllers.WriteSimpleResponse(w, false, "unable to send message")
|
||||||
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := activitypub.SendPublicFederatedMessage(message); err != nil {
|
if err := activitypub.SendPublicFederatedMessage(message); err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user