Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(issue#185): add my list for in list command #224

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions server/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down