summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorReto Brunner <reto@labrat.space>2020-05-09 11:50:30 +0200
committerDrew DeVault <sir@cmpwn.com>2020-05-11 09:47:33 -0400
commit381c1fc05f6de95accbb520769d0cc9196955cf4 (patch)
tree562c004d3153959995aaeb85660f4ead9b4e15f5
parentc5fdefe7afdc69fc4eefd1ccd702a60b39fc6cb9 (diff)
downloadaerc-381c1fc05f6de95accbb520769d0cc9196955cf4.tar.gz
commands/helper: remove duplicated method
-rw-r--r--commands/msg/copy.go2
-rw-r--r--commands/msg/delete.go2
-rw-r--r--commands/msg/modify-labels.go2
-rw-r--r--commands/msg/move.go2
-rw-r--r--commands/msg/read.go2
-rw-r--r--commands/msg/utils.go10
6 files changed, 6 insertions, 14 deletions
diff --git a/commands/msg/copy.go b/commands/msg/copy.go
index 3eca565..f3d4030 100644
--- a/commands/msg/copy.go
+++ b/commands/msg/copy.go
@@ -44,7 +44,7 @@ func (Copy) Execute(aerc *widgets.Aerc, args []string) error {
 		}
 	}
 	h := newHelper(aerc)
-	uids, err := h.uids()
+	uids, err := h.markedOrSelectedUids()
 	if err != nil {
 		return err
 	}
diff --git a/commands/msg/delete.go b/commands/msg/delete.go
index 0d2c1c5..313e3ea 100644
--- a/commands/msg/delete.go
+++ b/commands/msg/delete.go
@@ -34,7 +34,7 @@ func (Delete) Execute(aerc *widgets.Aerc, args []string) error {
 	if err != nil {
 		return err
 	}
-	uids, err := h.uids()
+	uids, err := h.markedOrSelectedUids()
 	if err != nil {
 		return err
 	}
diff --git a/commands/msg/modify-labels.go b/commands/msg/modify-labels.go
index 92899ec..f91075a 100644
--- a/commands/msg/modify-labels.go
+++ b/commands/msg/modify-labels.go
@@ -34,7 +34,7 @@ func (ModifyLabels) Execute(aerc *widgets.Aerc, args []string) error {
 	if err != nil {
 		return err
 	}
-	uids, err := h.uids()
+	uids, err := h.markedOrSelectedUids()
 	if err != nil {
 		return err
 	}
diff --git a/commands/msg/move.go b/commands/msg/move.go
index 9542613..830e752 100644
--- a/commands/msg/move.go
+++ b/commands/msg/move.go
@@ -49,7 +49,7 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
 	if err != nil {
 		return err
 	}
-	uids, err := h.uids()
+	uids, err := h.markedOrSelectedUids()
 	if err != nil {
 		return err
 	}
diff --git a/commands/msg/read.go b/commands/msg/read.go
index d27c482..dcb9657 100644
--- a/commands/msg/read.go
+++ b/commands/msg/read.go
@@ -54,7 +54,7 @@ func (Read) Execute(aerc *widgets.Aerc, args []string) error {
 		// ignore commmand given, simply toggle all the read states
 		return submitToggle(aerc, store, h)
 	}
-	msgUids, err := h.messageUids()
+	msgUids, err := h.markedOrSelectedUids()
 	if err != nil {
 		return err
 	}
diff --git a/commands/msg/utils.go b/commands/msg/utils.go
index 30a4394..ae25535 100644
--- a/commands/msg/utils.go
+++ b/commands/msg/utils.go
@@ -17,7 +17,7 @@ func newHelper(aerc *widgets.Aerc) *helper {
 	return &helper{aerc.SelectedTab().(widgets.ProvidesMessages)}
 }
 
-func (h *helper) uids() ([]uint32, error) {
+func (h *helper) markedOrSelectedUids() ([]uint32, error) {
 	msgs, err := commands.MarkedOrSelected(h.msgProvider)
 	if err != nil {
 		return nil, err
@@ -45,11 +45,3 @@ func (h *helper) account() (*widgets.AccountView, error) {
 func (h *helper) messages() ([]*models.MessageInfo, error) {
 	return commands.MarkedOrSelected(h.msgProvider)
 }
-
-func (h *helper) messageUids() ([]uint32, error) {
-	msgs, err := h.messages()
-	if err != nil {
-		return nil, err
-	}
-	return commands.UidsFromMessageInfos(msgs), nil
-}