diff options
Diffstat (limited to 'plugins/base')
-rw-r--r-- | plugins/base/routes.go | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/plugins/base/routes.go b/plugins/base/routes.go index df32876..c4ab492 100644 --- a/plugins/base/routes.go +++ b/plugins/base/routes.go @@ -53,6 +53,7 @@ func registerRoutes(p *alps.GoPlugin) { p.POST("/compose", handleComposeNew) p.POST("/compose/attachment", handleComposeAttachment) + p.POST("/compose/attachment/:uuid/remove", handleCancelAttachment) p.GET("/message/:mbox/:uid/reply", handleReply) p.POST("/message/:mbox/:uid/reply", handleReply) @@ -763,6 +764,15 @@ func handleComposeAttachment(ctx *alps.Context) error { return ctx.JSON(http.StatusOK, &uuids) } +func handleCancelAttachment(ctx *alps.Context) error { + uuid := ctx.Param("uuid") + a := ctx.Session.PopAttachment(uuid) + if a != nil { + a.Form.RemoveAll() + } + return ctx.JSON(http.StatusOK, nil) +} + func unwrapIMAPAddressList(addrs []*imap.Address) []string { l := make([]string, len(addrs)) for i, addr := range addrs { |