-
Notifications
You must be signed in to change notification settings - Fork 64
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
Added command for removing any todo #207
base: master
Are you sure you want to change the base?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but with a few non blocking concerns.
server/command.go
Outdated
@@ -327,6 +329,61 @@ func (p *Plugin) runPopCommand(args []string, extra *model.CommandArgs) (bool, e | |||
return false, nil | |||
} | |||
|
|||
func (p *Plugin) runRemoveCommand(args []string, extra *model.CommandArgs) (bool, error) { | |||
message := strings.Join(args, " ") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Having to write down the whole message seems bad UX, but 0/5.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@asaadmahmood any suggestion here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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
OnActivate
method will run only once when the plugin is activated. - The
ExecuteCommand
method will run every time a command is entered. - The
OnDeactivate
method 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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made changes, also updated the screenshots.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@thoratvinod The current screenshot in the PR description shows the todo ids. Is this intentional?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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. |
Summary
Added command for removing any todo
Ticket Link
Fixes #195
Screenshots
Command:
/todo remove --todo <todoID>