~migadu/alps-devel

gracefully fail when no messages are selected for deletion or moving v1 APPLIED

Alex McGrath: 1
 gracefully fail when no messages are selected for deletion or moving

 1 files changed, 10 insertions(+), 0 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~migadu/alps-devel/patches/32074/mbox | git am -3
Learn more about email & git

[PATCH] gracefully fail when no messages are selected for deletion or moving Export this patch

---
 plugins/base/routes.go | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/plugins/base/routes.go b/plugins/base/routes.go
index 255faa5..52d1681 100644
--- a/plugins/base/routes.go
+++ b/plugins/base/routes.go
@@ -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
-- 
2.36.0
Pushed, thanks!