From 345feb8e94b1c1b73195be0192f13ef86d0532a9 Mon Sep 17 00:00:00 2001 From: Julien Fabre Date: Tue, 24 Oct 2023 22:33:12 +0200 Subject: [PATCH] fix(issue#185): add my list for in list command --- server/command.go | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/server/command.go b/server/command.go index 4442adac..d11e3931 100644 --- a/server/command.go +++ b/server/command.go @@ -256,32 +256,35 @@ func (p *Plugin) runAddCommand(args []string, extra *model.CommandArgs) (bool, e } func (p *Plugin) runListCommand(args []string, extra *model.CommandArgs) (bool, error) { - listID := MyListKey responseMessage := "Todo List:\n\n" if len(args) > 0 { switch args[0] { case MyFlag: case InFlag: - listID = InListKey - responseMessage = "Received Todo list:\n\n" + inIssues, err := p.listManager.GetIssueList(extra.UserId, InListKey) + if err != nil { + return false, err + } + myIssues, err := p.listManager.GetIssueList(extra.UserId, MyListKey) + if err != nil { + return false, err + } + responseMessage = "Received Todo list:\n\n" + issuesListToString(inIssues) + "\n\nTodo List:\n\n" + issuesListToString(myIssues) case OutFlag: - listID = OutListKey - responseMessage = "Sent Todo list:\n\n" + outIssues, err := p.listManager.GetIssueList(extra.UserId, OutListKey) + if err != nil { + return false, err + } + responseMessage = "Sent Todo list:\n\n" + issuesListToString(outIssues) default: p.postCommandResponse(extra, getHelp()) return true, nil } } - issues, err := p.listManager.GetIssueList(extra.UserId, listID) - if err != nil { - return false, err - } - p.sendRefreshEvent(extra.UserId, []string{MyListKey, OutListKey, InListKey}) - responseMessage += issuesListToString(issues) p.postCommandResponse(extra, responseMessage) return false, nil