diff --git a/src/main.js b/src/main.js index c21ed964367..49d6a18e6d5 100644 --- a/src/main.js +++ b/src/main.js @@ -71,7 +71,7 @@ Vue.use(VueObserveVisibility) Vue.use(VueShortKey, { prevent: ['input', 'textarea', 'div'] }) Vue.use(vOutsideEvents) -export default new Vue({ +const instance = new Vue({ el: '#content', store, router, @@ -155,3 +155,8 @@ Sidebar.prototype.close = function() { Object.assign(window.OCA.Files, { Sidebar: new Sidebar(), }) + +// make the instance available to global components that might run on the same page +OCA.Talk.instance = instance + +export default instance diff --git a/src/views/RoomSelector.vue b/src/views/RoomSelector.vue index db0796c1950..ec9dca1654f 100644 --- a/src/views/RoomSelector.vue +++ b/src/views/RoomSelector.vue @@ -87,6 +87,7 @@ export default { return { rooms: [], selectedRoom: null, + currentRoom: null, loading: true, } }, @@ -94,6 +95,7 @@ export default { availableRooms() { return this.rooms.filter((room) => { return room.type !== CONVERSATION.TYPE.CHANGELOG + && (!this.currentRoom || this.currentRoom !== room.token) && (!this.showPostableOnly || room.readOnly === CONVERSATION.STATE.READ_WRITE) && room.objectType !== 'file' && room.objectType !== 'share:password' @@ -102,6 +104,11 @@ export default { }, beforeMount() { this.fetchRooms() + + const $store = OCA.Talk?.instance?.$store + if ($store) { + this.currentRoom = $store.getters.getToken() + } }, methods: { fetchRooms() {