UBERF-8425: Global accounts (#7573)

This commit is contained in:
Alexey Zinoviev
2025-02-04 10:31:03 +07:00
committed by GitHub
parent 83e5b16392
commit 2c64ceadb8
765 changed files with 19134 additions and 17955 deletions
@@ -1,5 +1,4 @@
import { Analytics } from '@hcengineering/analytics'
import { PersonAccount } from '@hcengineering/contact'
import core, {
AnyAttribute,
Class,
@@ -107,10 +106,14 @@ export class ProjectsSyncManager implements DocSyncManager {
return { needSync: githubSyncVersion }
}
const okit = await this.provider.getOctokit(container.project.createdBy as Ref<PersonAccount>)
if (container.project.createdBy === undefined) {
return
}
const okit = await this.provider.getOctokit(container.project.createdBy)
if (okit === undefined) {
this.ctx.info('No Authentication for author, waiting for authentication.', {
workspace: this.provider.getWorkspaceId().name
workspace: this.provider.getWorkspaceId()
})
return { needSync: githubSyncVersion, error: 'Need authentication for user' }
}
@@ -270,8 +273,7 @@ export class ProjectsSyncManager implements DocSyncManager {
const allAttributes = this.client.getHierarchy().getAllAttributes(tracker.class.Milestone)
const platformUpdate = collectUpdate<Milestone>(previousData, existingMilestone, Array.from(allAttributes.keys()))
const okit =
(await this.provider.getOctokit(existing.modifiedBy as Ref<PersonAccount>)) ?? container.container.octokit
const okit = (await this.provider.getOctokit(existing.modifiedBy)) ?? container.container.octokit
// Remove current same values from update
for (const [k, v] of Object.entries(update)) {
@@ -322,7 +324,7 @@ export class ProjectsSyncManager implements DocSyncManager {
if (project === undefined || repository === undefined) {
this.ctx.error('Unable to find project and repository for event', {
name: event.repository.name,
workspace: this.provider.getWorkspaceId().name
workspace: this.provider.getWorkspaceId()
})
return
}
@@ -392,10 +394,10 @@ export class ProjectsSyncManager implements DocSyncManager {
continue
}
const okit = await this.provider.getOctokit(integration.integration.createdBy as Ref<PersonAccount>)
const okit = await this.provider.getOctokit(integration.integration.createdBy)
if (okit === undefined) {
this.ctx.info('No Authentication for author, waiting for authentication.', {
workspace: this.provider.getWorkspaceId().name
workspace: this.provider.getWorkspaceId()
})
continue
}