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
1 changed files with 7 additions and 3 deletions

View File

@ -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
})
}