gracefully fail when no messages are selected for deletion or moving
This commit is contained in:
parent
f4523b51af
commit
7cb145748a
1 changed files with 10 additions and 0 deletions
|
@ -1024,6 +1024,11 @@ func handleMove(ctx *alps.Context) error {
|
|||
return echo.NewHTTPError(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
if len(uids) == 0 {
|
||||
ctx.Session.PutNotice("No messages selected.")
|
||||
return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
|
||||
}
|
||||
|
||||
to := formOrQueryParam(ctx, "to")
|
||||
if to == "" {
|
||||
return echo.NewHTTPError(http.StatusBadRequest, "missing 'to' form parameter")
|
||||
|
@ -1071,6 +1076,11 @@ func handleDelete(ctx *alps.Context) error {
|
|||
return echo.NewHTTPError(http.StatusBadRequest, err)
|
||||
}
|
||||
|
||||
if len(uids) == 0 {
|
||||
ctx.Session.PutNotice("No messages selected.")
|
||||
return ctx.Redirect(http.StatusFound, fmt.Sprintf("/mailbox/%v", url.PathEscape(mboxName)))
|
||||
}
|
||||
|
||||
err = ctx.Session.DoIMAP(func(c *imapclient.Client) error {
|
||||
if err := ensureMailboxSelected(c, mboxName); err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue