forked from AkkomaGang/akkoma-fe
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
|
@ -3,6 +3,16 @@
|
|||
<div v-if="user" class="user-profile panel panel-default">
|
||||
<user-card-content :user="user" :switcher="true" :selected="timeline.viewing"></user-card-content>
|
||||
</div>
|
||||
<div v-else class="panel user-profile-placeholder">
|
||||
<div class="panel-heading">
|
||||
<div class="title">
|
||||
{{ $t('settings.profile_tab') }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<i class="icon-spin3 animate-spin"></i>
|
||||
</div>
|
||||
</div>
|
||||
<Timeline :title="$t('user_profile.timeline_title')" :timeline="timeline" :timeline-name="'user'" :user-id="userId"/>
|
||||
</div>
|
||||
</template>
|
||||
|
@ -21,4 +31,12 @@
|
|||
align-items: stretch;
|
||||
}
|
||||
}
|
||||
.user-profile-placeholder {
|
||||
.panel-body {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: middle;
|
||||
padding: 7em;
|
||||
}
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -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…
Reference in a new issue