mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-26 22:32:23 +02:00
QFIX: Github migration + few checks (#9244)
Signed-off-by: Andrey Sobolev <haiodo@gmail.com>
This commit is contained in:
@@ -328,16 +328,19 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
if (Object.keys(platformUpdate).length > 0) {
|
||||
// Check and update body with external
|
||||
const okit = (await this.provider.getOctokit(existing.modifiedBy)) ?? container.container.octokit
|
||||
await okit?.rest.issues.updateComment({
|
||||
owner: repository.owner?.login as string,
|
||||
repo: repository.name,
|
||||
issue_number: parent.githubNumber,
|
||||
comment_id: comment.id,
|
||||
body: await this.provider.getMarkdown(existingComment.message),
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
})
|
||||
const mdown = await this.provider.getMarkdown(existingComment.message)
|
||||
if (mdown.trim().length > 0) {
|
||||
await okit?.rest.issues.updateComment({
|
||||
owner: repository.owner?.login as string,
|
||||
repo: repository.name,
|
||||
issue_number: parent.githubNumber,
|
||||
comment_id: comment.id,
|
||||
body: mdown,
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
if (Object.keys(update).length > 0) {
|
||||
await this.client.update(existing, update, false, new Date(comment.updated_at).getTime(), account)
|
||||
@@ -400,24 +403,29 @@ export class CommentSyncManager implements DocSyncManager {
|
||||
|
||||
// No external version yet, create it.
|
||||
try {
|
||||
const result = await okit?.rest.issues.createComment({
|
||||
owner: repo.owner?.login as string,
|
||||
repo: repo.name,
|
||||
issue_number: parent.githubNumber,
|
||||
body: await this.provider.getMarkdown(chatMessage.message),
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
const mdown = await this.provider.getMarkdown(chatMessage.message)
|
||||
if (mdown.trim().length > 0) {
|
||||
const result = await okit?.rest.issues.createComment({
|
||||
owner: repo.owner?.login as string,
|
||||
repo: repo.name,
|
||||
issue_number: parent.githubNumber,
|
||||
body: mdown,
|
||||
headers: {
|
||||
'X-GitHub-Api-Version': '2022-11-28'
|
||||
}
|
||||
})
|
||||
|
||||
const upd: DocumentUpdate<DocSyncInfo> = {
|
||||
parent: (result?.data.html_url?.split('#')?.[0] ?? '').toLowerCase(),
|
||||
url: (result?.data.url ?? '').toLowerCase(),
|
||||
external: result?.data as CommentExternalData,
|
||||
current: result?.data,
|
||||
repository: repo._id
|
||||
}
|
||||
})
|
||||
const upd: DocumentUpdate<DocSyncInfo> = {
|
||||
parent: (result?.data.html_url?.split('#')?.[0] ?? '').toLowerCase(),
|
||||
url: (result?.data.url ?? '').toLowerCase(),
|
||||
external: result?.data as CommentExternalData,
|
||||
current: result?.data,
|
||||
repository: repo._id
|
||||
|
||||
// We need to update in current promise, to prevent event changes.
|
||||
await derivedClient.update(info, upd)
|
||||
}
|
||||
// We need to update in current promise, to prevent event changes.
|
||||
await derivedClient.update(info, upd)
|
||||
return {}
|
||||
} catch (err: any) {
|
||||
Analytics.handleError(err)
|
||||
|
||||
@@ -99,7 +99,7 @@ export abstract class IssueSyncManagerBase {
|
||||
// Find Assignees and reviewers
|
||||
const assignees: PersonId[] = []
|
||||
|
||||
for (const o of issue.assignees.nodes ?? []) {
|
||||
for (const o of issue.assignees?.nodes ?? []) {
|
||||
const acc = await this.provider.getAccount(o)
|
||||
if (acc !== undefined) {
|
||||
assignees.push(acc)
|
||||
|
||||
Reference in New Issue
Block a user