Fix fetching new users, add storing local users in usersObjects with their
screen_name as well as id, so that they could be fetched zero-state with screen-name link.
This commit is contained in:
parent
fb5261b926
commit
42bb348219
2 changed files with 22 additions and 1 deletions
|
@ -16,6 +16,9 @@ export const mergeOrAdd = (arr, obj, item) => {
|
|||
// This is a new item, prepare it
|
||||
arr.push(item)
|
||||
obj[item.id] = item
|
||||
if (item.screen_name && !item.screen_name.includes('@')) {
|
||||
obj[item.screen_name] = item
|
||||
}
|
||||
return {item, new: true}
|
||||
}
|
||||
}
|
||||
|
@ -78,7 +81,7 @@ const users = {
|
|||
actions: {
|
||||
fetchUser (store, id) {
|
||||
store.rootState.api.backendInteractor.fetchUser({id})
|
||||
.then((user) => store.commit('addNewUsers', user))
|
||||
.then((user) => store.commit('addNewUsers', [user]))
|
||||
},
|
||||
addNewStatuses (store, { statuses }) {
|
||||
const users = map(statuses, 'user')
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue