diff --git a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue index 2be6fe5164..20c9215702 100644 --- a/packages/nc-gui/components/smartsheet/grid/GroupBy.vue +++ b/packages/nc-gui/components/smartsheet/grid/GroupBy.vue @@ -169,7 +169,7 @@ const parseKey = (group: Group) => { return [parseStringDateTime(key, timeFormats[0], false)] } - if (key && group.column?.uidt === UITypes.User) { + if (key && [UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(group.column?.uidt as UITypes)) { try { const parsedKey = JSON.parse(key) return [parsedKey] diff --git a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue index e48e4aa054..67837744fa 100644 --- a/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue +++ b/packages/nc-gui/components/smartsheet/toolbar/FilterInput.vue @@ -19,6 +19,7 @@ import { isPercent, isRating, isReadonlyDateTime, + isReadonlyUser, isSingleSelect, isTextArea, isTime, @@ -87,6 +88,7 @@ const checkTypeFunctions = { isTextArea, isLinks: (col: ColumnType) => col.uidt === UITypes.Links, isUser, + isReadonlyUser, } type FilterType = keyof typeof checkTypeFunctions @@ -155,6 +157,7 @@ const componentMap: Partial> = computed(() => { isFloat: Float, isLinks: Integer, isUser: User, + isReadonlyUser: User, } }) @@ -181,6 +184,12 @@ const componentProps = computed(() => { case 'isUser': { return { forceMulti: true } } + case 'isReadonlyUser': { + if (['anyof', 'nanyof'].includes(props.filter.comparison_op!)) { + return { forceMulti: true } + } + return {} + } default: { return {} } diff --git a/packages/nc-gui/composables/useMultiSelect/index.ts b/packages/nc-gui/composables/useMultiSelect/index.ts index 347f581bdf..e8974573e1 100644 --- a/packages/nc-gui/composables/useMultiSelect/index.ts +++ b/packages/nc-gui/composables/useMultiSelect/index.ts @@ -112,7 +112,7 @@ export function useMultiSelect( textToCopy = !!textToCopy } - if (columnObj.uidt === UITypes.User || columnObj.uidt === UITypes.CreatedBy || columnObj.uidt === UITypes.LastModifiedBy) { + if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(columnObj.uidt as UITypes)) { if (textToCopy && Array.isArray(textToCopy)) { textToCopy = textToCopy .map((user: UserFieldRecordType) => { diff --git a/packages/nc-gui/composables/useViewGroupBy.ts b/packages/nc-gui/composables/useViewGroupBy.ts index 46cf8c1c79..8574c84018 100644 --- a/packages/nc-gui/composables/useViewGroupBy.ts +++ b/packages/nc-gui/composables/useViewGroupBy.ts @@ -90,7 +90,7 @@ export const useViewGroupBy = (view: Ref, where?: Computed return value ? GROUP_BY_VARS.TRUE : GROUP_BY_VARS.FALSE } - if (col.uidt === UITypes.User || col.uidt === UITypes.CreatedBy || col.uidt === UITypes.LastModifiedBy) { + if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(col.uidt as UITypes)) { if (!value) { return GROUP_BY_VARS.NULL } @@ -161,11 +161,7 @@ export const useViewGroupBy = (view: Ref, where?: Computed acc += `${acc.length ? '~and' : ''}(${curr.title},${curr.key === GROUP_BY_VARS.TRUE ? 'checked' : 'notchecked'})` } else if ([UITypes.Date, UITypes.DateTime].includes(curr.column_uidt as UITypes)) { acc += `${acc.length ? '~and' : ''}(${curr.title},eq,exactDate,${curr.key})` - } else if ( - curr.column_uidt === UITypes.User || - curr.column_uidt === UITypes.CreatedBy || - curr.column_uidt === UITypes.LastModifiedBy - ) { + } else if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(curr.column_uidt as UITypes)) { try { const value = JSON.parse(curr.key) acc += `${acc.length ? '~and' : ''}(${curr.title},gb_eq,${value.map((v: any) => v.id).join(',')})` diff --git a/packages/nocodb/src/db/conditionV2.ts b/packages/nocodb/src/db/conditionV2.ts index 87de9140c6..d4a73afd62 100644 --- a/packages/nocodb/src/db/conditionV2.ts +++ b/packages/nocodb/src/db/conditionV2.ts @@ -458,6 +458,9 @@ const parseConditionV2 = async ( ) && ['like', 'nlike'].includes(filter.comparison_op) ) { + // get column name for CreatedBy, LastModifiedBy + column.column_name = await getColumnName(column); + const baseUsers = await BaseUser.getUsersList({ base_id: column.base_id, });