Browse Source

fix: group by and copy for RO user fields

pull/7373/head
mertmit 12 months ago
parent
commit
8d00d85a31
  1. 14
      packages/nc-gui/composables/useMultiSelect/index.ts
  2. 8
      packages/nc-gui/composables/useViewGroupBy.ts

14
packages/nc-gui/composables/useMultiSelect/index.ts

@ -113,12 +113,14 @@ export function useMultiSelect(
}
if ([UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(columnObj.uidt as UITypes)) {
if (textToCopy && Array.isArray(textToCopy)) {
textToCopy = textToCopy
.map((user: UserFieldRecordType) => {
return user.email
})
.join(', ')
if (textToCopy) {
textToCopy = Array.isArray(textToCopy)
? textToCopy
: [textToCopy]
.map((user: UserFieldRecordType) => {
return user.email
})
.join(', ')
}
}

8
packages/nc-gui/composables/useViewGroupBy.ts

@ -164,8 +164,12 @@ export const useViewGroupBy = (view: Ref<ViewType | undefined>, where?: Computed
} 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(',')})`
} catch (e) {}
acc += `${acc.length ? '~and' : ''}(${curr.title},gb_eq,${(Array.isArray(value) ? value : [value])
.map((v: any) => v.id)
.join(',')})`
} catch (e) {
console.error(e)
}
} else {
acc += `${acc.length ? '~and' : ''}(${curr.title},gb_eq,${curr.key})`
}

Loading…
Cancel
Save