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

Added command for removing any todo #207

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

thoratvinod
Copy link

@thoratvinod thoratvinod commented May 22, 2023

Summary

Added command for removing any todo

Ticket Link

Fixes #195

Screenshots

image
image

Command: /todo remove --todo <todoID>

@thoratvinod thoratvinod requested a review from larkox as a code owner May 22, 2023 17:20
@mattermost-build
Copy link

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.

@larkox larkox requested a review from mickmister May 22, 2023 17:23
Copy link
Contributor

@mickmister mickmister left a 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.

server/command.go Outdated Show resolved Hide resolved
Copy link
Contributor

@larkox larkox left a 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.

.gitignore Outdated Show resolved Hide resolved
server/command.go Outdated Show resolved Hide resolved
@@ -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, " ")
Copy link
Contributor

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.

Copy link
Author

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?

Copy link
Contributor

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).

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@asaadmahmood any suggestion here?

Copy link
Contributor

@asaadmahmood asaadmahmood May 30, 2023

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.

See screenshot for autocomplete.
image

Copy link
Author

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:

  1. The OnActivate method will run only once when the plugin is activated.
  2. The ExecuteCommand method will run every time a command is entered.
  3. 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.

Copy link
Contributor

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 😄

Copy link
Author

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.

Copy link
Contributor

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?

server/command.go Outdated Show resolved Hide resolved
@hanzei hanzei added the 2: Dev Review Requires review by a core committer label May 30, 2023
@hanzei hanzei requested a review from asaadmahmood May 30, 2023 07:57
@hanzei hanzei added the 1: UX Review Requires review by a UX Designer label May 30, 2023
@thoratvinod thoratvinod changed the title Added command for removing any todo Added command for deleting any todo Jun 3, 2023
@thoratvinod thoratvinod changed the title Added command for deleting any todo Added command for removingany todo Jun 3, 2023
@thoratvinod thoratvinod changed the title Added command for removingany todo Added command for removing any todo Jun 3, 2023
@thoratvinod thoratvinod requested review from mickmister and larkox June 3, 2023 08:54
Copy link
Contributor

@mickmister mickmister left a 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.

server/command.go Outdated Show resolved Hide resolved
server/plugin.go Outdated Show resolved Hide resolved
@thoratvinod
Copy link
Author

@larkox @asaadmahmood have resolved the comments, pls have a look.

Copy link
Contributor

@larkox larkox left a 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-commenter
Copy link

codecov-commenter commented Jun 12, 2023

Codecov Report

Attention: Patch coverage is 0% with 85 lines in your changes are missing coverage. Please review.

Project coverage is 6.53%. Comparing base (1afeeb0) to head (04b917f).
Report is 5 commits behind head on master.

❗ Current head 04b917f differs from pull request most recent head 9a43981. Consider uploading reports for the commit 9a43981 to get more accurate results

Files Patch % Lines
server/command.go 0.00% 49 Missing ⚠️
server/plugin.go 0.00% 36 Missing ⚠️
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.
📢 Have feedback on the report? Share it here.

@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@thoratvinod
Copy link
Author

@asaadmahmood please have a look.

@mickmister mickmister removed 2: Dev Review Requires review by a core committer Lifecycle/1:stale labels Feb 6, 2024
@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

@mickmister mickmister added 3: QA Review Requires review by a QA tester and removed 1: UX Review Requires review by a UX Designer Lifecycle/1:stale labels Mar 14, 2024
@mattermost-build
Copy link

This PR has been automatically labelled "stale" because it hasn't had recent activity.
A core team member will check in on the status of the PR to help with questions.
Thank you for your contribution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3: QA Review Requires review by a QA tester Lifecycle/1:stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: Be able to remove any todo item not only the top one from the list
7 participants