Skip to content

Commit

Permalink
buildWritingUsersSubtitleInfo()
Browse files Browse the repository at this point in the history
  • Loading branch information
nkonev committed Jan 24, 2025
1 parent 4f00835 commit e3890d6
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions frontend/src/ChatView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit e3890d6

Please sign in to comment.