Skip to content

Commit

Permalink
Don't show auth user in search results
Browse files Browse the repository at this point in the history
  • Loading branch information
Dimi Mikadze committed Nov 16, 2019
1 parent 2c124e9 commit 7c5859d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion api/resolvers/user.js
Expand Up @@ -239,7 +239,7 @@ const Query = {
*
* @param {string} searchQuery
*/
searchUsers: async (root, { searchQuery }, { User }) => {
searchUsers: async (root, { searchQuery }, { User, authUser }) => {
// Return an empty array if searchQuery isn't presented
if (!searchQuery) {
return [];
Expand All @@ -250,6 +250,9 @@ const Query = {
{ username: new RegExp(searchQuery, 'i') },
{ fullName: new RegExp(searchQuery, 'i') },
],
_id: {
$ne: authUser.id,
},
}).limit(50);

return users;
Expand Down

0 comments on commit 7c5859d

Please sign in to comment.