From 67b85691b8b5bb060c8b2072e59d07e76255ee56 Mon Sep 17 00:00:00 2001 From: Pranav C Date: Wed, 10 Jan 2024 13:52:25 +0000 Subject: [PATCH] fix: include base user list when createdBy / lastModifiedBy column is enabled --- packages/nc-gui/components/cell/User.vue | 12 ------------ .../nocodb/src/services/public-metas.service.ts | 13 +++++++++++-- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/packages/nc-gui/components/cell/User.vue b/packages/nc-gui/components/cell/User.vue index ae2a559969..4eac73c484 100644 --- a/packages/nc-gui/components/cell/User.vue +++ b/packages/nc-gui/components/cell/User.vue @@ -82,18 +82,6 @@ const { isUIAllowed } = useRoles() const options = computed(() => { const collaborators: UserFieldRecordType[] = [] - // todo: it's a temporary fix to display users in shared view based on the modelValue. Usually it should be rendered based on the baseUsers but at the moment baseUsers not avail in shared view - if (!baseUsers.value?.length && readOnly.value && modelValue) { - collaborators.push( - ...(((Array.isArray(modelValue) ? modelValue : [modelValue]) as any[]).map((user) => ({ - id: user.id, - email: user.email, - display_name: user.display_name, - })) as any), - ) - return collaborators - } - collaborators.push( ...(baseUsers.value?.map((user: any) => ({ id: user.id, diff --git a/packages/nocodb/src/services/public-metas.service.ts b/packages/nocodb/src/services/public-metas.service.ts index 192d2f38a3..04150639cf 100644 --- a/packages/nocodb/src/services/public-metas.service.ts +++ b/packages/nocodb/src/services/public-metas.service.ts @@ -1,5 +1,10 @@ import { Injectable } from '@nestjs/common'; -import { ErrorMessages, RelationTypes, UITypes } from 'nocodb-sdk'; +import { + ErrorMessages, + isCreatedOrLastModifiedByCol, + RelationTypes, + UITypes, +} from 'nocodb-sdk'; import { isLinksOrLTAR } from 'nocodb-sdk'; import type { LinkToAnotherRecordColumn, LookupColumn } from '~/models'; import { NcError } from '~/helpers/catchError'; @@ -69,7 +74,11 @@ export class PublicMetasService { view.relatedMetas = relatedMetas; - if (view.model.columns.some((c) => c.uidt === UITypes.User)) { + if ( + view.model.columns.some( + (c) => c.uidt === UITypes.User || isCreatedOrLastModifiedByCol(c), + ) + ) { const baseUsers = await BaseUser.getUsersList({ base_id: view.model.base_id, });