diff --git a/app/services/chat.js b/app/services/chat.js index aaa1fa5..81bcd9a 100644 --- a/app/services/chat.js +++ b/app/services/chat.js @@ -308,22 +308,15 @@ export default class ChatService extends SiteService { numeral(roomData.stats.presentCount).format('0,0'), ); - // const systemMessage = { - // created: NOW.toISOString(), - // content: `${member.displayName || member.username} has entered the room.`, - // }; - this.dtp.emitter .to(room._id.toString()) .emit('chat-control', { displayList, audio: { playSound: 'chat-room-connect' }, - // systemMessages: [systemMessage], }); } async chatRoomCheckOut (room, member) { - const NOW = new Date(); const roomData = await ChatRoom.findOneAndUpdate( { _id: room._id }, { @@ -359,12 +352,7 @@ export default class ChatService extends SiteService { numeral(roomData.stats.presentCount).format('0,0'), ); - const systemMessage = { - created: NOW.toISOString(), - content: `@${member.username} has connected to the room.`, - }; - - this.dtp.emitter.to(room._id.toString()).emit('chat-control', { displayList, systemMessages: [systemMessage] }); + this.dtp.emitter.to(room._id.toString()).emit('chat-control', { displayList }); } async sendRoomMessage (room, author, messageDefinition, imageFiles, videoFiles) { diff --git a/app/views/chat/room/view.pug b/app/views/chat/room/view.pug index 2d643cb..4e8d93c 100644 --- a/app/views/chat/room/view.pug +++ b/app/views/chat/room/view.pug @@ -68,7 +68,7 @@ block view-content a(href=`/chat/room/${room._id}/settings`, uk-tooltip={ title: 'Configure room settings' }).uk-link-reset i.fa-solid.fa-cog .uk-width-auto - a(href="/", uk-tooltip={ title: 'Leave room' }).uk-link-reset + a(href="/", uk-tooltip={ title: 'Return to home' }).uk-link-reset i.fa-solid.fa-person-through-window .chat-media diff --git a/client/js/chat-client.js b/client/js/chat-client.js index 75d5d31..95f806e 100644 --- a/client/js/chat-client.js +++ b/client/js/chat-client.js @@ -41,6 +41,8 @@ export class ChatApp extends DtpApp { messages: [ ], messageMenu: document.querySelector('.chat-message-menu'), input: document.querySelector('#chat-input-text'), + imageFiles: document.querySelector('#image-files'), + videoFile: document.querySelector('#video-file'), sendButton: document.querySelector('#chat-send-btn'), isAtBottom: true, }; @@ -253,7 +255,9 @@ export class ChatApp extends DtpApp { const content = this.chat.input.value; this.chat.input.value = ''; - if (content.length === 0) { + if ((content.length === 0) && + (!this.chat.imageFiles.value) && + (!this.chat.videoFile.value)) { return true; } @@ -269,13 +273,15 @@ export class ChatApp extends DtpApp { } // set focus back to chat input + this.chat.imageFiles.value = null; + this.chat.videoFile = null; this.chat.input.focus(); this.chat.sendButton.setAttribute('disabled', ''); this.chatTimeout = setTimeout(( ) => { delete this.chatTimeout; this.chat.sendButton.removeAttribute('disabled'); - }, 5000); + }, 1000); return true; }