From 25dce5679a3ca4fc2f7cf34ed8c696dd08d04057 Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 19 Nov 2025 22:03:25 +0100 Subject: [PATCH 1/2] fix(NcAvatar): do no request avatar image if icon slot provided Signed-off-by: Maksim Sukharev --- src/components/NcAvatar/NcAvatar.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/NcAvatar/NcAvatar.vue b/src/components/NcAvatar/NcAvatar.vue index 71cbc8f36e..0f34c6566b 100644 --- a/src/components/NcAvatar/NcAvatar.vue +++ b/src/components/NcAvatar/NcAvatar.vue @@ -781,7 +781,7 @@ export default { this.isAvatarLoaded = false /** Only run avatar image loading if either user or url property is defined */ - if (!this.isUrlDefined && (!this.isUserDefined || this.isNoUser || this.iconClass)) { + if (!this.isUrlDefined && (!this.isUserDefined || this.isNoUser || this.iconClass || this.$slots.icon)) { this.isAvatarLoaded = true this.userDoesNotExist = true return From 121baddef3d75f462be0d8f1afa392e47b7f2bbd Mon Sep 17 00:00:00 2001 From: Maksim Sukharev Date: Wed, 19 Nov 2025 22:03:52 +0100 Subject: [PATCH 2/2] fix(NcAvatar): set preloaded user status if explicitly provided Signed-off-by: Maksim Sukharev --- src/components/NcAvatar/NcAvatar.vue | 8 ++++---- src/mixins/userStatus.js | 24 +++++++++++++++--------- 2 files changed, 19 insertions(+), 13 deletions(-) diff --git a/src/components/NcAvatar/NcAvatar.vue b/src/components/NcAvatar/NcAvatar.vue index 0f34c6566b..c42d7253ea 100644 --- a/src/components/NcAvatar/NcAvatar.vue +++ b/src/components/NcAvatar/NcAvatar.vue @@ -713,12 +713,12 @@ export default { if (!this.preloadedUserStatus) { this.fetchUserStatus(this.user) } else { - this.userStatus.status = this.preloadedUserStatus.status || '' - this.userStatus.message = this.preloadedUserStatus.message || '' - this.userStatus.icon = this.preloadedUserStatus.icon || '' - this.hasStatus = this.preloadedUserStatus.status !== null + this.setUserStatus(this.preloadedUserStatus) } subscribe('user_status:status.updated', this.handleUserStatusUpdated) + } else if (!this.hideStatus && this.preloadedUserStatus) { + // Always set preloaded status if provided + this.setUserStatus(this.preloadedUserStatus) } }, diff --git a/src/mixins/userStatus.js b/src/mixins/userStatus.js index dc987b75e8..0fafff62a0 100644 --- a/src/mixins/userStatus.js +++ b/src/mixins/userStatus.js @@ -44,15 +44,7 @@ export default { try { const { data } = await axios.get(generateOcsUrl('apps/user_status/api/v1/statuses/{userId}', { userId })) - const { - status, - message, - icon, - } = data.ocs.data - this.userStatus.status = status - this.userStatus.message = message || '' - this.userStatus.icon = icon || '' - this.hasStatus = true + this.setUserStatus(data.ocs.data) } catch (e) { if (e.response.status === 404 && e.response.data.ocs?.data?.length === 0) { // User just has no status set, so don't log it @@ -61,5 +53,19 @@ export default { logger.error('Failed to fetch user status', { error: e }) } }, + + /** + * Sets the user status + * + * @param {string} status user's status + * @param {string} message user's message + * @param {string} icon user's icon + */ + setUserStatus({ status, message, icon }) { + this.userStatus.status = status || '' + this.userStatus.message = message || '' + this.userStatus.icon = icon || '' + this.hasStatus = !!status + }, }, }