Added command for removing any todo#207
Conversation
|
Hello @thoratvinod, Thanks for your pull request! A Core Committer will review your pull request soon. For code contributions, you can learn more about the review process here. |
mickmister
left a comment
There was a problem hiding this comment.
@thoratvinod Thanks for this great contribution 👍
I have one suggestion to de-deplicate/share some existing code handling issue deletion. Please let me know your thoughts on this.
larkox
left a comment
There was a problem hiding this comment.
LGTM, but with a few non blocking concerns.
| } | ||
|
|
||
| func (p *Plugin) runRemoveCommand(args []string, extra *model.CommandArgs) (bool, error) { | ||
| message := strings.Join(args, " ") |
There was a problem hiding this comment.
Having to write down the whole message seems bad UX, but 0/5.
There was a problem hiding this comment.
True. Maybe we can only take the number of Todo in the remove cmd and delete that specific todo. In that case, I think we should change the list of todos from a bullet list to a numbered list. What do you think about this?
There was a problem hiding this comment.
Numbered list is "dangerous". I get my list: 1. todo A, 2. todo B, 3. todo C. Now I say... delete number 2 (todo B). But while I am writing that, another user deletes the first one todo A. And I end up deleting the "new second one", todo C.
Something I did for the badges plugin was to use the autocomplete to add the badge id (in this case the todo id). May be an option, but 0/5 on how good. I don't like much the way it is done in the badges plugin neither 😅
A more elaborate option (and maybe not good neither) is that /todo delete opens an interactive dialog with all the todos, and you mark with a checkmark all of the todos you want to delete.
@asaadmahmood Since you were doing some changes on the todo plugin some time ago, not sure if you have any thoughts on the UX for this particular part (slash command for todo deletion).
There was a problem hiding this comment.
@thoratvinod @larkox I think we should have an autocomplete with the todo list.
So when the user types /todo remove an autocomplete opens up, with the todo items (name+id+description), and then the user can select the one he wants to remove.
When he selects it, the selection can turn into an id for simplicity.
There was a problem hiding this comment.
Thanks for the suggestion @asaadmahmood. However, I'm not sure how we can implement this in the code.
After reading the code, I've noticed a few things. Please correct me if I'm wrong:
- The
OnActivatemethod will run only once when the plugin is activated. - The
ExecuteCommandmethod will run every time a command is entered. - The
OnDeactivatemethod will run only once when the plugin is deactivated.
We register all plugin commands in the OnActivate method, which is executed only once after the plugin is activated. If we want to add autocomplete for the delete command, we would need to fetch the latest todo list, which I believe is not possible.
@mickmister @larkox please let me know if I am missing something or if you have any way to enable autocomplete for delete.
There was a problem hiding this comment.
Take a look to https://github.com/larkox/mattermost-plugin-badges
The idea is to register the autocomplete as something dynamic. Hopefully reading the code in there is enough, but if you need more guidance let me know 😄
There was a problem hiding this comment.
Have made changes, also updated the screenshots.
There was a problem hiding this comment.
@thoratvinod The current screenshot in the PR description shows the todo ids. Is this intentional?
mickmister
left a comment
There was a problem hiding this comment.
Just one comment to avoid index out of range issue. Otherwise LGTM 👍
FYI I'm going on PTO for a few weeks and won't be able to re-review this. Please take this review as my approval other than the index out of range issue.
|
@larkox @asaadmahmood have resolved the comments, pls have a look. |
larkox
left a comment
There was a problem hiding this comment.
LGTM, I will leave @asaadmahmood to consider the UX implications, but that part also looks good to me.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #207 +/- ##
=========================================
+ Coverage 6.42% 6.53% +0.11%
=========================================
Files 11 10 -1
Lines 1712 1682 -30
=========================================
Hits 110 110
+ Misses 1594 1564 -30
Partials 8 8 ☔ View full report in Codecov by Sentry. |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
@asaadmahmood please have a look. |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
This PR has been automatically labelled "stale" because it hasn't had recent activity. |
|
@thoratvinod Can you please fix the CI issues? Thanks! |

Summary
Added command for removing any todo
Ticket Link
Fixes #195
Screenshots
Command:
/todo remove --todo <todoID>