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

[GCAL] today/tomorrow commands with styling #273

Merged
merged 11 commits into from
Aug 1, 2023

Conversation

fmartingr
Copy link
Contributor

Summary

  • Adds: /trigger summary today, /trigger summary tomorrow
  • Aliases: /trigger today, /trigger tomorrow.
  • Refactored GetDailySummaryForUser(user *User) (string, error) to GetDaySummaryForUser(now time.Time, user *User) (string, error) (allows sending the day, since the logic is the same).
  • Views: Added new RenderDaySummary which uses slack attachments to display each event (see screenshots below)
  • Poster: Added new DMWithMessageAndAttachments(mattermostUserID, message string, attachments ...*model.SlackAttachment) (string, error)

Ticket Link

Notes

  • I have not included the button because we can't directly add an URL in there, we need to add a handler. It also didn't make much sense since we have the link just above the button anyway. (Discussion pending)
  • The views could be interfaced to allow the users to select which view they prefect. Personally I like the table view, but having the option to choose is nice. I didn't want to spend time on that just yet.
  • The Poster cloud be improved by using a more generative approach: Example:Poster.DM(mattermostUserID, option.WithAttachments(attachments), options.WithMessage(message)).

Screenshots

Screenshot 2023-07-27 at 10 16 33

@fmartingr fmartingr self-assigned this Jul 27, 2023
@codecov-commenter
Copy link

codecov-commenter commented Jul 27, 2023

Codecov Report

Patch coverage has no change and project coverage change: -0.08% ⚠️

Comparison is base (585e821) 15.29% compared to head (ed9d16b) 15.21%.

Additional details and impacted files
@@                 Coverage Diff                 @@
##           migrate-to-gcal     #273      +/-   ##
===================================================
- Coverage            15.29%   15.21%   -0.08%     
===================================================
  Files                   78       78              
  Lines                 3780     3798      +18     
===================================================
  Hits                   578      578              
- Misses                3138     3156      +18     
  Partials                64       64              
Files Changed Coverage Δ
server/command/command.go 35.53% <0.00%> (-1.86%) ⬇️
server/command/daily_summary.go 0.00% <0.00%> (ø)
server/mscalendar/daily_summary.go 39.30% <0.00%> (-1.66%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@mickmister
Copy link
Contributor

Personally I like the table view, but having the option to choose is nice.

I have to agree 🙂 The attachments version is a little difficult to visually at a glance. I think a structured view like a table works better here. Are you able to post a screenshot of the table version for a before & after comparison?

0/5 on if it should be the table view, and/or have a toggle for this. @DHaussermann I'm curious what you think about this?

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.

Code LGTM 👍 Just a few comments

server/mscalendar/daily_summary.go Outdated Show resolved Hide resolved
server/mscalendar/views/calendar.go Outdated Show resolved Hide resolved
@fmartingr
Copy link
Contributor Author

fmartingr commented Jul 29, 2023

Table view

Screenshot 2023-07-29 at 07 45 01

Attachment view

Screenshot 2023-07-29 at 07 46 52

I believe in another PR i made the attachment titles links as well.

cc: @matthewbirtch

@mickmister
Copy link
Contributor

Looking at the before & after (table vs attachment view), I definitely prefer the table view. I think the attachment view is good for showing one event's information, but not so much when trying to visually parse several events at once.

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, though I would like to see the table view supported for the daily summary. @matthewbirtch Do you have any thoughts on this?

@jasonblais
Copy link

Looking at the before & after (table vs attachment view), I definitely prefer the table view. I think the attachment view is good for showing one event's information, but not so much when trying to visually parse several events at once.

+1 for a table view for a more concise daily summary of events

@matthewbirtch
Copy link

matthewbirtch commented Jul 31, 2023

LGTM, though I would like to see the table view supported for the daily summary. @matthewbirtch Do you have any thoughts on this?

I like the table view for the agenda too. It's quite easy to scan and consume the agenda. A couple questions:

  • One possible concern for the table view would be mobile though. Displaying this on mobile wouldn't be great. Is it possible to display the other layout on mobile?
  • Would we add a column for location?
  • What does the linked subject line go to?
  • Minor detail: are we able to left-align the Time header cell? It should be left-aligned rather than centered. (like the Subject header cell).

@fmartingr
Copy link
Contributor Author

  • One possible concern for the table view would be mobile though. Displaying this on mobile wouldn't be great. Is it possible to display the other layout on mobile?

I'm deferring to @mickmister on this one, since I don't think we can but I'm 0/5 on it.

  • Would we add a column for location?

Yes. For known links that's the plan, adding a "Join meeting" link.

  • What does the linked subject line go to?

To the event in the Google calendar website.

  • Minor detail: are we able to left-align the Time header cell? It should be left-aligned rather than centered. (like the Subject header cell).

Yes, that can be done.

@mickmister
Copy link
Contributor

  • One possible concern for the table view would be mobile though. Displaying this on mobile wouldn't be great. Is it possible to display the other layout on mobile?

I'm deferring to @mickmister on this one, since I don't think we can but I'm 0/5 on it.

@fmartingr Are you able to post a screenshot of what this looks like on mobile? I'm also pretty sure that we aren't able to display it differently on mobile

@fmartingr
Copy link
Contributor Author

  • One possible concern for the table view would be mobile though. Displaying this on mobile wouldn't be great. Is it possible to display the other layout on mobile?

I'm deferring to @mickmister on this one, since I don't think we can but I'm 0/5 on it.

@fmartingr Are you able to post a screenshot of what this looks like on mobile? I'm also pretty sure that we aren't able to display it differently on mobile

Message

IMG_5519

When you tap on the lower-right icon

IMG_5520

cc: @larkox

@larkox
Copy link
Contributor

larkox commented Jul 31, 2023

Displaying different on mobile it is possible, but extremely annoying. Here would be the thing:

  • On web, it will use a custom post type that will render as a table. This hopefully is simple, but may be become troublesome.
  • On mobile, since it is not using the custom post type, it will use the default one, that would be that "Slack attachment" view.

The other big issue? When the plugin is disabled (and therefore the custom type does not render on web), the posts will show the "Slack attachment" view, which is weird.

All that being said, I would argue against having different views for them.

@fmartingr
Copy link
Contributor Author

This is how it looks like on web with the "Join Meeting" cells:

Screenshot 2023-07-31 at 18 03 53

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.

Just one question regarding tomorrow date calculation. Otherwise LGTM 👍

@@ -29,11 +29,11 @@ func (c *Command) dailySummary(parameters ...string) (string, bool, error) {
}
return postStr, false, nil
case "tomorrow":
_, err := c.MSCalendar.GetDaySummaryForUser(time.Now().Add(time.Hour*24), c.user())
postStr, err := c.MSCalendar.GetDaySummaryForUser(time.Now().Add((time.Hour*24)*4), c.user())
Copy link
Contributor

Choose a reason for hiding this comment

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

Why do we add (time.Hour*24)*4 here? Also do we need to take into account weekends (maybe that's the intention here)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh no no no, I accidentaly commited that. Used to get the output of a specific day for a screenshot.

Copy link
Contributor

Choose a reason for hiding this comment

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

Though this begs the question, should we have a special case for weekends? Currently, the daily summary job avoids sending the summary on the weekend, so there is already some convention in the plugin to avoid weekends. Maybe the tomorrow command should do something similar?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Didn't check that code, is it configurable? Does it take into consideration countries were weekends are longer/shorter/on different days?

Copy link
Contributor

Choose a reason for hiding this comment

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

Here is the line that does this

if now.Weekday() == time.Saturday || now.Weekday() == time.Sunday {

It's currently not configurable, but we can use WorkingHours to figure out the correct days if available for gcal:

type WorkingHours struct {
StartTime string `json:"startTime"`
EndTime string `json:"endTime"`
TimeZone struct {
Name string `json:"name"`
}
DaysOfWeek []string `json:"daysOfWeek"`
}
type MailboxSettings struct {
TimeZone string `json:"timeZone"`
WorkingHours WorkingHours `json:"workingHours"`
}

}

func isKnownMeetingURL(location string) bool {
return strings.Contains(location, "zoom.us/j/") || strings.Contains(location, "discord.gg") || strings.Contains(location, "meet.google.com")
Copy link
Contributor

Choose a reason for hiding this comment

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

Neat 👍 Something comes to mind, that a customer may have other call-related domains, including Mattermost Calls. Maybe have this configurable in some way?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I want to integrate calls too, but need to send the SITE_URL over to check the URL to do it properly, so it needs a bit more work. Also, Google sends conferenceData for some events instead of location (I'm assuming they have a specific integration), so it wont work every time.

@fmartingr fmartingr merged commit 421c8d5 into migrate-to-gcal Aug 1, 2023
4 checks passed
@fmartingr fmartingr deleted the fmartingr/gcal/today-tomorrow branch August 1, 2023 07:11
mickmister added a commit that referenced this pull request Mar 1, 2024
* oauth works

* autocomplete

* viewcal works

* add unimplemented if blocks

* fix tests and lint

* implement CreateMySubscription, RenewSubscription, and DeleteSubscription gcal methods

* WIP gcal subs

* setup-attach make target

* fix lint and tests

* chore: more compatible tar command

* add review comments

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* bug: get timezone from datetime instead of event data (#271)

* [GCAL] Allow building two different plugins under the same codebase (#268)

* plugin profile images

* receive provider flag

* manifests

* retrieve manifest id from file

* Build time configuration

* revert manifest

* using go static configuration for providers

* removed unused build flags

* revert manifest

* Added basic Google Calendar instructions

* Update providers/GoogleCalendar.md

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update providers/GoogleCalendar.md

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update server/plugin/plugin.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remoove log

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Endpoint to autocomplete connected calendar users (#275)

* user_store: more information fields on the index

* feat: endpoint to autocomplete calendar connected users

* revert test event store hashed

* Update server/api/autocomplete.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update server/api/autocomplete.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* dont expose private data in endpoint

* lint

* Update server/store/user_store.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Refactor Microsoft Calendar references to provider references (#276)

* chore: replace provider display name

* chore: replace command trigger references

* revert previous changes

* [GCAL] Enable notifications and reminders when a superuser token is not supported (#272)

* nil control

* use subscriptions default ttl

* return specific error when no superuser token can be used

* notification formatting logic to other file

* Client.GetEventsBetweenDates

* typo: import

* shorter command name :)

* availability without super user token

* delete store subs only if we successfuly do on remote

* comment

* ignore missing subs

* update sync method

* allow switching acting user on the fly

* daily summary without super user token

* formatted imports

* calendar -> calendarEvents

* processAllDailySummaryByUser
 -> processAllDailySummaryWithIndividualCredentials

* revert silenced error under notifications

* msgraph GetEventsBetweenDates

* Update server/mscalendar/daily_summary.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* Client.GetEventsBetweenDates

* fix: store last post time

* refactored availability logic

* availability test

* refactored daily summary logic

* test: availability

* daily summary tests (wip)

* daily summary test

* fix: merge duplications

* slack attachment for notifications

* lint and test

* goimports

* Update server/mscalendar/availability.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remove logges

* nullify client when changing acting user

* move withActiveUser filter to fenced code outside of general method

* tests: handling more scenarios

* Fixed test after bugfix

* fixed test assertions

* allow engine copy to perform safe state mutations

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Added encrypted key value storage (#270)

* Added encrypted kvstore

* encrypt only oauth2 kv store

* retrieve encryption setting from provider config

* explicitly disable encrypted store for mscalendar

* remove old comment

* [GCAL] today/tomorrow commands with styling (#273)

* feat: added today and tomorrow commands with attachments

* remove unused function

* linted

* now -> day

* remove unused code

* today/tomorrow autocomplete

* return tables on today/tomorrow commands

* check for nil location

* revert tomorrow day times four

* fix markdown table render and test

* [GCAL] Fix test in main branch from PR merges (#277)

* fix: test from merges

* add meeting url

* [GCAL] Move configuration readyness logic to remotes (#279)

* Move configuration logic to remotes

* check encryption key as well

* Update server/plugin/plugin.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Remove unused code (#278)

* remove batch requests from gcal code

* More info in readme

* [GCAL] Fix event notifications not working due to missing scope permissions plus internal state (#282)

* fix: notifications scope and acting user logic

* remove log

* avoid calling notifications if the engine fails to load

* [GCAL] Unsubscriptions (#283)

* fix: notifications scope and acting user logic

* fix: gcal unsubscribe requiring more parameters

* update gcal manifest (#285)

* [GCAL] Better logging information (#287)

* fix: better log information

* log missing error

* use correct manifest file on manifest calls (#290)

* [GCAL] Embed tzdata and correctly parse location from event datetime (#288)

* fix: embed tzdata to prevent errors on systems without it installed

* move to main

* avoid overwritting location if empty

* use tags instead of import

* [GCAL] Event notifications behind a feature flag (#292)

* put event notifications behind a feature flag

* admin only un/subscribe commands

* properly fence notification processor

* ignore notifications if there's no processor (#293)

* [GCAL] Remove join event column (broken from merges) (#294)

* remove join column from merges

* revert manifest

* [GCAL] Channels reminder underlying logic (#274)

* nil control

* use subscriptions default ttl

* return specific error when no superuser token can be used

* notification formatting logic to other file

* Client.GetEventsBetweenDates

* typo: import

* shorter command name :)

* availability without super user token

* delete store subs only if we successfuly do on remote

* comment

* ignore missing subs

* update sync method

* allow switching acting user on the fly

* daily summary without super user token

* formatted imports

* calendar -> calendarEvents

* processAllDailySummaryByUser
 -> processAllDailySummaryWithIndividualCredentials

* revert silenced error under notifications

* msgraph GetEventsBetweenDates

* Update server/mscalendar/daily_summary.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* Client.GetEventsBetweenDates

* fix: store last post time

* refactored availability logic

* availability test

* refactored daily summary logic

* test: availability

* daily summary tests (wip)

* daily summary test

* fix: merge duplications

* slack attachment for notifications

* lint and test

* goimports

* Allow poster to create posts

* Allow store event metadata

* styling

* store recurring event id

* deliver channel notifications

* test: fixed for base case

* test: channel reminders

* test: recurring events

* move from slice to map

* Added store methods to interact with event metadata

* lint

* lint imports

* restore logic lost in merge

* duplicated test

* Update server/mscalendar/availability_test.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remove recurrent event id field

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Updated google calendar readme

* [GCAL] Summary command fixes (#286)

* command trigger shown

* added autocomplete to summary command

* remove join meeting column

* fix event subjects with table separator

* fixed merge import

* replace more characters in subject

* [GCAL] Add a modal to create events (#281)

* add webapp folder

* WIP

* opening create event modal from slash command works

* add time selectors and initial impl of attendee selector

* delete .npminstall

* ignore .npminstall

* [GCAL/MSCAL] Add endpoint to create events from the frontend (#291)

* add remoteid to event attendee

* api endpoint

* conversion fixes

* api logic

* frontend logic to test

* check if user belongs to channel

* updated interface

* use api/v1 prefix

* implement getchannelmember

* all day events

* pluginAPI.CanLinkEventToChannel

* autocomplete users

* create event fetch call

* channel autocomplete

* improved error messages displayed to users

* better error handling

* channel selector store channel id

* properly set email addresses for attendees

* event location as string

* response messages

* little refactor

* attendee selector can invite arbitrary emails

* uppercase error dynamically

* lowercase error

* remove punctuation

* linted ts files

* goimports

* fixed import

* link events on creation

* Add channel action to create events

* add channel_id to payload

* time selector every 15 minutes

* time selector start/end with limits

* capitalized error messages

* don't allow 0 minute events

* display timezone in channel reminders

* utc time parsing

* remove nullfunc

* properly initialize variables

* address some comments

* npm run fix

* Update webapp/src/components/time_selector.tsx

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update webapp/src/components/time_selector.tsx

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* refactor options with useMemo

* capitalization in function for clarity

* npm run fix

* get plugin id from manifest

* remove no-ops

* refactor createEvent

* fix channel autocomplete url

* fix lint

* fix user string typo

* make it so `make apply` assumes gcal for now

* more careful error handling

* reorganize frontend error handling

* default to CALENDAR_PROVIDER=gcal

* use Client4.autocompleteChannels instead of custom plugin endpoint

* fix manifest test

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* gofmt

---------

Co-authored-by: Felipe Martin <me@fmartingr.com>
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* [GCAL/MSCAL] Store linked events per user to remove links on disconnection (#296)

* add webapp folder

* WIP

* opening create event modal from slash command works

* add time selectors and initial impl of attendee selector

* delete .npminstall

* ignore .npminstall

* add remoteid to event attendee

* api endpoint

* conversion fixes

* api logic

* frontend logic to test

* check if user belongs to channel

* updated interface

* use api/v1 prefix

* implement getchannelmember

* all day events

* pluginAPI.CanLinkEventToChannel

* autocomplete users

* create event fetch call

* channel autocomplete

* improved error messages displayed to users

* better error handling

* channel selector store channel id

* properly set email addresses for attendees

* event location as string

* response messages

* little refactor

* attendee selector can invite arbitrary emails

* uppercase error dynamically

* lowercase error

* remove punctuation

* linted ts files

* goimports

* fixed import

* link events on creation

* Add channel action to create events

* add channel_id to payload

* time selector every 15 minutes

* time selector start/end with limits

* capitalized error messages

* don't allow 0 minute events

* display timezone in channel reminders

* utc time parsing

* remove nullfunc

* properly initialize variables

* address some comments

* npm run fix

* store linked events for user to remove links on disconnection

* typo

* remove unused items after merge

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL/MSCAL] Remind only accepted events (#295)

* remind only accepted events

* fixed tests

* excludeDeclinedEvents

* normalize msgraph event response

* Remove GoogleDomainVerifyKey setting (#299)

* fix: encrypt user store (#297)

* feat: send notifications when an event is created (#300)

* typo: user already connected message (#301)

* typo: user already connected message

* test: fix change

* typo: user already connected message (#301)

* typo: user already connected message

* test: fix change

* [GCAL/MSCAL] Exclude rejected events from agenda commands (#302)

* exclude rejected events from agenda commands

* test: check that declied event are excluded

* fix possible nil pointer

* [GCAL/MSCAL] Create event modal only for connected accounts (#303)

* only connected users chan use slash command

* prevent channel menu action from allowing too

* npm run fix

* lint errors

* retrieve provider configuration to use in messages

* websocket events

* add message to mobile users

* npm run fix

* Update webapp/src/plugin_hooks.ts

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* register modal in setup

* events create

* trigger from provide config

* using dispatch

* missing semicolon

* Update webapp/src/plugin_hooks.ts

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* singular

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* updated settings to use style and removed current value line (#305)

* show link to connect if not connected (#306)

* [GCAL/MSCAL] Reduce welcome steps  (#308)

* reduce welcome steps and edit defaults

* Update server/mscalendar/welcome_flow.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL/MSCAL] Control start/date times if the selected date is today (#307)

* improvements to create event datetimes

* reset starttime endtime on date change

* repopulate times if date changed

* npm run fix

* database replication workaround (#312)

* [GCAL/MSCAL] Catch errors when using `findmeetings` commands without enough parameters (#313)

* fix: handle error in find meetings parameters command

* changed loop variable usage

* Replace Equals with ElementsMatch

* makefile dist build for production (#314)

* [GCAL/MSCAL] Create event UX improvements (#309)

* Optional fields

* time picker defaults

* Add custom icon to Create Event menu item

* add custom icon to date selector

* npm run fix

* header menu icon multiline

* use scss

* using proper typeRoots

* scoped css style

* [GCAL] Store conference data (#298)

* extract conference data into new attribute

* removed log

* removed unused fuunction

* tests

* Update server/remote/gcal/get_default_calendar_view_test.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* more realistic datetime values

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Common code refactor, back to mscalendar plugin (#334)

* refactor: mscalendar -> engine

* remove gcal assets

* refactored common code outside server package

* check-style

* go mod tidy

* REPO_URL -> REPOSITORY_URL

* delete unknown file

* updated mocks

* apped user to handle after all actions (#335)

* refactor msgraph to mscalendar

* goimports

* removed apply command from merge

* remove "REVIEW:" comments

---------

Co-authored-by: Felipe Martin <me@fmartingr.com>
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>
raghavaggarwal2308 added a commit that referenced this pull request Aug 9, 2024
* oauth works

* autocomplete

* viewcal works

* add unimplemented if blocks

* fix tests and lint

* implement CreateMySubscription, RenewSubscription, and DeleteSubscription gcal methods

* WIP gcal subs

* setup-attach make target

* fix lint and tests

* chore: more compatible tar command

* add review comments

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* bug: get timezone from datetime instead of event data (#271)

* [GCAL] Allow building two different plugins under the same codebase (#268)

* plugin profile images

* receive provider flag

* manifests

* retrieve manifest id from file

* Build time configuration

* revert manifest

* using go static configuration for providers

* removed unused build flags

* revert manifest

* Added basic Google Calendar instructions

* Update providers/GoogleCalendar.md

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update providers/GoogleCalendar.md

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update server/plugin/plugin.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remoove log

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Endpoint to autocomplete connected calendar users (#275)

* user_store: more information fields on the index

* feat: endpoint to autocomplete calendar connected users

* revert test event store hashed

* Update server/api/autocomplete.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update server/api/autocomplete.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* dont expose private data in endpoint

* lint

* Update server/store/user_store.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Refactor Microsoft Calendar references to provider references (#276)

* chore: replace provider display name

* chore: replace command trigger references

* revert previous changes

* [GCAL] Enable notifications and reminders when a superuser token is not supported (#272)

* nil control

* use subscriptions default ttl

* return specific error when no superuser token can be used

* notification formatting logic to other file

* Client.GetEventsBetweenDates

* typo: import

* shorter command name :)

* availability without super user token

* delete store subs only if we successfuly do on remote

* comment

* ignore missing subs

* update sync method

* allow switching acting user on the fly

* daily summary without super user token

* formatted imports

* calendar -> calendarEvents

* processAllDailySummaryByUser
 -> processAllDailySummaryWithIndividualCredentials

* revert silenced error under notifications

* msgraph GetEventsBetweenDates

* Update server/mscalendar/daily_summary.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* Client.GetEventsBetweenDates

* fix: store last post time

* refactored availability logic

* availability test

* refactored daily summary logic

* test: availability

* daily summary tests (wip)

* daily summary test

* fix: merge duplications

* slack attachment for notifications

* lint and test

* goimports

* Update server/mscalendar/availability.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remove logges

* nullify client when changing acting user

* move withActiveUser filter to fenced code outside of general method

* tests: handling more scenarios

* Fixed test after bugfix

* fixed test assertions

* allow engine copy to perform safe state mutations

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Added encrypted key value storage (#270)

* Added encrypted kvstore

* encrypt only oauth2 kv store

* retrieve encryption setting from provider config

* explicitly disable encrypted store for mscalendar

* remove old comment

* [GCAL] today/tomorrow commands with styling (#273)

* feat: added today and tomorrow commands with attachments

* remove unused function

* linted

* now -> day

* remove unused code

* today/tomorrow autocomplete

* return tables on today/tomorrow commands

* check for nil location

* revert tomorrow day times four

* fix markdown table render and test

* [GCAL] Fix test in main branch from PR merges (#277)

* fix: test from merges

* add meeting url

* [GCAL] Move configuration readyness logic to remotes (#279)

* Move configuration logic to remotes

* check encryption key as well

* Update server/plugin/plugin.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Remove unused code (#278)

* remove batch requests from gcal code

* More info in readme

* [GCAL] Fix event notifications not working due to missing scope permissions plus internal state (#282)

* fix: notifications scope and acting user logic

* remove log

* avoid calling notifications if the engine fails to load

* [GCAL] Unsubscriptions (#283)

* fix: notifications scope and acting user logic

* fix: gcal unsubscribe requiring more parameters

* update gcal manifest (#285)

* [GCAL] Better logging information (#287)

* fix: better log information

* log missing error

* use correct manifest file on manifest calls (#290)

* [GCAL] Embed tzdata and correctly parse location from event datetime (#288)

* fix: embed tzdata to prevent errors on systems without it installed

* move to main

* avoid overwritting location if empty

* use tags instead of import

* [GCAL] Event notifications behind a feature flag (#292)

* put event notifications behind a feature flag

* admin only un/subscribe commands

* properly fence notification processor

* ignore notifications if there's no processor (#293)

* [GCAL] Remove join event column (broken from merges) (#294)

* remove join column from merges

* revert manifest

* [GCAL] Channels reminder underlying logic (#274)

* nil control

* use subscriptions default ttl

* return specific error when no superuser token can be used

* notification formatting logic to other file

* Client.GetEventsBetweenDates

* typo: import

* shorter command name :)

* availability without super user token

* delete store subs only if we successfuly do on remote

* comment

* ignore missing subs

* update sync method

* allow switching acting user on the fly

* daily summary without super user token

* formatted imports

* calendar -> calendarEvents

* processAllDailySummaryByUser
 -> processAllDailySummaryWithIndividualCredentials

* revert silenced error under notifications

* msgraph GetEventsBetweenDates

* Update server/mscalendar/daily_summary.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL] Create event logic (#269)

* remote logic

* allow datetimes without timezone

* add calendar settings readonly scope to get tz

* event conversion

* scopes

* revert datetime.time

* Client.GetEventsBetweenDates

* fix: store last post time

* refactored availability logic

* availability test

* refactored daily summary logic

* test: availability

* daily summary tests (wip)

* daily summary test

* fix: merge duplications

* slack attachment for notifications

* lint and test

* goimports

* Allow poster to create posts

* Allow store event metadata

* styling

* store recurring event id

* deliver channel notifications

* test: fixed for base case

* test: channel reminders

* test: recurring events

* move from slice to map

* Added store methods to interact with event metadata

* lint

* lint imports

* restore logic lost in merge

* duplicated test

* Update server/mscalendar/availability_test.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* remove recurrent event id field

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Updated google calendar readme

* [GCAL] Summary command fixes (#286)

* command trigger shown

* added autocomplete to summary command

* remove join meeting column

* fix event subjects with table separator

* fixed merge import

* replace more characters in subject

* [GCAL] Add a modal to create events (#281)

* add webapp folder

* WIP

* opening create event modal from slash command works

* add time selectors and initial impl of attendee selector

* delete .npminstall

* ignore .npminstall

* [GCAL/MSCAL] Add endpoint to create events from the frontend (#291)

* add remoteid to event attendee

* api endpoint

* conversion fixes

* api logic

* frontend logic to test

* check if user belongs to channel

* updated interface

* use api/v1 prefix

* implement getchannelmember

* all day events

* pluginAPI.CanLinkEventToChannel

* autocomplete users

* create event fetch call

* channel autocomplete

* improved error messages displayed to users

* better error handling

* channel selector store channel id

* properly set email addresses for attendees

* event location as string

* response messages

* little refactor

* attendee selector can invite arbitrary emails

* uppercase error dynamically

* lowercase error

* remove punctuation

* linted ts files

* goimports

* fixed import

* link events on creation

* Add channel action to create events

* add channel_id to payload

* time selector every 15 minutes

* time selector start/end with limits

* capitalized error messages

* don't allow 0 minute events

* display timezone in channel reminders

* utc time parsing

* remove nullfunc

* properly initialize variables

* address some comments

* npm run fix

* Update webapp/src/components/time_selector.tsx

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Update webapp/src/components/time_selector.tsx

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* refactor options with useMemo

* capitalization in function for clarity

* npm run fix

* get plugin id from manifest

* remove no-ops

* refactor createEvent

* fix channel autocomplete url

* fix lint

* fix user string typo

* make it so `make apply` assumes gcal for now

* more careful error handling

* reorganize frontend error handling

* default to CALENDAR_PROVIDER=gcal

* use Client4.autocompleteChannels instead of custom plugin endpoint

* fix manifest test

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* gofmt

---------

Co-authored-by: Felipe Martin <me@fmartingr.com>
Co-authored-by: Felipe Martin <812088+fmartingr@users.noreply.github.com>

* [GCAL/MSCAL] Store linked events per user to remove links on disconnection (#296)

* add webapp folder

* WIP

* opening create event modal from slash command works

* add time selectors and initial impl of attendee selector

* delete .npminstall

* ignore .npminstall

* add remoteid to event attendee

* api endpoint

* conversion fixes

* api logic

* frontend logic to test

* check if user belongs to channel

* updated interface

* use api/v1 prefix

* implement getchannelmember

* all day events

* pluginAPI.CanLinkEventToChannel

* autocomplete users

* create event fetch call

* channel autocomplete

* improved error messages displayed to users

* better error handling

* channel selector store channel id

* properly set email addresses for attendees

* event location as string

* response messages

* little refactor

* attendee selector can invite arbitrary emails

* uppercase error dynamically

* lowercase error

* remove punctuation

* linted ts files

* goimports

* fixed import

* link events on creation

* Add channel action to create events

* add channel_id to payload

* time selector every 15 minutes

* time selector start/end with limits

* capitalized error messages

* don't allow 0 minute events

* display timezone in channel reminders

* utc time parsing

* remove nullfunc

* properly initialize variables

* address some comments

* npm run fix

* store linked events for user to remove links on disconnection

* typo

* remove unused items after merge

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL/MSCAL] Remind only accepted events (#295)

* remind only accepted events

* fixed tests

* excludeDeclinedEvents

* normalize msgraph event response

* Remove GoogleDomainVerifyKey setting (#299)

* fix: encrypt user store (#297)

* feat: send notifications when an event is created (#300)

* typo: user already connected message (#301)

* typo: user already connected message

* test: fix change

* typo: user already connected message (#301)

* typo: user already connected message

* test: fix change

* [GCAL/MSCAL] Exclude rejected events from agenda commands (#302)

* exclude rejected events from agenda commands

* test: check that declied event are excluded

* fix possible nil pointer

* [GCAL/MSCAL] Create event modal only for connected accounts (#303)

* only connected users chan use slash command

* prevent channel menu action from allowing too

* npm run fix

* lint errors

* retrieve provider configuration to use in messages

* websocket events

* add message to mobile users

* npm run fix

* Update webapp/src/plugin_hooks.ts

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* register modal in setup

* events create

* trigger from provide config

* using dispatch

* missing semicolon

* Update webapp/src/plugin_hooks.ts

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* singular

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* updated settings to use style and removed current value line (#305)

* show link to connect if not connected (#306)

* [GCAL/MSCAL] Reduce welcome steps  (#308)

* reduce welcome steps and edit defaults

* Update server/mscalendar/welcome_flow.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* [GCAL/MSCAL] Control start/date times if the selected date is today (#307)

* improvements to create event datetimes

* reset starttime endtime on date change

* repopulate times if date changed

* npm run fix

* database replication workaround (#312)

* [GCAL/MSCAL] Catch errors when using `findmeetings` commands without enough parameters (#313)

* fix: handle error in find meetings parameters command

* changed loop variable usage

* Replace Equals with ElementsMatch

* makefile dist build for production (#314)

* [GCAL/MSCAL] Create event UX improvements (#309)

* Optional fields

* time picker defaults

* Add custom icon to Create Event menu item

* add custom icon to date selector

* npm run fix

* header menu icon multiline

* use scss

* using proper typeRoots

* scoped css style

* [GCAL] Store conference data (#298)

* extract conference data into new attribute

* removed log

* removed unused fuunction

* tests

* Update server/remote/gcal/get_default_calendar_view_test.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* more realistic datetime values

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* Common code refactor, back to mscalendar plugin (#334)

* refactor: mscalendar -> engine

* remove gcal assets

* refactored common code outside server package

* check-style

* go mod tidy

* REPO_URL -> REPOSITORY_URL

* delete unknown file

* updated mocks

* apped user to handle after all actions (#335)

* refactor msgraph to mscalendar

* refactor: removed unused commands

* Update calendar/command/command.go

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>

* go mod tidy

* removed added code from merge

---------

Co-authored-by: Michael Kochell <6913320+mickmister@users.noreply.github.com>
Co-authored-by: Raghav Aggarwal <raghav.aggarwal@brightscout.com>
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants