From 42bb34821908430cdfdbad827567049e3bf22b22 Mon Sep 17 00:00:00 2001 From: Henry Jameson Date: Thu, 13 Dec 2018 15:34:51 +0300 Subject: [PATCH] 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. --- src/components/user_profile/user_profile.vue | 18 ++++++++++++++++++ src/modules/users.js | 5 ++++- 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/user_profile/user_profile.vue b/src/components/user_profile/user_profile.vue index 91d4acd2..4d2853a6 100644 --- a/src/components/user_profile/user_profile.vue +++ b/src/components/user_profile/user_profile.vue @@ -3,6 +3,16 @@
+
+
+
+ {{ $t('settings.profile_tab') }} +
+
+
+ +
+
@@ -21,4 +31,12 @@ align-items: stretch; } } +.user-profile-placeholder { + .panel-body { + display: flex; + justify-content: center; + align-items: middle; + padding: 7em; + } +} diff --git a/src/modules/users.js b/src/modules/users.js index 6d966c3b..97e1a318 100644 --- a/src/modules/users.js +++ b/src/modules/users.js @@ -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')