From 60b07eeaa44bcfa99e90aa075cd18086d25ef194 Mon Sep 17 00:00:00 2001 From: taehoon Date: Tue, 2 Apr 2019 14:01:21 -0400 Subject: [PATCH] filter out blocked user or me from the results --- src/components/user_autosuggest/user_autosuggest.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/user_autosuggest/user_autosuggest.js b/src/components/user_autosuggest/user_autosuggest.js index 42914b36..c8332e34 100644 --- a/src/components/user_autosuggest/user_autosuggest.js +++ b/src/components/user_autosuggest/user_autosuggest.js @@ -1,3 +1,4 @@ +import reject from 'lodash/reject' import BlockCard from '../block_card/block_card.vue' import userSearchApi from '../../services/new_api/user_search.js' @@ -27,9 +28,12 @@ export default { this.results = [] if (query) { userSearchApi.search({query, store: this.$store}) - .then((data) => { - this.$store.dispatch('addNewUsers', data) - this.results = data + .then((users) => { + const filteredUsers = reject(users, (user) => { + return user.statusnet_blocking || user.id === this.$store.state.users.currentUser.id + }) + this.$store.dispatch('addNewUsers', filteredUsers) + this.results = filteredUsers this.resultsVisible = true }) }