Browse Source

fix: include base user list when createdBy / lastModifiedBy column is enabled

pull/7401/head
Pranav C 12 months ago
parent
commit
67b85691b8
  1. 12
      packages/nc-gui/components/cell/User.vue
  2. 13
      packages/nocodb/src/services/public-metas.service.ts

12
packages/nc-gui/components/cell/User.vue

@ -82,18 +82,6 @@ const { isUIAllowed } = useRoles()
const options = computed<UserFieldRecordType[]>(() => { const options = computed<UserFieldRecordType[]>(() => {
const collaborators: UserFieldRecordType[] = [] 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( collaborators.push(
...(baseUsers.value?.map((user: any) => ({ ...(baseUsers.value?.map((user: any) => ({
id: user.id, id: user.id,

13
packages/nocodb/src/services/public-metas.service.ts

@ -1,5 +1,10 @@
import { Injectable } from '@nestjs/common'; 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 { isLinksOrLTAR } from 'nocodb-sdk';
import type { LinkToAnotherRecordColumn, LookupColumn } from '~/models'; import type { LinkToAnotherRecordColumn, LookupColumn } from '~/models';
import { NcError } from '~/helpers/catchError'; import { NcError } from '~/helpers/catchError';
@ -69,7 +74,11 @@ export class PublicMetasService {
view.relatedMetas = relatedMetas; 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({ const baseUsers = await BaseUser.getUsersList({
base_id: view.model.base_id, base_id: view.model.base_id,
}); });

Loading…
Cancel
Save