filter outside of component
This commit is contained in:
parent
8af8f719e4
commit
da08388d6a
2 changed files with 17 additions and 3 deletions
|
@ -265,7 +265,10 @@ const Status = {
|
||||||
},
|
},
|
||||||
combinedFavsAndRepeatsAvatars () {
|
combinedFavsAndRepeatsAvatars () {
|
||||||
// Use the status from the global status repository since favs and repeats are saved in it
|
// Use the status from the global status repository since favs and repeats are saved in it
|
||||||
const combinedAvatars = [].concat(this.statusFromGlobalRepository.favoritedBy, this.statusFromGlobalRepository.rebloggedBy).filter(_ => _)
|
const combinedAvatars = [].concat(
|
||||||
|
this.statusFromGlobalRepository.favoritedBy,
|
||||||
|
this.statusFromGlobalRepository.rebloggedBy
|
||||||
|
)
|
||||||
return uniqBy(combinedAvatars, 'id')
|
return uniqBy(combinedAvatars, 'id')
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
|
@ -533,8 +533,19 @@ const statuses = {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
fetchFavsAndRepeats ({ rootState, commit }, id) {
|
fetchFavsAndRepeats ({ rootState, commit }, id) {
|
||||||
Promise.all([rootState.api.backendInteractor.fetchFavoritedByUsers(id), rootState.api.backendInteractor.fetchRebloggedByUsers(id)])
|
Promise.all([
|
||||||
.then(([favoritedByUsers, rebloggedByUsers]) => commit('addFavsAndRepeats', { id, favoritedByUsers, rebloggedByUsers }))
|
rootState.api.backendInteractor.fetchFavoritedByUsers(id),
|
||||||
|
rootState.api.backendInteractor.fetchRebloggedByUsers(id)
|
||||||
|
]).then(([favoritedByUsers, rebloggedByUsers]) =>
|
||||||
|
commit(
|
||||||
|
'addFavsAndRepeats',
|
||||||
|
{
|
||||||
|
id,
|
||||||
|
favoritedByUsers: favoritedByUsers.filter(_ => _),
|
||||||
|
rebloggedByUsers: rebloggedByUsers.filter(_ => _)
|
||||||
|
}
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mutations
|
mutations
|
||||||
|
|
Loading…
Reference in a new issue