From 556ebe45ee8d3c3a8c9c0b6ebd18f43cb36e616d Mon Sep 17 00:00:00 2001 From: Doljinsuren Enkhbayar Date: Thu, 4 Apr 2024 15:34:56 +0800 Subject: [PATCH] showed all users in organization --- addon/components/chat-window.hbs | 23 +++++++++++++++++++---- addon/components/chat-window.js | 17 ++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/addon/components/chat-window.hbs b/addon/components/chat-window.hbs index c54c417..6116717 100644 --- a/addon/components/chat-window.hbs +++ b/addon/components/chat-window.hbs @@ -4,9 +4,24 @@ {{n-a this.channel.name "Untitled Chat"}}
- + +
+
+ + {{#each this.participants as |participant|}} + +
+
+ +
+ {{participant.name}} +
+
+ {{/each}} + +
+
+
@@ -34,7 +49,7 @@
-
+
{{chatMessage.content}}
{{chatMessage.createdAgo}}
diff --git a/addon/components/chat-window.js b/addon/components/chat-window.js index 5182ef5..3234c87 100644 --- a/addon/components/chat-window.js +++ b/addon/components/chat-window.js @@ -6,9 +6,12 @@ import { action } from '@ember/object'; export default class ChatWindowComponent extends Component { @service chat; @service currentUser; + @service fetch; + @service store; @tracked channel; @tracked sender; @tracked senderIsCreator; + @tracked participants; @tracked pendingMessageContent = ''; constructor(owner, { channel }) { @@ -16,6 +19,7 @@ export default class ChatWindowComponent extends Component { this.channel = channel; this.sender = this.getSenderFromParticipants(channel); this.senderIsCreator = this.sender ? this.sender.id === channel.created_by_uuid : false; + this.participants = this.loadUsers() } @action sendMessage() { @@ -27,7 +31,18 @@ export default class ChatWindowComponent extends Component { this.chat.closeChannel(this.channel); } - @action addParticipant() {} + @action loadUsers() { + return this.store.query('driver', { limit: 25}); + } + + @action addParticipant(participant){ + console.log("Channels : ", this.channel, participant) + this.chat.addParticipant(this.channel, participant) + } + + @action removeParticipant(participant) { + this.chat.removeParticipant(this.channel, participant); + } @action positionWindow(chatWindowElement) { const chatWindowWidth = chatWindowElement.offsetWidth;