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-89] Allow status change to support DND and Away #118

Merged
merged 7 commits into from
May 20, 2020

Conversation

larkox
Copy link
Contributor

@larkox larkox commented May 6, 2020

Summary

Allow status change to support DND and Away. Settings added to both settings and login flow.

Ticket Link

Fix #89

@larkox larkox requested a review from mickmister as a code owner May 6, 2020 10:57
@larkox larkox requested a review from hanzei May 6, 2020 10:57
@larkox larkox added 2: Dev Review Requires review by a core committer 3: QA Review Requires review by a QA tester labels May 6, 2020
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, just some wording suggestions

server/mscalendar/availability.go Show resolved Hide resolved
if err != nil {
return "", err
}
err = m.Store.StoreUserActiveEvents(user.MattermostUserID, remoteHashes)
if err != nil {
return "", err
}
return "User was free, but is now busy. Set status to DND.", nil
return "User was free, but is now busy. Set status to busy.", nil
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you inject the busyStatus variable here? As well as the rest of the strings mentioning set status to busy. Also keep in mind these are debug strings, and only show up when using /availability as opposed to the scheduled status sync job.

server/mscalendar/settings.go Outdated Show resolved Hide resolved
server/mscalendar/welcome_flow.go Show resolved Hide resolved
SubscribePropertyName = "subscribe"
UpdateStatusPropertyName = "update_status"
GetConfirmationPropertyName = "get_confirmation"
ReceiveNotificationsWhileOnMeetingName = "receive_notifications"
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure if we can make the value shorter while still being clear. Any changes should apply to other similarly named vars of course

Suggested change
ReceiveNotificationsWhileOnMeetingName = "receive_notifications"
ReceiveNotificationsDuringMeetingName = "receive_notifications_during_meeting"

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 added your suggestion. If you have any other idea to make it shorter but giving the same information, please let me know and I will change it.

Copy link
Contributor

Choose a reason for hiding this comment

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

You've changed the name of the var, but the main thing I was suggesting was to change the value to receive_notifications_during_meeting. The value receive_notifications is too vague imo and I would assume by default that it is referring to receiving event notifications in general.

Copy link
Collaborator

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

The code changes look good. I'm leaving the UX decisions to @mickmister and @asaadmahmood

Comment on lines 6 to 8
UpdateStatusPropertyName = "update_status"
GetConfirmationPropertyName = "get_confirmation"
ReceiveNotificationsWhileOnMeetingName = "receive_notifications"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nit: By typeing these it would be more clear that these form a group.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what you mean with this. Do you mind to elaborate?

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm think he means something like

type SettingProperty string

const (
	UpdateStatusPropertyName SettingProperty = "update_status"

Copy link
Contributor

Choose a reason for hiding this comment

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

Then anywhere else in the code, you can reference these values as SettingProperty instead of string

Copy link
Collaborator

Choose a reason for hiding this comment

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

Exactly that @mickmister. Thanks for making this clear.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Making this change now would imply touching several files (6 + mocks), and feel a bit out of this PR scope. I will take note of this improvement, and apply it to the extracted flow and settings.

@larkox larkox requested a review from mickmister May 8, 2020 15:08
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 other than changing receive_notifications to receive_notifications_during_meetings and @hanzei's request for typing the enums together.

@@ -199,7 +199,7 @@ func (m *mscalendar) setStatusFromCalendarView(user *store.User, currentStatus s
}
message = "User is no longer busy in calendar. Set status to online."
} else {
message = "User is no longer busy in calendar, but is not set to busy. No status change."
message = fmt.Sprintf("User is no longer busy in calendar, but is not set to busy(%s). No status change.", busyStatus)
Copy link
Contributor

Choose a reason for hiding this comment

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

Non-blocking nit, I'm thinking there should be a space between "busy" and the busyStatus

Suggested change
message = fmt.Sprintf("User is no longer busy in calendar, but is not set to busy(%s). No status change.", busyStatus)
message = fmt.Sprintf("User is no longer busy in calendar, but is not set to busy (%s). No status change.", busyStatus)

@codecov-io
Copy link

Codecov Report

Merging #118 into master will decrease coverage by 0.13%.
The diff coverage is 14.81%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #118      +/-   ##
==========================================
- Coverage   24.81%   24.67%   -0.14%     
==========================================
  Files          65       65              
  Lines        2535     2553      +18     
==========================================
+ Hits          629      630       +1     
- Misses       1830     1846      +16     
- Partials       76       77       +1     
Impacted Files Coverage Δ
server/mscalendar/settings.go 0.00% <0.00%> (ø)
server/mscalendar/welcome_flow.go 0.00% <0.00%> (ø)
server/mscalendar/availability.go 61.42% <36.36%> (-0.41%) ⬇️

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 b4ddb3b...74cae4e. Read the comment docs.

@mickmister
Copy link
Contributor

/update-branch

@larkox larkox requested a review from mickmister May 13, 2020 09:22
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 removed the 2: Dev Review Requires review by a core committer label May 13, 2020
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. This is working as expected

  • Login workflow now allows user to select from DND or Away
  • When set to receive notification user is moved to away as expected
  • Once user is free again MM will prompt to switch status back to Online
  • User Can use new Yes / No in settings panel to flip between Online and Away
  • Updated between DND and Away in panel will update to selected status for next event

LGTM!

@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 May 20, 2020
@codecov-commenter
Copy link

Codecov Report

Merging #118 into master will decrease coverage by 0.15%.
The diff coverage is 13.79%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #118      +/-   ##
==========================================
- Coverage   24.63%   24.48%   -0.16%     
==========================================
  Files          65       65              
  Lines        2549     2569      +20     
==========================================
+ Hits          628      629       +1     
- Misses       1844     1861      +17     
- Partials       77       79       +2     
Impacted Files Coverage Δ
server/mscalendar/settings.go 0.00% <0.00%> (ø)
server/mscalendar/welcome_flow.go 0.00% <0.00%> (ø)
server/mscalendar/availability.go 60.84% <30.76%> (-0.99%) ⬇️

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 b9ee9dc...ba06e1e. Read the comment docs.

@larkox larkox merged commit d55078a into mattermost:master May 20, 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.

Allow status change to support DND and Away
7 participants