Remove 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 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>
This commit is contained in:
Vincent Petry 2021-02-12 09:47:08 +01:00
Родитель fa55c6c4c8
Коммит ab45b798e6
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: E055D6A4D513575C
2 изменённых файлов: 16 добавлений и 1 удалений

Просмотреть файл

@ -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,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

Просмотреть файл

@ -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() {