Calendar fixes (#9240)

Signed-off-by: Denis Bykhov <bykhov.denis@gmail.com>
This commit is contained in:
Denis Bykhov
2025-06-16 01:21:42 +07:00
committed by GitHub
parent e22395c779
commit 0334bd2b30
3 changed files with 8 additions and 5 deletions
+2 -1
View File
@@ -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)
}
}
}
+3 -3
View File
@@ -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
}