[MM-48921] Don't return error when deleting Draft if Draft DNE (#21818)
* set global drafts feature flag to true * Don't return error on deleteDraft when draft doesn't exist in server * undo accidental feature flag change * address comments * change log level to debug Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
Этот коммит содержится в:
@@ -121,7 +121,14 @@ func deleteDraft(c *Context, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
draft, err := c.App.GetDraft(userID, channelID, rootID)
|
||||
if err != nil {
|
||||
c.Err = err
|
||||
switch {
|
||||
case err.StatusCode == http.StatusNotFound:
|
||||
// If the draft doesn't exist in the server, we don't need to delete.
|
||||
mlog.Debug("Unable to find the draft", mlog.Err(err))
|
||||
ReturnStatusOK(w)
|
||||
default:
|
||||
c.Err = err
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ func (a *App) GetDraft(userID, channelID, rootID string) (*model.Draft, *model.A
|
||||
var nfErr *store.ErrNotFound
|
||||
switch {
|
||||
case errors.As(err, &nfErr):
|
||||
return nil, model.NewAppError("GetDraft", "app.draft.get.app_error", nil, nfErr.Error(), http.StatusNotFound)
|
||||
return nil, model.NewAppError("GetDraft", "app.draft.get.app_error", nil, err.Error(), http.StatusNotFound)
|
||||
default:
|
||||
return nil, model.NewAppError("GetDraft", "app.draft.get.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
Ссылка в новой задаче
Block a user