make blocking functional in the search results

This commit is contained in:
taehoon 2019-04-02 13:49:48 -04:00
parent fd4289e45a
commit 69f9ea987c
3 changed files with 7 additions and 3 deletions

View File

@ -1,11 +1,11 @@
import BasicUserCard from '../basic_user_card/basic_user_card.vue'
import BlockCard from '../block_card/block_card.vue'
import userSearchApi from '../../services/new_api/user_search.js'
const debounceMilliseconds = 500
export default {
components: {
BasicUserCard
BlockCard
},
data () {
return {
@ -28,6 +28,7 @@ export default {
if (query) {
userSearchApi.search({query, store: this.$store})
.then((data) => {
this.$store.dispatch('addNewUsers', data)
this.results = data
this.resultsVisible = true
})

View File

@ -2,7 +2,7 @@
<div class="user-autosuggest" v-click-outside="onClickOutside">
<input v-model="query" placeholder="Search whom you want to block" @click="onInputClick" class="user-autosuggest-input" />
<div class="user-autosuggest-results" v-if="resultsVisible">
<BasicUserCard v-for="user in results" :key="user.id" :user="user"/>
<BlockCard v-for="user in results" :key="user.id" :userId="user.id"/>
</div>
</div>
</template>

View File

@ -281,6 +281,9 @@ const users = {
unregisterPushNotifications(token)
},
addNewUsers ({ commit }, users) {
commit('addNewUsers', users)
},
addNewStatuses (store, { statuses }) {
const users = map(statuses, 'user')
const retweetedUsers = compact(map(statuses, 'retweeted_status.user'))