move: adapt to ProvidesMessages

This commit is contained in:
Reto Brunner 2019-12-18 06:34:05 +01:00 committed by Drew DeVault
parent 7b359be0cd
commit 113de35961

View file

@ -45,27 +45,27 @@ func (Move) Execute(aerc *widgets.Aerc, args []string) error {
} }
} }
widget := aerc.SelectedTab().(widgets.ProvidesMessage) h := newHelper(aerc)
acct := widget.SelectedAccount() store, err := h.store()
if acct == nil {
return errors.New("No account selected")
}
store := widget.Store()
if store == nil {
return errors.New("Cannot perform action. Messages still loading")
}
msg, err := widget.SelectedMessage()
if err != nil { if err != nil {
return err return err
} }
_, isMsgView := widget.(*widgets.MessageViewer) uids, err := h.uids()
if err != nil {
return err
}
acct, err := h.account()
if err != nil {
return err
}
_, isMsgView := h.msgProvider.(*widgets.MessageViewer)
if isMsgView { if isMsgView {
aerc.RemoveTab(widget) aerc.RemoveTab(h.msgProvider)
} }
store.Next() store.Next()
acct.Messages().Scroll() acct.Messages().Scroll()
joinedArgs := strings.Join(args[optind:], " ") joinedArgs := strings.Join(args[optind:], " ")
store.Move([]uint32{msg.Uid}, joinedArgs, createParents, func( store.Move(uids, joinedArgs, createParents, func(
msg types.WorkerMessage) { msg types.WorkerMessage) {
switch msg := msg.(type) { switch msg := msg.(type) {