mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-07 18:27:44 +02:00
Calendar fixes (#9240)
Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
@@ -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<void> {
|
||||
const integration = await this.client.findOne(setting.class.Integration, {
|
||||
type: calendar.integrationType.Calendar,
|
||||
createdBy: this.user.userId,
|
||||
value
|
||||
})
|
||||
if (integration !== undefined) {
|
||||
|
||||
@@ -97,6 +97,8 @@ export class CalendarController {
|
||||
}
|
||||
|
||||
async pushEvent (workspace: WorkspaceUuid, event: Event, type: 'create' | 'update' | 'delete'): Promise<void> {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<void> {
|
||||
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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user