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

Refactor calendar engine into its own package #267

Merged
merged 63 commits into from
Mar 1, 2024
Merged
Show file tree
Hide file tree
Changes from 12 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
00e1eb0
oauth works
mickmister Dec 11, 2020
742a49c
autocomplete
mickmister Dec 11, 2020
7f238a2
viewcal works
mickmister Dec 11, 2020
19ff374
add unimplemented if blocks
mickmister Feb 20, 2021
38ebd1f
Merge branch 'master' into migrate-to-gcal
mickmister Feb 20, 2021
a88921f
fix tests and lint
mickmister Sep 14, 2021
8259bde
implement CreateMySubscription, RenewSubscription, and DeleteSubscrip…
mickmister Sep 17, 2021
83db731
WIP gcal subs
mickmister Sep 21, 2021
b057dcf
setup-attach make target
mickmister Sep 21, 2021
863cb37
Merge branch 'master' into gcal-merge
mickmister Jul 24, 2023
38f3fdf
fix lint and tests
mickmister Jul 24, 2023
9ed5ee6
chore: more compatible tar command
fmartingr Jul 24, 2023
d78381a
add review comments
mickmister Jul 25, 2023
728630e
[GCAL] Create event logic (#269)
fmartingr Jul 25, 2023
585e821
bug: get timezone from datetime instead of event data (#271)
fmartingr Jul 26, 2023
e30acd4
[GCAL] Allow building two different plugins under the same codebase (…
fmartingr Jul 31, 2023
b139719
[GCAL] Endpoint to autocomplete connected calendar users (#275)
fmartingr Aug 1, 2023
e3d6a94
[GCAL] Refactor Microsoft Calendar references to provider references …
fmartingr Aug 1, 2023
336a906
[GCAL] Enable notifications and reminders when a superuser token is n…
fmartingr Aug 1, 2023
34ca3ed
[GCAL] Added encrypted key value storage (#270)
fmartingr Aug 1, 2023
421c8d5
[GCAL] today/tomorrow commands with styling (#273)
fmartingr Aug 1, 2023
f226b5e
[GCAL] Fix test in main branch from PR merges (#277)
fmartingr Aug 1, 2023
aa14450
[GCAL] Move configuration readyness logic to remotes (#279)
fmartingr Aug 1, 2023
d3fe76b
[GCAL] Remove unused code (#278)
fmartingr Aug 1, 2023
b345fef
[GCAL] Fix event notifications not working due to missing scope permi…
fmartingr Aug 2, 2023
eba9102
[GCAL] Unsubscriptions (#283)
fmartingr Aug 2, 2023
b3f4558
update gcal manifest (#285)
fmartingr Aug 4, 2023
23a3f23
[GCAL] Better logging information (#287)
fmartingr Aug 4, 2023
95c9a44
use correct manifest file on manifest calls (#290)
fmartingr Aug 4, 2023
735fc05
[GCAL] Embed tzdata and correctly parse location from event datetime …
fmartingr Aug 4, 2023
c47dd5e
[GCAL] Event notifications behind a feature flag (#292)
fmartingr Aug 4, 2023
7a45ad0
ignore notifications if there's no processor (#293)
fmartingr Aug 4, 2023
7f673be
[GCAL] Remove join event column (broken from merges) (#294)
fmartingr Aug 4, 2023
2a4ec5d
[GCAL] Channels reminder underlying logic (#274)
fmartingr Aug 7, 2023
1ab957a
Updated google calendar readme
fmartingr Aug 9, 2023
2ddf28b
[GCAL] Summary command fixes (#286)
fmartingr Aug 11, 2023
4eda283
[GCAL] Add a modal to create events (#281)
mickmister Aug 16, 2023
37a55c0
[GCAL/MSCAL] Store linked events per user to remove links on disconne…
fmartingr Aug 16, 2023
aeb352a
[GCAL/MSCAL] Remind only accepted events (#295)
fmartingr Aug 16, 2023
ac12e63
Remove GoogleDomainVerifyKey setting (#299)
fmartingr Aug 16, 2023
f8a8f75
fix: encrypt user store (#297)
fmartingr Aug 16, 2023
dc937e2
feat: send notifications when an event is created (#300)
fmartingr Aug 17, 2023
abd0eec
typo: user already connected message (#301)
fmartingr Aug 18, 2023
1cc2149
typo: user already connected message (#301)
fmartingr Aug 18, 2023
974d5d0
[GCAL/MSCAL] Exclude rejected events from agenda commands (#302)
fmartingr Aug 18, 2023
b6bed01
[GCAL/MSCAL] Create event modal only for connected accounts (#303)
fmartingr Aug 23, 2023
39544fd
updated settings to use style and removed current value line (#305)
fmartingr Aug 23, 2023
9ef367a
show link to connect if not connected (#306)
fmartingr Aug 23, 2023
73dfe63
[GCAL/MSCAL] Reduce welcome steps (#308)
fmartingr Aug 24, 2023
2bb4367
[GCAL/MSCAL] Control start/date times if the selected date is today (…
fmartingr Aug 24, 2023
395cbfa
database replication workaround (#312)
fmartingr Aug 28, 2023
6b8defa
[GCAL/MSCAL] Catch errors when using `findmeetings` commands without …
fmartingr Aug 29, 2023
8a728fd
Replace Equals with ElementsMatch
fmartingr Aug 30, 2023
8925e67
makefile dist build for production (#314)
fmartingr Aug 31, 2023
dfeb3d1
[GCAL/MSCAL] Create event UX improvements (#309)
fmartingr Sep 4, 2023
c1bd4d3
[GCAL] Store conference data (#298)
fmartingr Sep 6, 2023
5ef3953
Common code refactor, back to mscalendar plugin (#334)
fmartingr Oct 4, 2023
8b4065b
apped user to handle after all actions (#335)
fmartingr Oct 10, 2023
3d0dc0b
refactor msgraph to mscalendar
fmartingr Nov 6, 2023
bf4cefe
Merge remote-tracking branch 'origin/master' into migrate-to-gcal
fmartingr Feb 15, 2024
783c2f0
goimports
fmartingr Feb 15, 2024
ae5f3d8
removed apply command from merge
fmartingr Feb 15, 2024
1de44d0
remove "REVIEW:" comments
mickmister Feb 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
51 changes: 50 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ifneq ($(HAS_WEBAPP),)
mkdir -p dist/$(PLUGIN_ID)/webapp/dist;
cp -r webapp/dist/* dist/$(PLUGIN_ID)/webapp/dist/;
endif
cd dist && tar -cvzf $(BUNDLE_NAME) $(PLUGIN_ID)
cd dist && tar -cvzf $(BUNDLE_NAME) -C $(PLUGIN_ID) .

@echo plugin built at: dist/$(BUNDLE_NAME)

Expand Down Expand Up @@ -224,6 +224,55 @@ ifneq ($(HAS_WEBAPP),)
endif
rm -fr build/bin/

## Setup dlv for attaching, identifying the plugin PID for other targets.
.PHONY: setup-attach
setup-attach:
$(eval PLUGIN_PID := $(shell ps aux | grep "plugins/${PLUGIN_ID}" | grep -v "grep" | awk -F " " '{print $$2}'))
$(eval NUM_PID := $(shell echo -n ${PLUGIN_PID} | wc -w))

@if [ ${NUM_PID} -gt 2 ]; then \
echo "** There is more than 1 plugin process running. Run 'make kill reset' to restart just one."; \
exit 1; \
fi

## Check if setup-attach succeeded.
.PHONY: check-attach
check-attach:
@if [ -z ${PLUGIN_PID} ]; then \
echo "Could not find plugin PID; the plugin is not running. Exiting."; \
exit 1; \
else \
echo "Located Plugin running with PID: ${PLUGIN_PID}"; \
fi

## Attach dlv to an existing plugin instance.
.PHONY: attach
attach: setup-attach check-attach
dlv attach ${PLUGIN_PID}

## Attach dlv to an existing plugin instance, exposing a headless instance on $DLV_DEBUG_PORT.
.PHONY: attach-headless
attach-headless: setup-attach check-attach
dlv attach ${PLUGIN_PID} --listen :$(DLV_DEBUG_PORT) --headless=true --api-version=2 --accept-multiclient

## Detach dlv from an existing plugin instance, if previously attached.
.PHONY: detach
detach: setup-attach
@DELVE_PID=$(shell ps aux | grep "dlv attach ${PLUGIN_PID}" | grep -v "grep" | awk -F " " '{print $$2}') && \
if [ "$$DELVE_PID" -gt 0 ] > /dev/null 2>&1 ; then \
echo "Located existing delve process running with PID: $$DELVE_PID. Killing." ; \
kill -9 $$DELVE_PID ; \
fi

## Kill all instances of the plugin, detaching any existing dlv instance.
.PHONY: kill
kill: detach
$(eval PLUGIN_PID := $(shell ps aux | grep "plugins/${PLUGIN_ID}" | grep -v "grep" | awk -F " " '{print $$2}'))

@for PID in ${PLUGIN_PID}; do \
echo "Killing plugin pid $$PID"; \
kill -9 $$PID; \
done; \
# Help documentation à la https://marmelab.com/blog/2016/02/29/auto-documented-makefile.html
help:
@cat Makefile | grep -v '\.PHONY' | grep -v '\help:' | grep -B1 -E '^[a-zA-Z0-9_.-]+:.*' | sed -e "s/:.*//" | sed -e "s/^## //" | grep -v '\-\-' | sed '1!G;h;$$!d' | awk 'NR%2{printf "\033[36m%-30s\033[0m",$$0;next;}1' | sort
Binary file modified assets/profile.png
Copy link
Contributor

Choose a reason for hiding this comment

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

This we should take care as well.

Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 10 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,17 @@ require (
github.com/pkg/errors v0.9.1
github.com/rudderlabs/analytics-go v3.3.1+incompatible
github.com/spf13/pflag v1.0.5
github.com/stretchr/testify v1.8.0
github.com/stretchr/testify v1.8.1
github.com/yaegashi/msgraph.go v0.0.0-20191104022859-3f9096c750b2
golang.org/x/oauth2 v0.4.0
google.golang.org/api v0.103.0
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.53.0 // indirect
)

require (
cloud.google.com/go/compute v1.15.1 // indirect
cloud.google.com/go/compute/metadata v0.2.3 // indirect
github.com/andybalholm/brotli v1.0.4 // indirect
github.com/blang/semver v3.5.1+incompatible // indirect
github.com/blang/semver/v4 v4.0.0 // indirect
Expand All @@ -29,9 +34,12 @@ require (
github.com/francoispqt/gojay v1.2.13 // indirect
github.com/go-asn1-ber/asn1-ber v1.5.3 // indirect
github.com/go-sql-driver/mysql v1.6.0 // indirect
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/googleapis/enterprise-certificate-proxy v0.2.0 // indirect
github.com/googleapis/gax-go/v2 v2.7.0 // indirect
github.com/gorilla/websocket v1.4.2 // indirect
github.com/hashicorp/go-hclog v1.0.0 // indirect
github.com/hashicorp/go-plugin v1.4.3 // indirect
Expand Down Expand Up @@ -75,13 +83,12 @@ require (
github.com/xi2/xz v0.0.0-20171230120015-48954b6210f8 // indirect
github.com/xtgo/uuid v0.0.0-20140804021211-a0b114877d4c // indirect
github.com/yuin/goldmark v1.4.4 // indirect
go.opencensus.io v0.24.0 // indirect
golang.org/x/crypto v0.1.0 // indirect
golang.org/x/net v0.7.0 // indirect
golang.org/x/sys v0.5.0 // indirect
golang.org/x/text v0.7.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
google.golang.org/grpc v1.53.0 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/ini.v1 v1.64.0 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
Expand Down
22 changes: 20 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,21 @@ cloud.google.com/go v0.87.0/go.mod h1:TpDYlFy7vuLzZMMZ+B6iRiELaY7z/gJPaqbMx6mlWc
cloud.google.com/go v0.88.0/go.mod h1:dnKwfYbP9hQhefiUvpbcAyoGSHUrOxR20JVElLiUvEY=
cloud.google.com/go v0.90.0/go.mod h1:kRX0mNRHe0e2rC6oNakvwQqzyDmg57xJ+SZU1eT2aDQ=
cloud.google.com/go v0.93.3/go.mod h1:8utlLll2EF5XMAV15woO4lSbWQlk8rer9aLOfLh7+YI=
cloud.google.com/go v0.107.0 h1:qkj22L7bgkl6vIeZDlOY2po43Mx/TIa2Wsa7VR+PEww=
cloud.google.com/go/bigquery v1.0.1/go.mod h1:i/xbL2UlR5RvWAURpBYZTtm/cXjCha9lbfbpx4poX+o=
cloud.google.com/go/bigquery v1.3.0/go.mod h1:PjpwJnslEMmckchkHFfq+HTD2DmtT67aNFKH1/VBDHE=
cloud.google.com/go/bigquery v1.4.0/go.mod h1:S8dzgnTigyfTmLBfrtrhyYhwRxG72rYxvftPBK2Dvzc=
cloud.google.com/go/bigquery v1.5.0/go.mod h1:snEHRnqQbz117VIFhE8bmtwIDY80NLUZUMb4Nv6dBIg=
cloud.google.com/go/bigquery v1.7.0/go.mod h1://okPTzCYNXSlb24MZs83e2Do+h+VXtc4gLoIoXIAPc=
cloud.google.com/go/bigquery v1.8.0/go.mod h1:J5hqkt3O0uAFnINi6JXValWIb1v0goeZM77hZzJN/fQ=
cloud.google.com/go/compute v1.15.1 h1:7UGq3QknM33pw5xATlpzeoomNxsacIVvTqTTvbfajmE=
cloud.google.com/go/compute v1.15.1/go.mod h1:bjjoF/NtFUrkD/urWfdHaKuOPDR5nWIs63rR+SXhcpA=
cloud.google.com/go/compute/metadata v0.2.3 h1:mg4jlk7mCAj6xXp9UJ4fjI9VUI5rubuGBW5aJ7UnBMY=
cloud.google.com/go/compute/metadata v0.2.3/go.mod h1:VAV5nSsACxMJvgaAuX6Pk2AawlZn8kiOGuCv6gTkwuA=
cloud.google.com/go/datastore v1.0.0/go.mod h1:LXYbyblFSglQ5pkeyhO+Qmw7ukd3C+pD7TKLgZqpHYE=
cloud.google.com/go/datastore v1.1.0/go.mod h1:umbIZjpQpHh4hmRpGhH4tLFup+FVzqBi1b3c64qFpCk=
cloud.google.com/go/firestore v1.1.0/go.mod h1:ulACoGHTpvq5r8rxGJ4ddJZBZqakUQqClKRT5SZwBmk=
cloud.google.com/go/longrunning v0.3.0 h1:NjljC+FYPV3uh5/OwWT6pVU+doBqMg2x/rZlE+CamDs=
cloud.google.com/go/pubsub v1.0.1/go.mod h1:R0Gpsv3s54REJCy4fxDixWD93lHJMoZTyQ2kNxGRt3I=
cloud.google.com/go/pubsub v1.1.0/go.mod h1:EwwdRX2sKPjnvnqCa270oGRyludottCI76h+R3AArQw=
cloud.google.com/go/pubsub v1.2.0/go.mod h1:jhfEVHT8odbXTkndysNHCcx0awwzvfOlguIAii9o8iA=
Expand Down Expand Up @@ -554,6 +560,7 @@ github.com/golang/groupcache v0.0.0-20160516000752-02826c3e7903/go.mod h1:cIg4er
github.com/golang/groupcache v0.0.0-20190129154638-5b532d6fd5ef/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20191227052852-215e87163ea7/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e h1:1r7pUrabqp18hOBcwBwiTsbnFeTZHV9eER/QT5JVZxY=
github.com/golang/groupcache v0.0.0-20200121045136-8c9f03a8e57e/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
github.com/golang/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:tluoj9z5200jBnyusfRPU2LqT6J+DAorxEvtC7LHB+E=
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
Expand Down Expand Up @@ -642,10 +649,14 @@ github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+
github.com/google/uuid v1.2.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/google/uuid v1.3.0 h1:t6JiXgmwXMjEs8VusXIJk2BXHsn+wx8BZdTaoZ5fu7I=
github.com/google/uuid v1.3.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/googleapis/enterprise-certificate-proxy v0.2.0 h1:y8Yozv7SZtlU//QXbezB6QkpuE6jMD2/gfzk4AftXjs=
github.com/googleapis/enterprise-certificate-proxy v0.2.0/go.mod h1:8C0jb7/mgJe/9KK8Lm7X9ctZC2t60YyIpYEI16jx0Qg=
github.com/googleapis/gax-go v2.0.0+incompatible/go.mod h1:SFVmujtThgffbyetf+mdk2eWhX2bMyUtNHzFKcPA9HY=
github.com/googleapis/gax-go/v2 v2.0.3/go.mod h1:LLvjysVCY1JZeum8Z6l8qUty8fiNwE08qbEPm1M08qg=
github.com/googleapis/gax-go/v2 v2.0.4/go.mod h1:0Wqv26UfaUD9n4G6kQubkQ+KchISgw+vpHVxEJEs9eg=
github.com/googleapis/gax-go/v2 v2.0.5/go.mod h1:DWXyrwAJ9X0FpwwEdw+IPEYBICEFu5mhpdKc/us6bOk=
github.com/googleapis/gax-go/v2 v2.7.0 h1:IcsPKeInNvYi7eqSaDjiZqDDKu5rsmunY0Y1YupQSSQ=
github.com/googleapis/gax-go/v2 v2.7.0/go.mod h1:TEop28CZZQ2y+c0VxMUmu1lV+fQx57QpBWsYpwqHJx8=
github.com/googleapis/gnostic v0.4.1/go.mod h1:LRhVm6pbyptWbWbuZ38d1eyptfvIytN3ir6b65WBswg=
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
github.com/gopherjs/gopherjs v0.0.0-20211111143520-d0d5ecc1a356/go.mod h1:cz9oNYuRUWGdHmLF2IodMLkAhcPtXeULvcBNagUrxTI=
Expand Down Expand Up @@ -1275,8 +1286,9 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
github.com/stretchr/objx v0.2.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.3.0/go.mod h1:qt09Ya8vawLte6SNmTgCsAVtYtaKzEcn8ATUoHMkEqE=
github.com/stretchr/objx v0.4.0 h1:M2gUjqZET1qApGOWNSnZ49BAIMX4F/1plDv3+l31EJ4=
github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw=
github.com/stretchr/objx v0.5.0 h1:1zr/of2m5FGMsad5YfcqgdqdWrIhu+EBEJRhR1U7z/c=
github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo=
github.com/stretchr/testify v0.0.0-20180303142811-b89eecf5ca5d/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
Expand All @@ -1285,8 +1297,9 @@ github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/stretchr/testify v1.8.0 h1:pSgiaMZlXftHpm5L7V1+rVB+AZJydKsMxsQBIJw4PKk=
github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU=
github.com/stretchr/testify v1.8.1 h1:w7B6lhMri9wdJUVmEZPGGhZzrYTPvgJArz7wNPgYKsk=
github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4=
github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw=
github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
github.com/syndtr/gocapability v0.0.0-20180916011248-d98352740cb2/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww=
Expand Down Expand Up @@ -1399,6 +1412,8 @@ go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.4/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
go.opencensus.io v0.22.5/go.mod h1:5pWMHQbX5EPX2/62yrJeAkowc+lfs/XD7Uxpq3pI6kk=
go.opencensus.io v0.23.0/go.mod h1:XItmlyltB5F7CS4xOC1DcqMoFqwtC6OG2xF7mCv7P7E=
go.opencensus.io v0.24.0 h1:y73uSU6J157QMP2kn2r30vwW1A2W2WFwSCGnAVxeaD0=
go.opencensus.io v0.24.0/go.mod h1:vNK8G9p7aAivkbmorf4v+7Hgx+Zs0yY+0fOtgBfjQKo=
go.opentelemetry.io/otel v0.11.0/go.mod h1:G8UCk+KooF2HLkgo8RHX9epABH/aRGYET7gQOqBVdB0=
go.opentelemetry.io/proto/otlp v0.7.0/go.mod h1:PqfVotwruBrMGOCsRd/89rSnXhoiJIqeYNgFYFoEGnI=
go.uber.org/atomic v1.3.2/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
Expand Down Expand Up @@ -1831,6 +1846,7 @@ golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8T
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 h1:H2TDz8ibqkAF6YGhCdN3jS9O0/s90v0rJh3X/OLHEUk=
gonum.org/v1/gonum v0.0.0-20180816165407-929014505bf4/go.mod h1:Y+Yx5eoAFn32cQvJDxZx5Dpnq+c3wtXuadVZAcxbbBo=
gonum.org/v1/gonum v0.8.2/go.mod h1:oe/vMfY3deqTw+1EZJhuvEW2iwGF1bW9wwu7XCu0+v0=
gonum.org/v1/gonum v0.9.3/go.mod h1:TZumC3NeyVQskjXqmyWt4S3bINhy7B4eYwW69EbyX+0=
Expand Down Expand Up @@ -1868,6 +1884,8 @@ google.golang.org/api v0.48.0/go.mod h1:71Pr1vy+TAZRPkPs/xlCf5SsU8WjuAWv1Pfjbtuk
google.golang.org/api v0.50.0/go.mod h1:4bNT5pAuq5ji4SRZm+5QIkjny9JAyVD/3gaSihNefaw=
google.golang.org/api v0.51.0/go.mod h1:t4HdrdoNgyN5cbEfm7Lum0lcLDLiise1F8qDKX00sOU=
google.golang.org/api v0.54.0/go.mod h1:7C4bFFOvVDGXjfDTAsgGwDgAxRDeQ4X8NvUedIt6z3k=
google.golang.org/api v0.103.0 h1:9yuVqlu2JCvcLg9p8S3fcFLZij8EPSyvODIY1rkMizQ=
google.golang.org/api v0.103.0/go.mod h1:hGtW6nK1AC+d9si/UBhw8Xli+QMOf6xyNAyJw4qU9w0=
google.golang.org/appengine v1.0.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
google.golang.org/appengine v1.2.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
Expand Down
19 changes: 13 additions & 6 deletions plugin.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"id": "com.mattermost.mscalendar",
"name": "Microsoft Calendar",
"description": "Microsoft Calendar Integration",
"homepage_url": "https://mattermost.gitbook.io/plugin-mscalendar",
"support_url": "https://github.com/mattermost/mattermost-plugin-mscalendar/issues",
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-mscalendar/releases/tag/v1.2.1",
"id": "com.mattermost.gcal",
"name": "Google Calendar",
"description": "Google Calendar Integration",
"homepage_url": "https://github.com/mattermost/mattermost-plugin-gcal",
"support_url": "https://github.com/mattermost/mattermost-plugin-gcal/issues",
"release_notes_url": "https://github.com/mattermost/mattermost-plugin-gcal/releases/tag/v1.0.0",
"icon_path": "assets/profile.svg",
"version": "1.2.1",
"min_server_version": "6.3.0",
Expand Down Expand Up @@ -91,6 +91,13 @@
"help_text": "Microsoft Office Client Secret.",
"placeholder": "",
"default": ""
},
{
"key": "GoogleDomainVerifyKey",
"display_name": "Google domain verify key",
"type": "text",
"help_text": "This should look something like \"googlebd09b1075898e210.html\"",
"default": ""
}
]
}
Expand Down
22 changes: 22 additions & 0 deletions server/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
package api

import (
"net/http"
"strings"

"github.com/mattermost/mattermost-plugin-mscalendar/server/config"
"github.com/mattermost/mattermost-plugin-mscalendar/server/mscalendar"
"github.com/mattermost/mattermost-plugin-mscalendar/server/utils/httputils"
Expand Down Expand Up @@ -32,4 +35,23 @@ func Init(h *httputils.Handler, env mscalendar.Env, notificationProcessor mscale
postActionRouter.HandleFunc(config.PathTentative, api.postActionTentative).Methods("POST")
postActionRouter.HandleFunc(config.PathRespond, api.postActionRespond).Methods("POST")
postActionRouter.HandleFunc(config.PathConfirmStatusChange, api.postActionConfirmStatusChange).Methods("POST")

notificationRouter.HandleFunc("/{fname}", func(w http.ResponseWriter, r *http.Request) {
if api.GoogleDomainVerifyKey == "" {
w.WriteHeader(http.StatusInternalServerError)
w.Write([]byte("Domain verify key is not set"))
return
}

parts := strings.Split(r.URL.Path, "/")
fname := parts[len(parts)-1]
if fname != api.GoogleDomainVerifyKey {
w.WriteHeader(http.StatusBadRequest)
w.Write([]byte("Incorrect file name requested"))
return
}

resp := "google-site-verification: " + api.GoogleDomainVerifyKey
w.Write([]byte(resp))
})
}
10 changes: 7 additions & 3 deletions server/command/connect_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"fmt"
"testing"

"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -30,8 +31,11 @@ func TestConnect(t *testing.T) {
mscal := m.(*mock_mscalendar.MockMSCalendar)
mscal.EXPECT().GetRemoteUser("user_id").Return(&remote.User{Mail: "[email protected]"}, nil).Times(1)
},
expectedOutput: "Your Mattermost account is already connected to Microsoft Calendar account `[email protected]`. To connect to a different account, first run `/mscalendar disconnect`.",
expectedError: "",
expectedOutput: fmt.Sprintf(
"Your Mattermost account is already connected to %s account `[email protected]`. To connect to a different account, first run `/%s disconnect`.",
config.ApplicationName, config.CommandTrigger,
),
expectedError: "",
},
{
name: "user not connected",
Expand Down Expand Up @@ -59,7 +63,7 @@ func TestConnect(t *testing.T) {
command := Command{
Context: &plugin.Context{},
Args: &model.CommandArgs{
Command: "/mscalendar " + tc.command,
Command: fmt.Sprintf("/%s %s", config.CommandTrigger, tc.command),
UserId: "user_id",
},
ChannelID: "channel_id",
Expand Down
7 changes: 4 additions & 3 deletions server/command/disconnect_test.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package command

import (
"fmt"
"testing"

"github.com/golang/mock/gomock"
Expand Down Expand Up @@ -42,7 +43,7 @@ func TestDisconnect(t *testing.T) {
mscal.EXPECT().GetRemoteUser("user_id").Return(&remote.User{}, errors.New("some error")).Times(1)
},
expectedOutput: "",
expectedError: "Command /mscalendar disconnect failed: some error",
expectedError: fmt.Sprintf("Command /%s disconnect failed: some error", config.CommandTrigger),
},
{
name: "disconnect failed",
Expand All @@ -53,7 +54,7 @@ func TestDisconnect(t *testing.T) {
mscal.EXPECT().DisconnectUser("user_id").Return(errors.New("some error")).Times(1)
},
expectedOutput: "",
expectedError: "Command /mscalendar disconnect failed: some error",
expectedError: fmt.Sprintf("Command /%s disconnect failed: some error", config.CommandTrigger),
},
{
name: "disconnect successful",
Expand Down Expand Up @@ -82,7 +83,7 @@ func TestDisconnect(t *testing.T) {
command := Command{
Context: &plugin.Context{},
Args: &model.CommandArgs{
Command: "/mscalendar " + tc.command,
Command: fmt.Sprintf("/%s %s", config.CommandTrigger, tc.command),
UserId: "user_id",
},
ChannelID: "channel_id",
Expand Down
1 change: 1 addition & 0 deletions server/command/help.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ func (c *Command) help(parameters ...string) (string, bool, error) {
}
resp += getCommandText(desc)
}

return resp, false, nil
}

Expand Down
6 changes: 6 additions & 0 deletions server/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ type StoredConfig struct {
bot.Config
EnableStatusSync bool
EnableDailySummary bool

GoogleDomainVerifyKey string
}

// Config represents the the metadata handed to all request runners (command,
Expand All @@ -27,3 +29,7 @@ type Config struct {
PluginVersion string
StoredConfig
}

func (c *Config) GetNotificationURL() string {
return c.PluginURL + FullPathEventNotification
}
Loading