filter out blocked user or me from the results

This commit is contained in:
taehoon 2019-04-02 14:01:21 -04:00
parent 69f9ea987c
commit 60b07eeaa4

View file

@ -1,3 +1,4 @@
import reject from 'lodash/reject'
import BlockCard from '../block_card/block_card.vue' import BlockCard from '../block_card/block_card.vue'
import userSearchApi from '../../services/new_api/user_search.js' import userSearchApi from '../../services/new_api/user_search.js'
@ -27,9 +28,12 @@ export default {
this.results = [] this.results = []
if (query) { if (query) {
userSearchApi.search({query, store: this.$store}) userSearchApi.search({query, store: this.$store})
.then((data) => { .then((users) => {
this.$store.dispatch('addNewUsers', data) const filteredUsers = reject(users, (user) => {
this.results = data return user.statusnet_blocking || user.id === this.$store.state.users.currentUser.id
})
this.$store.dispatch('addNewUsers', filteredUsers)
this.results = filteredUsers
this.resultsVisible = true this.resultsVisible = true
}) })
} }