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

Various improvements over commands #106

Merged
merged 8 commits into from
May 6, 2020

Conversation

larkox
Copy link
Contributor

@larkox larkox commented Apr 27, 2020

Summary

I added some small improvements to the current commands:

  • Require connected user for some commands
  • Simplify subscribe
  • Add unsubscribe instead of subscribe delete
  • Use on help text the commandTrigger variable instead of the hardcoded mscalendar

Ticket Link

fix #49

…ubscribe and handle commandTrigger on help text
@larkox larkox added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels Apr 27, 2020
@larkox larkox requested review from mickmister and jfrerich April 27, 2020 17:01
Copy link
Contributor

@jfrerich jfrerich left a comment

Choose a reason for hiding this comment

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

one nit and a small suggestion

server/command/help.go Outdated Show resolved Hide resolved
server/command/unsubscribe.go Outdated Show resolved Hide resolved
@codecov-io
Copy link

Codecov Report

Merging #106 into master will decrease coverage by 0.09%.
The diff coverage is 10.16%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #106      +/-   ##
==========================================
- Coverage   23.04%   22.95%   -0.10%     
==========================================
  Files          62       63       +1     
  Lines        2274     2270       -4     
==========================================
- Hits          524      521       -3     
+ Misses       1692     1688       -4     
- Partials       58       61       +3     
Impacted Files Coverage Δ
server/command/help.go 0.00% <0.00%> (ø)
server/command/subscribe.go 0.00% <0.00%> (ø)
server/command/unsubscribe.go 0.00% <0.00%> (ø)
server/command/command.go 28.75% <20.00%> (-0.67%) ⬇️
server/command/disconnect.go 0.00% <0.00%> (-100.00%) ⬇️

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 5e9f8da...443b1a7. Read the comment docs.

@larkox larkox requested a review from jfrerich April 28, 2020 10:06
Copy link
Contributor

@jfrerich jfrerich left a comment

Choose a reason for hiding this comment

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

LGTM

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.

Nice, I really like the cleanup of the code. Thanks for noticing the opportunity for improvement. I have some suggestions on user-friendly wordings of errors.

}
return "bad syntax", nil
return fmt.Sprintf("Subscription %s created.", storedSub.Remote.ID), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Do we want to say something more user-friendly like You are now subscribed to events.?

if err != nil {
return "", err
}
return fmt.Sprintf("User's subscription deleted"), nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return fmt.Sprintf("User's subscription deleted"), nil
return fmt.Sprintf("You have unsubscribed from events."), nil

return fmt.Sprintf("Subscription %s deleted", parameters[1]), nil
_, err := c.MSCalendar.LoadMyEventSubscription()
if err == nil {
return "Already subscribed to events.", nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
return "Already subscribed to events.", nil
return "You are already subscribed to events.", nil

@larkox larkox requested a review from mickmister April 30, 2020 10:58
return fmt.Sprintf("User's subscription deleted"), false, nil
_, err := c.MSCalendar.LoadMyEventSubscription()
if err == nil {
return "You are already subscribed to events.", false, nil
Copy link
Contributor

Choose a reason for hiding this comment

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

If for some reason the renew job does not end up renewing the user's subscription (MM server is taken down for a few days for example), does this make it so the user cannot remedy the situation? The renew job would also not be able to fix it either.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I haven't checked the details, but shouldn't a "unsubscribe/subscribe" fix it?

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.

LGTM

@mickmister mickmister requested a review from DHaussermann April 30, 2020 13:45
@mickmister mickmister removed the 2: Dev Review Requires review by a core committer label Apr 30, 2020
@larkox larkox requested a review from mickmister May 5, 2020 11:12
@mickmister
Copy link
Contributor

/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

  • Various commands now explain when you're not connected
  • I also see a few other text improvments
  • When already connected - It explains why connect fails now :)
  • Subscribe now informs user they are already subscribed rather than creating additional subscriptions
  • Unsubscribe works as expected.
    LGTM!
    Thanks @larkox

@DHaussermann DHaussermann added 4: Reviews Complete All reviewers have approved the pull request QA Review Done PR has been approved by QA and removed 3: QA Review Requires review by a QA tester labels May 6, 2020
@mickmister mickmister merged commit b4ddb3b into mattermost:master May 6, 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 QA Review Done PR has been approved by QA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve the disconnect message to return something when the user is already disconnected
6 participants