diff --git a/services/calendar/pod-calendar/src/auth.ts b/services/calendar/pod-calendar/src/auth.ts index 3e99cdf332..05d621a4ea 100644 --- a/services/calendar/pod-calendar/src/auth.ts +++ b/services/calendar/pod-calendar/src/auth.ts @@ -62,7 +62,7 @@ export class AuthController { const mutex = await lock(`${state.workspace}:${state.userId}`) try { const client = await getClient(getWorkspaceToken(state.workspace)) - const txOp = new TxOperations(client, core.account.System) + const txOp = new TxOperations(client, state.userId) const controller = new AuthController(ctx, accountClient, txOp, state) await controller.process(code) } finally { @@ -106,6 +106,7 @@ export class AuthController { private async signout (value: GoogleEmail): Promise { const integration = await this.client.findOne(setting.class.Integration, { type: calendar.integrationType.Calendar, + createdBy: this.user.userId, value }) if (integration !== undefined) { diff --git a/services/calendar/pod-calendar/src/calendarController.ts b/services/calendar/pod-calendar/src/calendarController.ts index d554edb994..61597e4e30 100644 --- a/services/calendar/pod-calendar/src/calendarController.ts +++ b/services/calendar/pod-calendar/src/calendarController.ts @@ -97,6 +97,8 @@ export class CalendarController { } async pushEvent (workspace: WorkspaceUuid, event: Event, type: 'create' | 'update' | 'delete'): Promise { - await WorkspaceClient.push(this.ctx, this.accountClient, workspace, event, type) + if (event.access === 'owner' || event.access === 'writer') { + await WorkspaceClient.push(this.ctx, this.accountClient, workspace, event, type) + } } } diff --git a/services/calendar/pod-calendar/src/sync.ts b/services/calendar/pod-calendar/src/sync.ts index dbee3ed539..60d6f4f15f 100644 --- a/services/calendar/pod-calendar/src/sync.ts +++ b/services/calendar/pod-calendar/src/sync.ts @@ -201,6 +201,7 @@ export class IncomingSyncManager { const res = await this.googleClient.events.list({ calendarId, syncToken, + eventTypes: ['default'], pageToken, showDeleted: syncToken != null }) @@ -553,8 +554,7 @@ export class IncomingSyncManager { private async getMyCalendars (): Promise { this.calendars = await this.client.findAll(calendar.class.ExternalCalendar, { - createdBy: this.user.userId, - hidden: false + createdBy: this.user.userId }) } @@ -620,7 +620,7 @@ export class IncomingSyncManager { default: false } if (val.primary === true) { - const primaryExists = this.calendars.length > 0 + const primaryExists = this.calendars.find((p) => p.default) if (primaryExists === undefined) { data.default = true }