From e3890d60a581ef12c032e94a6eb989881cf91b88 Mon Sep 17 00:00:00 2001 From: Nikita Konev Date: Fri, 24 Jan 2025 05:23:05 +0300 Subject: [PATCH] buildWritingUsersSubtitleInfo() --- frontend/src/ChatView.vue | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/frontend/src/ChatView.vue b/frontend/src/ChatView.vue index 91560eae0..3fc4ba71c 100644 --- a/frontend/src/ChatView.vue +++ b/frontend/src/ChatView.vue @@ -596,13 +596,18 @@ export default { } const idx = this.writingUsers.findIndex(value => value.login === data.login); - if (idx !== -1) { + if (idx !== -1) { // update this.writingUsers[idx].timestamp = + new Date(); - } else { + } else { // add this.writingUsers.push({timestamp: +new Date(), login: data.login}) } - this.chatStore.usersWritingSubtitleInfo = this.writingUsers.map(v=>v.login).join(', ') + " " + this.$vuetify.locale.t('$vuetify.user_is_writing'); + this.buildWritingUsersSubtitleInfo(); + }, + buildWritingUsersSubtitleInfo() { + if (this.writingUsers.length) { + this.chatStore.usersWritingSubtitleInfo = this.writingUsers.map(v => v.login).join(', ') + " " + this.$vuetify.locale.t('$vuetify.user_is_writing'); + } }, onUserBroadcast(dto) { console.log("onUserBroadcast", dto); @@ -960,6 +965,8 @@ export default { this.writingUsers = this.writingUsers.filter(value => (value.timestamp + 1*1000) > curr); if (this.writingUsers.length == 0) { this.chatStore.usersWritingSubtitleInfo = null; + } else { + this.buildWritingUsersSubtitleInfo(); } }, 500);