diff --git a/.vscode/launch.json b/.vscode/launch.json index 0293949e6f..206a326e45 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -97,7 +97,7 @@ "MODEL_JSON": "${workspaceRoot}/models/all/bundle/model.json", // "SERVER_PROVIDER":"uweb" "SERVER_PROVIDER": "ws", - "MODEL_VERSION": "0.7.331", + "MODEL_VERSION": "0.7.343", // "version": "0.7.0", "COMMUNICATION_API_ENABLED": "true", "ELASTIC_INDEX_NAME": "local_storage_index", diff --git a/foundations/core/packages/core/src/classes.ts b/foundations/core/packages/core/src/classes.ts index f00b9ba387..579bfaaba9 100644 --- a/foundations/core/packages/core/src/classes.ts +++ b/foundations/core/packages/core/src/classes.ts @@ -944,6 +944,7 @@ export type SocialKey = Pick export interface ClassCollaborators extends Doc { attachedTo: Ref> + allFields?: boolean // for all (PersonId | Ref | PersonId[] | Ref[]) attributes fields: (keyof T)[] // PersonId | Ref | PersonId[] | Ref[] provideSecurity?: boolean // If true, will provide security for collaborators } diff --git a/models/card/src/index.ts b/models/card/src/index.ts index 6eee4435c1..42241d89f6 100644 --- a/models/card/src/index.ts +++ b/models/card/src/index.ts @@ -38,6 +38,7 @@ import core, { AccountRole, type Blobs, type Class, + type ClassCollaborators, ClassifierKind, type CollectionSize, type Doc, @@ -860,6 +861,12 @@ export function createModel (builder: Builder): void { }) createPublicLinkAction(builder, card.class.Card, card.action.PublicLink) + + builder.createDoc>(core.class.ClassCollaborators, core.space.Model, { + attachedTo: card.class.Card, + fields: ['modifiedBy'], + allFields: true + }) } function defineTabs (builder: Builder): void { diff --git a/models/core/src/core.ts b/models/core/src/core.ts index 89525e01b3..29fa90e9c7 100644 --- a/models/core/src/core.ts +++ b/models/core/src/core.ts @@ -413,6 +413,7 @@ export class TCustomSequence extends TSequence implements CustomSequence { @Model(core.class.ClassCollaborators, core.class.Doc, DOMAIN_MODEL) export class TClassCollaborators extends TDoc implements ClassCollaborators { attachedTo!: Ref> + allFields?: boolean fields!: (keyof Doc)[] provideSecurity?: boolean } diff --git a/models/view/src/index.ts b/models/view/src/index.ts index a3d3306b72..e92af38b33 100644 --- a/models/view/src/index.ts +++ b/models/view/src/index.ts @@ -1367,6 +1367,10 @@ export function createModel (builder: Builder): void { searchDisabled: true }) + builder.mixin(core.class.TypePersonId, core.class.Class, view.mixin.AttributeEditor, { + inlineEditor: view.component.PersonIdPresenter + }) + builder.mixin(core.class.TypePersonId, core.class.Class, view.mixin.AttributePresenter, { presenter: view.component.PersonIdPresenter, arrayPresenter: view.component.PersonArrayEditor diff --git a/plugins/card-resources/src/components/CardAttributes.svelte b/plugins/card-resources/src/components/CardAttributes.svelte index 4d59d49106..b847b20692 100644 --- a/plugins/card-resources/src/components/CardAttributes.svelte +++ b/plugins/card-resources/src/components/CardAttributes.svelte @@ -17,11 +17,11 @@ import { PermissionsStore } from '@hcengineering/contact' import { permissionsStore } from '@hcengineering/contact-resources' import core, { AnyAttribute, Class, Doc, Ref, toRank, TypedSpace } from '@hcengineering/core' + import notification from '@hcengineering/notification' import { AttributeBarEditor, createQuery, getClient, - getFiltredKeys, isCollectionAttr, KeyedAttribute } from '@hcengineering/presentation' @@ -29,11 +29,12 @@ export let object: Card export let _class: Ref> - export let to: Ref> | undefined = core.class.Doc + export let to: Ref> | undefined = core.class.Obj export let ignoreKeys: string[] = [] export let readonly = false export let showHeader: boolean = true export let fourRows: boolean = false + export let showCollaborators: boolean = false const client = getClient() const hierarchy = client.getHierarchy() @@ -41,14 +42,18 @@ let keys: KeyedAttribute[] = [] function updateKeys (_class: Ref>, ignoreKeys: string[], to: Ref> | undefined): void { - const filtredKeys = getFiltredKeys(hierarchy, _class, ignoreKeys, to) - keys = filtredKeys - .filter((key) => !isCollectionAttr(hierarchy, key)) - .sort((a, b) => { - const rankA = a.attr.rank ?? toRank(a.attr._id) ?? '' - const rankB = b.attr.rank ?? toRank(b.attr._id) ?? '' - return rankA.localeCompare(rankB) - }) + const filtredKeys = [...hierarchy.getAllAttributes(_class, to).entries()] + .filter( + ([key, value]) => + value.hidden !== true && !ignoreKeys.includes(key) && !isCollectionAttr(hierarchy, { key, attr: value }) + ) + .map(([key, attr]) => ({ key, attr })) + + keys = filtredKeys.sort((a, b) => { + const rankA = a.attr.rank ?? toRank(a.attr._id) ?? '' + const rankB = b.attr.rank ?? toRank(b.attr._id) ?? '' + return rankA.localeCompare(rankB) + }) } $: updateKeys(_class, ignoreKeys, to) @@ -75,6 +80,17 @@ on:update /> {/each} + {#if showCollaborators} + + {/if}