From bb9fe034ce693f9c224ee392860d4efcfe83b291 Mon Sep 17 00:00:00 2001 From: rob Date: Tue, 23 Apr 2024 20:02:45 -0400 Subject: [PATCH] quick fix --- client/js/chat-client.js | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/client/js/chat-client.js b/client/js/chat-client.js index 95f806e..59ff8eb 100644 --- a/client/js/chat-client.js +++ b/client/js/chat-client.js @@ -63,6 +63,10 @@ export class ChatApp extends DtpApp { this.emojiPicker.addEventListener('emoji-click', this.onEmojiPicked.bind(this)); } + this.pendingFiles = { + images: [ ], + videos: [ ], + }; this.dragFeedback = document.querySelector('.dtp-drop-feedback'); window.addEventListener('dtp-load', this.onDtpLoad.bind(this)); @@ -274,7 +278,7 @@ export class ChatApp extends DtpApp { // set focus back to chat input this.chat.imageFiles.value = null; - this.chat.videoFile = null; + this.chat.videoFile.value = null; this.chat.input.focus(); this.chat.sendButton.setAttribute('disabled', ''); @@ -365,7 +369,9 @@ export class ChatApp extends DtpApp { async onChatMessage (message) { const isAtBottom = this.chat.isAtBottom; this.chat.messageList.insertAdjacentHTML('beforeend', message.html); - this.audio.playSound(ChatApp.SFX_CHAT_MESSAGE); + if (!this.haveFocus) { + this.audio.playSound(ChatApp.SFX_CHAT_MESSAGE); + } this.scrollChatToBottom(isAtBottom); if (!this.haveFocus && (this.notificationPermission === 'granted')) {