load room by url / +getRoom to matrixUtils
This commit is contained in:
parent
35e6bf86df
commit
3b70b5b37c
@ -7,3 +7,6 @@ export function calcUserName(userId){
|
|||||||
if (matrix.user === userId) return 'you';
|
if (matrix.user === userId) return 'you';
|
||||||
return matrix.client.getUser(userId).displayName || userId;
|
return matrix.client.getUser(userId).displayName || userId;
|
||||||
}
|
}
|
||||||
|
export function getRoom(roomId){
|
||||||
|
return matrix.client.getRoom(roomId);
|
||||||
|
}
|
@ -20,14 +20,14 @@
|
|||||||
</div>
|
</div>
|
||||||
<chat
|
<chat
|
||||||
class="chat"
|
class="chat"
|
||||||
v-if="currentRoom"
|
v-if="showRoom && getCurrentRoom()"
|
||||||
:room="currentRoom"
|
:room="getCurrentRoom()"
|
||||||
:user="matrix.user"
|
:user="matrix.user"
|
||||||
:close-chat="()=>currentRoom=undefined"
|
:close-chat="closeChat"
|
||||||
:open-chat-info="()=>showChatInfo=true"
|
:open-chat-info="()=>showChatInfo=true"
|
||||||
/>
|
/>
|
||||||
<div class="noRoomSelected" v-else>Please select a room to be displayed.</div>
|
<div class="noRoomSelected" v-else>Please select a room to be displayed.</div>
|
||||||
<chatInformation v-if="currentRoom && showChatInfo" :room="currentRoom" :close-chat-info="()=>showChatInfo=false"/>
|
<chatInformation v-if="showRoom && showChatInfo" :room="getCurrentRoom()" :close-chat-info="()=>showChatInfo=false"/>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@ -38,6 +38,7 @@ import {matrix} from "@/main";
|
|||||||
import ThrobberOverlay from "@/components/throbberOverlay";
|
import ThrobberOverlay from "@/components/throbberOverlay";
|
||||||
import {getMxcFromRoom} from "@/lib/getMxc";
|
import {getMxcFromRoom} from "@/lib/getMxc";
|
||||||
import roomListElement from "@/components/roomListElement";
|
import roomListElement from "@/components/roomListElement";
|
||||||
|
import {getRoom} from "@/lib/matrixUtils";
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "rooms",
|
name: "rooms",
|
||||||
@ -50,18 +51,25 @@ export default {
|
|||||||
methods:{
|
methods:{
|
||||||
openChat(room){
|
openChat(room){
|
||||||
this.showChatInfo = false;
|
this.showChatInfo = false;
|
||||||
this.currentRoom = undefined
|
this.showRoom = false;
|
||||||
this.$nextTick(() => this.currentRoom = room);
|
|
||||||
this.$router.push(`/rooms/${room.roomId}`);
|
this.$router.push(`/rooms/${room.roomId}`);
|
||||||
|
this.$nextTick(() => this.showRoom = true);
|
||||||
this.search = '';
|
this.search = '';
|
||||||
},
|
},
|
||||||
getMxcFromRoom
|
getMxcFromRoom,
|
||||||
|
getRoom,
|
||||||
|
getCurrentRoom(){
|
||||||
|
return getRoom(this.$route.path.split('/')[2]);
|
||||||
|
},
|
||||||
|
closeChat(){
|
||||||
|
this.$router.push('/rooms');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
data(){
|
data(){
|
||||||
return {
|
return {
|
||||||
matrix,
|
matrix,
|
||||||
currentRoom: undefined,
|
|
||||||
showChatInfo: false,
|
showChatInfo: false,
|
||||||
|
showRoom: true,
|
||||||
search: ''
|
search: ''
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user