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

GH-88 Add settings command to toggle daily reminders #90

Merged
merged 3 commits into from
Jul 30, 2020

Conversation

openmohan
Copy link
Contributor

Summary

The TODO bot reminds the user with the list of issue daily if it is not empty. With this feature added the reminder preference can be set, so the user can turn off or on the daily reminder functionality. By default, the value will be set as true.

Ticket Link

https://github.com/openmohan/mattermost-plugin-todo/tree/GH-88

####Usage
/todo settings summary on or /todo settings summary off

@openmohan openmohan requested a review from larkox as a code owner July 3, 2020 12:36
@codecov-commenter
Copy link

codecov-commenter commented Jul 3, 2020

Codecov Report

Merging #90 into master will increase coverage by 3.81%.
The diff coverage is 49.15%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master     #90      +/-   ##
=========================================
+ Coverage    0.00%   3.81%   +3.81%     
=========================================
  Files           8       8              
  Lines         861     918      +57     
=========================================
+ Hits            0      35      +35     
- Misses        861     883      +22     
Impacted Files Coverage Δ
server/plugin.go 0.00% <0.00%> (ø)
server/store.go 3.75% <38.09%> (+3.75%) ⬆️
server/command.go 12.27% <56.75%> (+12.27%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ffa4359...f1a2e26. Read the comment docs.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Two small requests. The rest looks good. 👍

Comment on lines 263 to 271
if args[1] == "on" {
err = p.saveReminderPreference(extra.UserId, true)
} else if args[1] == "off" {
err = p.saveReminderPreference(extra.UserId, false)
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Using a switch here would make the code cleaner and would make it easy to add a default path.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Changed to switch model.

server/store.go Show resolved Hide resolved
@@ -276,6 +308,9 @@ func getAutocompleteData() *model.AutocompleteData {
send.AddTextArgument("Todo message", "[message]", "")
todo.AddCommand(send)

settings := model.NewAutocompleteData("settings", "summary [on] [off]", "Sets the user preference on daily reminder")
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe out of scope of the PR: It would be great if there are autocomplete options for on and off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, I can cover in this PR.

@hanzei hanzei added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Jul 3, 2020
@openmohan openmohan changed the title GH-88 Add settings command to toggle daily reminders [WIP]GH-88 Add settings command to toggle daily reminders Jul 3, 2020
@openmohan openmohan changed the title [WIP]GH-88 Add settings command to toggle daily reminders GH-88 Add settings command to toggle daily reminders Jul 3, 2020
server/command.go Outdated Show resolved Hide resolved
server/store.go Outdated Show resolved Hide resolved
server/store.go Outdated Show resolved Hide resolved
Copy link

@reflog reflog left a comment

Choose a reason for hiding this comment

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

looks good in general, please add a test

server/command.go Show resolved Hide resolved
@openmohan
Copy link
Contributor Author

openmohan commented Jul 6, 2020

  • Squash commits at end.

Copy link
Contributor

@hanzei hanzei left a comment

Choose a reason for hiding this comment

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

Awesome 👍

@hanzei hanzei requested a review from DHaussermann July 7, 2020 10:14
@hanzei hanzei removed the 2: Dev Review Requires review by a core committer label Jul 7, 2020
@hanzei hanzei added this to the v0.3.0 milestone Jul 7, 2020
@DHaussermann
Copy link

@hanzei or @aaronrothschild The 3.0 release is about ready now. I can test this today if you confirm we want it in the release.

@hanzei
Copy link
Contributor

hanzei commented Jul 7, 2020

It would be quite awesome to get this into the release.

@larkox larkox mentioned this pull request Jul 13, 2020
@larkox
Copy link
Contributor

larkox commented Jul 15, 2020

@asaadmahmood @aaronrothschild What do you think about along the daily reminder show a message to tell how to stop the daily reminder? Something like:
If you want to stop receiving daily reminders type /todo settings reminder off
@DHaussermann This request is a bit last minute, and can be added in a different PR, so if you are already done testing this, I will move this to a different PR.

@DHaussermann
Copy link

@larkox my personal opinion on this is that since the feature will be included in 3.0, the message should go along with.

Regarding testing progress I'm starting now by figuring out how I can trigger the reminder on demand. But I don't see this addition as invalidating much testing so I am not opposed to including it now.

@DHaussermann
Copy link

  1. Not sure how to test this without actually waiting a full day to test both states of the flag. @larkox I need a way to make the app think I got the ping 25hrs ago. Should I be able to do this my modifying the reminder_<mmuserid> key value in the KV store? This did not work for me. I'm not sure this is some kind of timestamp 🙃 Thoughts?

  2. @openmohan there is a test no longer working on this branch.

Running golangci-lint
golangci-lint run ./...
server/command_test.go:28:30: `successfull` is a misspelling of `successful` (misspell)
			name:    "Setting summary successfull",
			                          ^
make: *** [golangci-lint] Error 1

Can you please see if you can repro and resolve this?

@larkox
Copy link
Contributor

larkox commented Jul 16, 2020

@DHaussermann If I understand correctly the underlying logic, you should be able to trigger the daily summary by:

  • setting reminder_ to 0
  • refreshing the page
  • clicking anywhere

If you were not to refresh the page, you may have to wait for 1 hour before the daily reminder get's checked again.

@DHaussermann
Copy link

Thanks @larkox I will try this again shortly.

After team discussion, this will be moved to next release so we can ship this now. Adjusting milestone.

@DHaussermann DHaussermann modified the milestones: v0.3.0, v0.4.0 Jul 16, 2020
@openmohan
Copy link
Contributor Author

  1. Not sure how to test this without actually waiting a full day to test both states of the flag. @larkox I need a way to make the app think I got the ping 25hrs ago. Should I be able to do this my modifying the reminder_<mmuserid> key value in the KV store? This did not work for me. I'm not sure this is some kind of timestamp 🙃 Thoughts?
  2. @openmohan there is a test no longer working on this branch.
Running golangci-lint
golangci-lint run ./...
server/command_test.go:28:30: `successfull` is a misspelling of `successful` (misspell)
			name:    "Setting summary successfull",
			                          ^
make: *** [golangci-lint] Error 1

Can you please see if you can repro and resolve this?

Sure I will check it out.

@larkox larkox linked an issue Jul 28, 2020 that may be closed by this pull request
@DHaussermann
Copy link

/update-branch

Copy link

@DHaussermann DHaussermann left a comment

Choose a reason for hiding this comment

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

Tested and passed

  • When setting is True user continues to receive reminder DMs as ususal
  • When False the reminder DMs are not received regardless of how long ago last reminder was sent
  • Build issue mentioned above has been resolved
    This is working as expected.
    LGTM!
    Huge thanks @openmohan for this enhancement! This makes for a very a very nice improvement.

Added release test to cover this feature.

Thanks @larkox for help with testing. (I think the vlue I was setting was just too large. 0 worked fine :) )

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request and removed 3: QA Review Requires review by a QA tester labels Jul 29, 2020
@larkox larkox merged commit bb127b1 into mattermost-community:master Jul 30, 2020
@larkox larkox mentioned this pull request Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
4: Reviews Complete All reviewers have approved the pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support daily summary notification on/off setting
7 participants