mirror of
https://github.com/hcengineering/platform.git
synced 2026-09-30 13:35:04 +02:00
UBERF-7959: Fix async issues (#6409)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<script lang="ts">
|
||||
import { AttachedDoc, Ref, WithLookup } from '@hcengineering/core'
|
||||
import { GithubIntegration, GithubIntegrationRepository, GithubProject } from '@hcengineering/github'
|
||||
import { getMetadata } from '@hcengineering/platform'
|
||||
import presentation, { NavLink, getClient, isAdminUser } from '@hcengineering/presentation'
|
||||
import MessageBox from '@hcengineering/presentation/src/components/MessageBox.svelte'
|
||||
@@ -19,7 +20,6 @@
|
||||
showPopup
|
||||
} from '@hcengineering/ui'
|
||||
import { ObjectPresenter } from '@hcengineering/view-resources'
|
||||
import { GithubIntegration, GithubIntegrationRepository, GithubProject } from '@hcengineering/github'
|
||||
import github from '../plugin'
|
||||
import ConnectProject from './ConnectProject.svelte'
|
||||
import { githubLanguageColors } from './languageColors'
|
||||
@@ -85,21 +85,15 @@
|
||||
},
|
||||
{ total: true, limit: 1 }
|
||||
)
|
||||
showPopup(
|
||||
MessageBox,
|
||||
{
|
||||
label: github.string.UnlinkRepository,
|
||||
message: github.string.UnlinkMessage,
|
||||
params: { repositoryName: repository.name, prjName: prj.name, total: issuesQuery.total },
|
||||
richMessage: true
|
||||
},
|
||||
undefined,
|
||||
async (res) => {
|
||||
if (res === true) {
|
||||
void disconnect(prj, repository)
|
||||
}
|
||||
showPopup(MessageBox, {
|
||||
label: github.string.UnlinkRepository,
|
||||
message: github.string.UnlinkMessage,
|
||||
params: { repositoryName: repository.name, prjName: prj.name, total: issuesQuery.total },
|
||||
richMessage: true,
|
||||
action: async () => {
|
||||
await disconnect(prj, repository)
|
||||
}
|
||||
)
|
||||
})
|
||||
}
|
||||
|
||||
$: repos = asRepos(integration.$lookup?.repositories ?? [])
|
||||
@@ -165,24 +159,18 @@
|
||||
kind={'dangerous'}
|
||||
label={github.string.RemoveInstallation}
|
||||
on:click={() => {
|
||||
showPopup(
|
||||
MessageBox,
|
||||
{
|
||||
label: github.string.UnlinkInstallationTitle,
|
||||
message: github.string.UnlinkInstallation,
|
||||
params: {},
|
||||
richMessage: true
|
||||
},
|
||||
undefined,
|
||||
async (res) => {
|
||||
if (res !== null) {
|
||||
await sendGHServiceRequest('installation-remove', {
|
||||
installationId: integration.installationId,
|
||||
token: getMetadata(presentation.metadata.Token) ?? ''
|
||||
})
|
||||
}
|
||||
showPopup(MessageBox, {
|
||||
label: github.string.UnlinkInstallationTitle,
|
||||
message: github.string.UnlinkInstallation,
|
||||
params: {},
|
||||
richMessage: true,
|
||||
action: async () => {
|
||||
await sendGHServiceRequest('installation-remove', {
|
||||
installationId: integration.installationId,
|
||||
token: getMetadata(presentation.metadata.Token) ?? ''
|
||||
})
|
||||
}
|
||||
)
|
||||
})
|
||||
}}
|
||||
/>
|
||||
</svelte:fragment>
|
||||
|
||||
@@ -434,7 +434,7 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for comments, so let's update marks
|
||||
const tx = derivedClient.apply('comments_github')
|
||||
const tx = derivedClient.apply('comments_github' + project._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -402,7 +402,7 @@ export abstract class IssueSyncManagerBase {
|
||||
return true
|
||||
})
|
||||
|
||||
const updateTodos = this.client.apply('todos')
|
||||
const updateTodos = this.client.apply('todos' + account)
|
||||
for (const [k, v] of Object.entries(todos)) {
|
||||
await updateTodos.updateDoc(time.class.ToDo, time.space.ToDos, k as Ref<ToDo>, {
|
||||
doneOn: v ? Date.now() : null
|
||||
|
||||
@@ -1302,7 +1302,7 @@ export class PullRequestSyncManager extends IssueSyncManagerBase implements DocS
|
||||
)
|
||||
}
|
||||
|
||||
const tx = derivedClient.apply('pullrequests_github')
|
||||
const tx = derivedClient.apply('pullrequests_github' + prj._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { derivedVersion: githubDerivedSyncVersion })
|
||||
}
|
||||
|
||||
@@ -560,7 +560,7 @@ export class ReviewCommentSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for reviews, so let's update marks
|
||||
const tx = derivedClient.apply('reviews_github')
|
||||
const tx = derivedClient.apply('reviews_github' + project._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
): Promise<void> {
|
||||
if (kind === 'externalVersion') {
|
||||
// No need to perform external sync for review threads, so let's update marks
|
||||
const tx = derivedClient.apply('review_threads_github')
|
||||
const tx = derivedClient.apply('review_threads_github' + prj._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
@@ -545,7 +545,7 @@ export class ReviewThreadSyncManager implements DocSyncManager {
|
||||
{ reviewThreadId: ext.id }
|
||||
)
|
||||
}
|
||||
const tx = derivedClient.apply('reviewThread_github')
|
||||
const tx = derivedClient.apply('reviewThread_github' + prj._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { derivedVersion: githubDerivedSyncVersion })
|
||||
}
|
||||
|
||||
@@ -473,7 +473,7 @@ export class ReviewSyncManager implements DocSyncManager {
|
||||
project: GithubProject
|
||||
): Promise<void> {
|
||||
// No need to perform external sync for reviews, so let's update marks
|
||||
const tx = derivedClient.apply('reviews_github')
|
||||
const tx = derivedClient.apply('reviews_github' + project._id)
|
||||
for (const d of syncDocs) {
|
||||
await tx.update(d, { externalVersion: githubExternalSyncVersion })
|
||||
}
|
||||
|
||||
@@ -299,7 +299,7 @@ export async function deleteObjects (
|
||||
objects: Doc[],
|
||||
account: Ref<Account>
|
||||
): Promise<void> {
|
||||
const ops = client.apply('delete')
|
||||
const ops = client.apply('delete' + account)
|
||||
for (const object of objects) {
|
||||
if (client.getHierarchy().isDerived(object._class, core.class.AttachedDoc)) {
|
||||
const adoc = object as AttachedDoc
|
||||
|
||||
Reference in New Issue
Block a user