diff options
author | Carl Schwan <carl@carlschwan.eu> | 2022-04-05 18:28:52 +0200 |
---|---|---|
committer | Carl Schwan <carl@carlschwan.eu> | 2022-04-05 19:28:06 +0200 |
commit | ddc739b5ac2bb5f54fdb47db6a3e0dfe83d1c473 (patch) | |
tree | f54f75fe1b0d1f58c503e907e1f083889d951e6a /apps | |
parent | 9c84aa5870204a871024ca18b4994ed40defdd9b (diff) | |
download | nextcloud-server-ddc739b5ac2bb5f54fdb47db6a3e0dfe83d1c473.tar.gz nextcloud-server-ddc739b5ac2bb5f54fdb47db6a3e0dfe83d1c473.zip |
Retrieve user status only once when displaying page
We don't need to inject it in the template if the data is already
available in the initial state. This is also a bit cleaner.
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/user_status/src/menu.js | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/apps/user_status/src/menu.js b/apps/user_status/src/menu.js index 98ec1ff06df..c8d007d98a0 100644 --- a/apps/user_status/src/menu.js +++ b/apps/user_status/src/menu.js @@ -27,6 +27,7 @@ import { getRequestToken } from '@nextcloud/auth' import UserStatus from './UserStatus' import store from './store' import Avatar from '@nextcloud/vue/dist/Components/Avatar' +import { loadState } from '@nextcloud/initial-state' // eslint-disable-next-line camelcase __webpack_nonce__ = btoa(getRequestToken()) @@ -35,11 +36,12 @@ Vue.prototype.t = t Vue.prototype.$t = t const avatarDiv = document.getElementById('avatardiv-menu') +const userStatusData = loadState('user_status', 'status') const propsData = { preloadedUserStatus: { - message: avatarDiv.dataset.userstatus_message, - icon: avatarDiv.dataset.userstatus_icon, - status: avatarDiv.dataset.userstatus, + message: userStatusData.message, + icon: userStatusData.icon, + status: userStatusData.status }, user: avatarDiv.dataset.user, displayName: avatarDiv.dataset.displayname, |