mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-30 03:39:39 +02:00
UBERF-8053: Github fixes (#6554)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -11,14 +11,14 @@ import core, {
|
||||
Ref,
|
||||
TxOperations
|
||||
} from '@hcengineering/core'
|
||||
import { EmptyMarkup } from '@hcengineering/text'
|
||||
import { LiveQuery } from '@hcengineering/query'
|
||||
import github, {
|
||||
DocSyncInfo,
|
||||
GithubIntegrationRepository,
|
||||
GithubProject,
|
||||
GithubReviewThread
|
||||
} from '@hcengineering/github'
|
||||
import { LiveQuery } from '@hcengineering/query'
|
||||
import { EmptyMarkup } from '@hcengineering/text'
|
||||
import {
|
||||
ContainerFocus,
|
||||
DocSyncManager,
|
||||
@@ -35,7 +35,7 @@ import {
|
||||
getUpdatedAtReviewThread,
|
||||
reviewThreadDetails
|
||||
} from './githubTypes'
|
||||
import { collectUpdate, deleteObjects, errorToObj, isGHWriteAllowed, syncDerivedDocuments } from './utils'
|
||||
import { collectUpdate, deleteObjects, errorToObj, isGHWriteAllowed, syncChilds, syncDerivedDocuments } from './utils'
|
||||
|
||||
import { Analytics } from '@hcengineering/analytics'
|
||||
import { PullRequestReviewThreadEvent } from '@octokit/webhooks-types'
|
||||
@@ -266,11 +266,11 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
return {}
|
||||
}
|
||||
if (parent === undefined) {
|
||||
return { needSync: '' }
|
||||
return { needSync: githubSyncVersion }
|
||||
}
|
||||
if (info.external === undefined) {
|
||||
// TODO: Use selected repository
|
||||
const repo = container.repository.find((it) => it._id === parent?.repository)
|
||||
const repo = await this.provider.getRepositoryById(parent?.repository)
|
||||
if (repo?.nodeId === undefined) {
|
||||
// No need to sync if parent repository is not defined.
|
||||
return { needSync: githubSyncVersion }
|
||||
@@ -305,6 +305,9 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
if (existing === undefined) {
|
||||
try {
|
||||
await this.createReviewThread(info, messageData, parent, review, account)
|
||||
|
||||
// We need trigger comments, if their sync data created before
|
||||
await syncChilds(info, this.client, derivedClient)
|
||||
return { needSync: githubSyncVersion, current: messageData }
|
||||
} catch (err: any) {
|
||||
this.ctx.error('Error', { err })
|
||||
@@ -327,7 +330,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
account: Ref<Account>,
|
||||
derivedClient: TxOperations
|
||||
): Promise<void> {
|
||||
const repository = container.repository.find((it) => it._id === info.repository)
|
||||
const repository = await this.provider.getRepositoryById(info.repository)
|
||||
if (repository === undefined) {
|
||||
return
|
||||
}
|
||||
@@ -422,7 +425,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
derivedClient: TxOperations
|
||||
): Promise<DocumentUpdate<DocSyncInfo>> {
|
||||
// TODO: Use selected repository
|
||||
const repo = container.repository.find((it) => it._id === parent?.repository)
|
||||
const repo = await this.provider.getRepositoryById(parent?.repository)
|
||||
if (repo?.nodeId === undefined) {
|
||||
// No need to sync if parent repository is not defined.
|
||||
return { needSync: githubSyncVersion }
|
||||
|
||||
Reference in New Issue
Block a user