Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVincent Petry <vincent@nextcloud.com>2021-02-12 11:47:08 +0300
committerVincent Petry <vincent@nextcloud.com>2021-02-15 12:59:09 +0300
commitfa00d3918f4659aebc36b1b5e9ec566b04578974 (patch)
tree78b4daffef51c288520bbae3e8f210450e7e1b3b
parent6ef60cdb9fc2709c8020f93eaebe7fabc1aa9b16 (diff)
Remove current room from RoomSelectorbackport/5110/stable21
Expose the Talk Vue instance on OCA.Talk.instance. In RoomSelector, grab the current room from that instance to filter it out, when applicableRemove current room from RoomSelector Expose the Talk Vue instance on OCA.Talk.instance. In RoomSelector, grab the current room from that instance to filter it out, when applicable. Signed-off-by: Vincent Petry <vincent@nextcloud.com>
-rw-r--r--src/main.js10
-rw-r--r--src/views/RoomSelector.vue7
2 files changed, 16 insertions, 1 deletions
diff --git a/src/main.js b/src/main.js
index fb35a20fe..7fa07da8c 100644
--- a/src/main.js
+++ b/src/main.js
@@ -70,7 +70,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,
@@ -154,3 +154,11 @@ 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
+if (!window.OCA.Talk) {
+ window.OCA.Talk = {}
+}
+OCA.Talk.instance = instance
+
+export default instance
diff --git a/src/views/RoomSelector.vue b/src/views/RoomSelector.vue
index db0796c19..ec9dca165 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() {