mirror of
https://github.com/hcengineering/platform.git
synced 2026-08-30 19:59:47 +02:00
UBERF-8425: Global accounts (#7573)
This commit is contained in:
@@ -63,7 +63,7 @@
|
||||
function onConnect (): void {
|
||||
const state = btoa(
|
||||
JSON.stringify({
|
||||
accountId: getCurrentAccount()._id,
|
||||
accountId: getCurrentAccount().primarySocialId,
|
||||
op: 'installation',
|
||||
workspace: $location.path[1],
|
||||
token: getMetadata(presentation.metadata.Token)
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Account, Ref } from '@hcengineering/core'
|
||||
import { PersonId } from '@hcengineering/core'
|
||||
import ui, { Label, Location, Spinner, Button, location } from '@hcengineering/ui'
|
||||
import { onDestroy } from 'svelte'
|
||||
import github from '../plugin'
|
||||
@@ -52,12 +52,8 @@
|
||||
}
|
||||
|
||||
const rawState = JSON.parse(atob(state))
|
||||
const {
|
||||
accountId,
|
||||
op,
|
||||
workspace,
|
||||
token
|
||||
}: { accountId: Ref<Account>, workspace: string, op: string, token: string } = rawState
|
||||
const { accountId, op, workspace, token }: { accountId: PersonId, workspace: string, op: string, token: string } =
|
||||
rawState
|
||||
|
||||
if (op === 'installation') {
|
||||
if (installationId == null || setupAction === null) {
|
||||
|
||||
+3
-6
@@ -3,12 +3,11 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import { Ref, WithLookup } from '@hcengineering/core'
|
||||
import { WithLookup } from '@hcengineering/core'
|
||||
import { GithubPullRequestReviewState, GithubReview } from '@hcengineering/github'
|
||||
|
||||
import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources'
|
||||
import { Person, PersonAccount } from '@hcengineering/contact'
|
||||
import { personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
|
||||
import { personByPersonIdStore } from '@hcengineering/contact-resources'
|
||||
import { IntlString } from '@hcengineering/platform'
|
||||
import { MessageViewer } from '@hcengineering/presentation'
|
||||
import { isEmptyMarkup } from '@hcengineering/text'
|
||||
@@ -23,9 +22,7 @@
|
||||
export let embedded: boolean = false
|
||||
export let onClick: (() => void) | undefined = undefined
|
||||
|
||||
$: personAccount = $personAccountByIdStore.get((value?.createdBy ?? value?.modifiedBy) as Ref<PersonAccount>)
|
||||
|
||||
$: person = $personByIdStore.get(personAccount?.person as Ref<Person>)
|
||||
$: person = $personByPersonIdStore.get(value?.createdBy ?? value?.modifiedBy)
|
||||
|
||||
function getCommentFromState (value?: GithubPullRequestReviewState): {
|
||||
label: IntlString
|
||||
|
||||
+7
-9
@@ -3,12 +3,12 @@
|
||||
//
|
||||
-->
|
||||
<script lang="ts">
|
||||
import core, { Account, Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
|
||||
import core, { PersonId, Ref, WithLookup, getCurrentAccount } from '@hcengineering/core'
|
||||
import { GithubPullRequest, GithubReviewComment, GithubReviewThread } from '@hcengineering/github'
|
||||
|
||||
import { ActivityMessageHeader, ActivityMessageTemplate } from '@hcengineering/activity-resources'
|
||||
import { Person, PersonAccount } from '@hcengineering/contact'
|
||||
import { EmployeePresenter, personAccountByIdStore, personByIdStore } from '@hcengineering/contact-resources'
|
||||
import { Person } from '@hcengineering/contact'
|
||||
import { EmployeePresenter, personByPersonIdStore } from '@hcengineering/contact-resources'
|
||||
import { getEmbeddedLabel } from '@hcengineering/platform'
|
||||
import { createQuery, getClient } from '@hcengineering/presentation'
|
||||
import { ReferenceInput } from '@hcengineering/text-editor-resources'
|
||||
@@ -26,8 +26,7 @@
|
||||
export let embedded: boolean = false
|
||||
export let onClick: (() => void) | undefined = undefined
|
||||
|
||||
$: personAccount = $personAccountByIdStore.get((value?.createdBy ?? value?.modifiedBy) as Ref<PersonAccount>)
|
||||
$: person = $personByIdStore.get(personAccount?.person as Ref<Person>)
|
||||
$: person = $personByPersonIdStore.get(value?.createdBy ?? value?.modifiedBy)
|
||||
|
||||
const commentsQuery = createQuery()
|
||||
|
||||
@@ -71,11 +70,11 @@
|
||||
if (value.isResolved) {
|
||||
await getClient().update(value, { isResolved: false, resolvedBy: null })
|
||||
} else {
|
||||
await getClient().update(value, { isResolved: true, resolvedBy: getCurrentAccount()._id })
|
||||
await getClient().update(value, { isResolved: true, resolvedBy: getCurrentAccount().primarySocialId })
|
||||
}
|
||||
}
|
||||
|
||||
const toRefPersonAccount = (account: Ref<Account>): Ref<PersonAccount> => account as Ref<PersonAccount>
|
||||
const toRefPersonAccount = (account: PersonId): PersonId => account
|
||||
const toRefPerson = (account?: Ref<Person>): Ref<Person> => account as Ref<Person>
|
||||
</script>
|
||||
|
||||
@@ -142,8 +141,7 @@
|
||||
/>
|
||||
{/if}
|
||||
{#if value.isResolved && value.resolvedBy != null}
|
||||
{@const resolveAccount = $personAccountByIdStore.get(toRefPersonAccount(value.resolvedBy))}
|
||||
{@const resolvePerson = $personByIdStore.get(toRefPerson(resolveAccount?.person))}
|
||||
{@const resolvePerson = $personByPersonIdStore.get(value.resolvedBy)}
|
||||
{#if resolvePerson !== undefined}
|
||||
<div class="flex-row-center ml-4">
|
||||
<Label label={getEmbeddedLabel('resolved by')} />
|
||||
|
||||
+3
-10
@@ -1,21 +1,14 @@
|
||||
<script lang="ts">
|
||||
import { Person, PersonAccount } from '@hcengineering/contact'
|
||||
import {
|
||||
EmployeePresenter,
|
||||
SystemAvatar,
|
||||
personAccountByIdStore,
|
||||
personByIdStore
|
||||
} from '@hcengineering/contact-resources'
|
||||
import { EmployeePresenter, SystemAvatar, personByPersonIdStore } from '@hcengineering/contact-resources'
|
||||
import Avatar from '@hcengineering/contact-resources/src/components/Avatar.svelte'
|
||||
import core, { Ref, getDisplayTime } from '@hcengineering/core'
|
||||
import core, { getDisplayTime } from '@hcengineering/core'
|
||||
import { MessageViewer } from '@hcengineering/presentation'
|
||||
import { Label } from '@hcengineering/ui'
|
||||
import { GithubReviewComment } from '@hcengineering/github'
|
||||
|
||||
export let comment: GithubReviewComment
|
||||
|
||||
$: personAccount = $personAccountByIdStore.get((comment?.createdBy ?? comment?.modifiedBy) as Ref<PersonAccount>)
|
||||
$: person = $personByIdStore.get(personAccount?.person as Ref<Person>)
|
||||
$: person = $personByPersonIdStore.get(comment?.createdBy ?? comment?.modifiedBy)
|
||||
</script>
|
||||
|
||||
{#if comment}
|
||||
|
||||
@@ -13,10 +13,9 @@ import { get, writable } from 'svelte/store'
|
||||
import github from '../plugin'
|
||||
|
||||
export async function onAuthorize (login?: string): Promise<void> {
|
||||
const meId = getCurrentAccount()._id
|
||||
const state = btoa(
|
||||
JSON.stringify({
|
||||
accountId: meId,
|
||||
accountId: getCurrentAccount().primarySocialId,
|
||||
workspace: get(location).path[1],
|
||||
token: getMetadata(presentation.metadata.Token),
|
||||
op: 'authorize'
|
||||
|
||||
Reference in New Issue
Block a user