Fix github UI issues (#10684)

* Fix github UI issues

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Fix formatting

Signed-off-by: Artem Savchenko <armisav@gmail.com>

* Remove legacy project fields

Signed-off-by: Artem Savchenko <armisav@gmail.com>

---------

Signed-off-by: Artem Savchenko <armisav@gmail.com>
This commit is contained in:
Artyom Savchenko
2026-03-25 16:41:54 +07:00
committed by GitHub
parent 466935d26a
commit 0c397f654d
6 changed files with 22 additions and 30 deletions
@@ -1,7 +1,7 @@
<script lang="ts">
import { Analytics } from '@hcengineering/analytics'
import core, { ClassifierKind, Ref, WithLookup, generateId } from '@hcengineering/core'
import { getEmbeddedLabel, getMetadata, translate } from '@hcengineering/platform'
import core, { Ref, WithLookup, generateId } from '@hcengineering/core'
import { getMetadata, translate } from '@hcengineering/platform'
import { getClient } from '@hcengineering/presentation'
import task, { TaskType, updateProjectType, type TaskStatusFactory } from '@hcengineering/task'
import tracker, { Project, createStatesData } from '@hcengineering/tracker'
@@ -63,13 +63,6 @@
if (!client.getHierarchy().hasMixin(projectInst, github.mixin.GithubProject)) {
// We need to add GithubProject mixin
const mixinId = await getClient().createDoc(core.class.Mixin, core.space.Model, {
extends: github.mixin.GithubIssue,
kind: ClassifierKind.MIXIN,
label: getEmbeddedLabel(projectInst.name),
hidden: false,
icon: github.icon.Github
})
await getClient().createMixin(
projectInst._id,
tracker.class.Project,
@@ -77,9 +70,7 @@
github.mixin.GithubProject,
{
integration: integration._id,
repositories: [],
mixinClass: mixinId,
mappings: []
repositories: []
}
)
}
@@ -3,18 +3,17 @@
//
-->
<script lang="ts">
import { PersonAccount } from '@hcengineering/contact'
import { getCurrentAccount } from '@hcengineering/core'
import { createQuery, getClient, getFileUrl } from '@hcengineering/presentation'
import { Button, Chevron, Component, ExpandCollapse, Label } from '@hcengineering/ui'
import diffview from '@hcengineering/diffview'
import { GithubPatch, GithubPullRequest, GithubPullRequestReview } from '@hcengineering/github'
import github from '../plugin'
import { getCurrentEmployee } from '@hcengineering/contact'
export let pullRequest: GithubPullRequest
const me = getCurrentAccount() as PersonAccount
const me = getCurrentEmployee()
let isCollapsed = true
@@ -37,6 +36,7 @@
}
$: hasPatch = patch !== undefined && patchText !== ''
$: changedFilesCount = patchText === '' ? 0 : (patchText.match(/^diff --git /gm)?.length ?? 0)
let review: GithubPullRequestReview | undefined
@@ -46,7 +46,7 @@
github.class.GithubPullRequestReview,
{
attachedTo: pullRequest._id,
author: me.person
author: me
},
(res) => {
;[review] = res
@@ -60,7 +60,7 @@
async function handleFileViewed (fileName: string, sha: string, viewed: boolean): Promise<void> {
const current = await client.findOne(github.class.GithubPullRequestReview, {
attachedTo: pullRequest._id,
author: me.person
author: me
})
const files = current?.files ?? []
@@ -73,7 +73,7 @@
files.push({ fileName, sha })
}
if (current) {
if (current != null) {
await client.update(current, { files })
} else {
await client.addCollection(
@@ -82,7 +82,7 @@
pullRequest._id,
github.class.GithubPullRequest,
'reviewsVisual',
{ author: me.person, files }
{ author: me, files }
)
}
}
@@ -106,7 +106,7 @@
fill={'var(--caption-color)'}
marginRight={'.375rem'}
/>
<Label label={github.string.ChangedFiles} params={{ files: pullRequest.files }} />
<Label label={github.string.ChangedFiles} params={{ files: changedFilesCount }} />
</svelte:fragment>
</Button>
</div>
@@ -119,7 +119,7 @@
props={{ patch: patchText, viewed: viewedFiles }}
on:change={(evt) => {
const { fileName, sha, viewed } = evt.detail
handleFileViewed(fileName, sha, viewed)
void handleFileViewed(fileName, sha, viewed)
}}
/>
</div>
@@ -21,7 +21,7 @@
</script>
<HyperlinkEditor
value={repository?.repository?.html_url ?? repository?.htmlURL}
value={repository?.htmlURL ?? ''}
placeholder={getEmbeddedLabel(repository?.name ?? '')}
title={repository?.name ?? ''}
readonly
@@ -37,7 +37,7 @@
export let label: IntlString = github.string.AssignRepository
export let showIcon: boolean = false
$: repository = $integrationRepositories.get(value)
$: repository = value != null ? $integrationRepositories.get(value) : undefined
let selectedRepository: GithubIntegrationRepository | undefined
@@ -3,7 +3,7 @@
//
-->
<script lang="ts">
import core, { PersonId, Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
import core, { Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
import { GithubPullRequest, GithubReviewComment, GithubReviewThread } from '@hcengineering/github'
import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources'
@@ -82,8 +82,9 @@
}
}
const toRefPersonAccount = (account: PersonId): PersonId => account
const toRefPerson = (account?: Ref<Person>): Ref<Person> => account as Ref<Person>
function onDiffExpand (nextExpanded: boolean): void {
expanded = nextExpanded
}
</script>
<div
@@ -122,9 +123,7 @@
fileName: value.path,
expandable: value.isResolved,
expanded,
onExpand: (value) => {
expanded = value
}
onExpand: onDiffExpand
}}
/>
{/if}