generated from mattermost/mattermost-plugin-starter-template
-
Notifications
You must be signed in to change notification settings - Fork 23
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
[GH87] Add "receive reminder" setting to login flow #117
Merged
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -76,6 +76,14 @@ func (wf *welcomeFlow) makeSteps() { | |||||
FalseButtonMessage: "No - Do not notify me of new events", | ||||||
TrueResponseMessage: "Great, you will receive a message any time you receive a new event.", | ||||||
FalseResponseMessage: "Great, you will not receive any notification on new events.", | ||||||
}, &flow.SimpleStep{ | ||||||
Title: "Receive reminder", | ||||||
Message: "Do you want to receive reminder of upcoming events?", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
PropertyName: store.ReceiveUpcomingEventReminderName, | ||||||
TrueButtonMessage: "Yes - I would like to receive reminders for upcoming events", | ||||||
FalseButtonMessage: "No - Do not notify me of upcoming events", | ||||||
TrueResponseMessage: "Great, you will receive a message before your meetings.", | ||||||
FalseResponseMessage: "Great, you will not receive any notification on upcoming events.", | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
}, &flow.EmptyStep{ | ||||||
Title: "Daily Summary", | ||||||
Message: "Remember that you can set-up a daily summary by typing `/mscalendar summary time 8:00AM`.", | ||||||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,9 +3,10 @@ package store | |
import "fmt" | ||
|
||
const ( | ||
UpdateStatusPropertyName = "update_status" | ||
GetConfirmationPropertyName = "get_confirmation" | ||
SubscribePropertyName = "subscribe" | ||
UpdateStatusPropertyName = "update_status" | ||
GetConfirmationPropertyName = "get_confirmation" | ||
SubscribePropertyName = "subscribe" | ||
ReceiveUpcomingEventReminderName = "receive_reminder" | ||
) | ||
|
||
func (s *pluginStore) SetProperty(userID, propertyName string, value bool) error { | ||
|
@@ -19,6 +20,8 @@ func (s *pluginStore) SetProperty(userID, propertyName string, value bool) error | |
user.Settings.UpdateStatus = value | ||
case GetConfirmationPropertyName: | ||
user.Settings.GetConfirmation = value | ||
case ReceiveUpcomingEventReminderName: | ||
user.Settings.ReceiveReminders = value | ||
default: | ||
return fmt.Errorf("property %s not found", propertyName) | ||
} | ||
|
@@ -37,17 +40,12 @@ func (s *pluginStore) SetPostID(userID, propertyName, postID string) error { | |
return err | ||
} | ||
|
||
switch propertyName { | ||
case UpdateStatusPropertyName: | ||
user.WelcomeFlowStatus.UpdateStatusPostID = postID | ||
case GetConfirmationPropertyName: | ||
user.WelcomeFlowStatus.GetConfirmationPostID = postID | ||
case SubscribePropertyName: | ||
user.WelcomeFlowStatus.SubscribePostID = postID | ||
default: | ||
return fmt.Errorf("property %s not found", propertyName) | ||
if user.WelcomeFlowStatus.PostIDs == nil { | ||
user.WelcomeFlowStatus.PostIDs = make(map[string]string) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Nice cleanup here! |
||
} | ||
|
||
user.WelcomeFlowStatus.PostIDs[propertyName] = postID | ||
|
||
err = s.StoreUser(user) | ||
if err != nil { | ||
return err | ||
|
@@ -62,16 +60,7 @@ func (s *pluginStore) GetPostID(userID, propertyName string) (string, error) { | |
return "", err | ||
} | ||
|
||
switch propertyName { | ||
case UpdateStatusPropertyName: | ||
return user.WelcomeFlowStatus.UpdateStatusPostID, nil | ||
case GetConfirmationPropertyName: | ||
return user.WelcomeFlowStatus.GetConfirmationPostID, nil | ||
case SubscribePropertyName: | ||
return user.WelcomeFlowStatus.SubscribePostID, nil | ||
default: | ||
return "", fmt.Errorf("property %s not found", propertyName) | ||
} | ||
return user.WelcomeFlowStatus.PostIDs[propertyName], nil | ||
} | ||
|
||
func (s *pluginStore) RemovePostID(userID, propertyName string) error { | ||
|
@@ -80,16 +69,7 @@ func (s *pluginStore) RemovePostID(userID, propertyName string) error { | |
return err | ||
} | ||
|
||
switch propertyName { | ||
case UpdateStatusPropertyName: | ||
user.WelcomeFlowStatus.UpdateStatusPostID = "" | ||
case GetConfirmationPropertyName: | ||
user.WelcomeFlowStatus.GetConfirmationPostID = "" | ||
case SubscribePropertyName: | ||
user.WelcomeFlowStatus.SubscribePostID = "" | ||
default: | ||
return fmt.Errorf("property %s not found", propertyName) | ||
} | ||
delete(user.WelcomeFlowStatus.PostIDs, propertyName) | ||
|
||
err = s.StoreUser(user) | ||
if err != nil { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This may not be in the scope of this PR, but I was thinking we should use the language "when you are invited to an event", instead of "when you receive a new event", in the prompts above this line, as it is clearer what we mean by "event".
Also, above we use the language "while you are on a meeting", versus "while you are in a meeting". Just some small improvements for wordings. @larkox Thoughts on this?