Browse Source

fix: review changes

pull/7413/head
Ramesh Mane 10 months ago
parent
commit
8ef48356d0
  1. 4
      packages/nc-gui/components/project/AccessSettings.vue
  2. 4
      packages/nc-gui/components/workspace/CollaboratorsList.vue
  3. 28
      packages/nocodb/src/models/User.ts

4
packages/nc-gui/components/project/AccessSettings.vue

@ -42,9 +42,7 @@ const accessibleRoles = ref<(typeof ProjectRoles)[keyof typeof ProjectRoles][]>(
const filteredCollaborators = computed(() =>
collaborators.value.filter((collab) =>
collab.display_name
? collab.display_name.toLowerCase().includes(userSearchText.value.toLowerCase())
: collab.email.toLowerCase().includes(userSearchText.value.toLowerCase()),
(collab.display_name || collab.email).toLowerCase().includes(userSearchText.value.toLowerCase()),
),
)

4
packages/nc-gui/components/workspace/CollaboratorsList.vue

@ -20,9 +20,7 @@ const filterCollaborators = computed(() => {
if (!collaborators.value) return []
return collaborators.value.filter((collab) =>
collab.display_name
? collab.display_name.toLowerCase().includes(userSearchText.value.toLowerCase())
: collab.email.toLowerCase().includes(userSearchText.value.toLowerCase()),
(collab.display_name || collab.email).toLowerCase().includes(userSearchText.value.toLowerCase()),
)
})

28
packages/nocodb/src/models/User.ts

@ -194,7 +194,7 @@ export default class User implements UserType {
{
limit,
offset,
query,
query = '',
}: {
limit?: number | undefined;
offset?: number | undefined;
@ -229,25 +229,17 @@ export default class User implements UserType {
.as('projectsCount'),
);
if (query) {
queryBuilder
.where(function () {
this.where('email', 'like', `%${query.toLowerCase?.()}%`).orWhere(
'display_name',
'like',
`%${query.toLowerCase?.()}%`,
);
})
.where(function () {
queryBuilder.where(function () {
this.where(function () {
this.whereNotNull('display_name')
.andWhereNot('display_name', '')
.andWhere('display_name', 'like', `%${query.toLowerCase()}%`);
}).orWhere(function () {
this.where(function () {
this.whereNotNull('display_name')
.andWhereNot('display_name', '')
.andWhere('display_name', 'like', `%${query.toLowerCase?.()}%`);
}).orWhere(function () {
this.whereNull('display_name')
.orWhere('display_name', '')
.andWhere('email', 'like', `%${query.toLowerCase?.()}%`);
});
this.whereNull('display_name').orWhere('display_name', '');
}).andWhere('email', 'like', `%${query.toLowerCase()}%`);
});
});
}
return queryBuilder;

Loading…
Cancel
Save