Browse Source

fix(nc-gui): allow user to search members by email as well as username (#8289)

* fix(nc-gui): allow user to search members by email as well as username

* fix(nocodb): oss allow user to search members by email as well as username
pull/8292/head
Ramesh Mane 7 months ago committed by GitHub
parent
commit
4263acbdc4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 6
      packages/nc-gui/components/project/AccessSettings.vue
  2. 6
      packages/nc-gui/components/workspace/CollaboratorsList.vue
  3. 4
      packages/nocodb/src/models/User.ts

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

@ -43,8 +43,10 @@ const isSearching = ref(false)
const accessibleRoles = ref<(typeof ProjectRoles)[keyof typeof ProjectRoles][]>([]) const accessibleRoles = ref<(typeof ProjectRoles)[keyof typeof ProjectRoles][]>([])
const filteredCollaborators = computed(() => const filteredCollaborators = computed(() =>
collaborators.value.filter((collab) => collaborators.value.filter(
(collab.display_name || collab.email).toLowerCase().includes(userSearchText.value.toLowerCase()), (collab) =>
collab.display_name?.toLowerCase()?.includes(userSearchText.value.toLowerCase()) ||
collab.email.toLowerCase().includes(userSearchText.value.toLowerCase()),
), ),
) )

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

@ -19,8 +19,10 @@ const filterCollaborators = computed(() => {
if (!collaborators.value) return [] if (!collaborators.value) return []
return collaborators.value.filter((collab) => return collaborators.value.filter(
(collab.display_name || collab.email).toLowerCase().includes(userSearchText.value.toLowerCase()), (collab) =>
collab.display_name.toLowerCase().includes(userSearchText.value.toLowerCase()) ||
collab.email.toLowerCase().includes(userSearchText.value.toLowerCase()),
) )
}) })

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

@ -243,9 +243,7 @@ export default class User implements UserType {
.andWhereNot('display_name', '') .andWhereNot('display_name', '')
.andWhere('display_name', 'like', `%${query.toLowerCase()}%`); .andWhere('display_name', 'like', `%${query.toLowerCase()}%`);
}).orWhere(function () { }).orWhere(function () {
this.where(function () { this.where('email', 'like', `%${query.toLowerCase()}%`);
this.whereNull('display_name').orWhere('display_name', '');
}).andWhere('email', 'like', `%${query.toLowerCase()}%`);
}); });
}); });
} }

Loading…
Cancel
Save