-
Notifications
You must be signed in to change notification settings - Fork 25
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
Refactor calendar engine into its own package #267
Changes from 1 commit
00e1eb0
742a49c
7f238a2
19ff374
38ebd1f
a88921f
8259bde
83db731
b057dcf
863cb37
38f3fdf
9ed5ee6
d78381a
728630e
585e821
e30acd4
b139719
e3d6a94
336a906
34ca3ed
421c8d5
f226b5e
aa14450
d3fe76b
b345fef
eba9102
b3f4558
23a3f23
95c9a44
735fc05
c47dd5e
7a45ad0
7f673be
2a4ec5d
1ab957a
2ddf28b
4eda283
37a55c0
aeb352a
ac12e63
f8a8f75
dc937e2
abd0eec
1cc2149
974d5d0
b6bed01
39544fd
9ef367a
73dfe63
2bb4367
395cbfa
6b8defa
8a728fd
8925e67
dfeb3d1
c1bd4d3
5ef3953
8b4065b
3d0dc0b
bf4cefe
783c2f0
ae5f3d8
1de44d0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,8 @@ | |
|
||
package config | ||
|
||
// REVIEW: need an interface for returning bot info | ||
// probably good to have a struct to capture the data clump | ||
const ( | ||
BotUserName = "gcal" | ||
BotDisplayName = "Google Calendar" | ||
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. all fields being used here, that should be put into a struct
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,6 +35,7 @@ func (s *notificationSetting) Set(userID string, value interface{}) error { | |
cal := s.getCal(userID) | ||
|
||
if boolValue { | ||
// REVIEW: notification subscription logic in notification settings. this seems a bit weird. what does this function/block have to do specifically with notifications? | ||
_, err := cal.LoadMyEventSubscription() | ||
if err != nil { | ||
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. Not really sure what's going on here. It seems like: "If a setting is a boolean, create an event subscription if not exists" This is |
||
_, err := cal.CreateMyEventSubscription() | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ type Subscriptions interface { | |
LoadMyEventSubscription() (*store.Subscription, error) | ||
} | ||
|
||
// REVIEW: depends on the overlap of subscription logic between providers, but lots of logic about supscription lifecycle in this file | ||
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. Need to figure out if google's subscription lifecycle lines up with this |
||
func (m *mscalendar) CreateMyEventSubscription() (*store.Subscription, error) { | ||
err := m.Filter(withClient) | ||
if err != nil { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -31,6 +31,7 @@ type mscBot struct { | |
} | ||
|
||
const ( | ||
// REVIEW: "microsoft" referenced here | ||
WelcomeMessage = `Welcome to the Microsoft Calendar plugin. | ||
[Click here to link your account.](%s/oauth2/connect)` | ||
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. "Microsoft Calendar plugin" mentioned here |
||
) | ||
|
@@ -122,6 +123,7 @@ func (bot *mscBot) newConnectAttachment() *model.SlackAttachment { | |
|
||
func (bot *mscBot) newConnectedAttachment(userLogin string) *model.SlackAttachment { | ||
title := "Connect" | ||
// REVIEW: "microsoft" referenced here | ||
text := ":tada: Congratulations! Your microsoft account (*" + userLogin + "*) has been connected to Mattermost." | ||
return &model.SlackAttachment{ | ||
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. "Microsoft" mentioned here |
||
Title: title, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,7 @@ func (p *Plugin) OnConfigurationChange() (err error) { | |
e.bot = e.bot.WithConfig(stored.Config) | ||
e.Dependencies.Remote = remote.Makers[gcal.Kind](e.Config, e.bot) | ||
|
||
// REVIEW: need to make this provider agnostic terminology | ||
mscalendarBot := mscalendar.NewMSCalendarBot(e.bot, e.Env, pluginURL) | ||
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. mscalendar terminology leaked into |
||
|
||
e.Dependencies.Logger = e.bot | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ func (oa *oa) oauth2Complete(w http.ResponseWriter, r *http.Request) { | |
return | ||
} | ||
|
||
// REVIEW "microsoft" is hardcoded | ||
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. "Microsoft Calendar" is hardcoded |
||
html := ` | ||
<!DOCTYPE html> | ||
<html> | ||
|
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.
config: plugin name