Skip to content

Commit

Permalink
Remove no longer needed Vue adapter
Browse files Browse the repository at this point in the history
With the changes in the Files app sidebar API the Chat tab can be
directly used in the OCA.Files.Sidebar.Tab object without having to use
a special Vue component as a bridge.

Signed-off-by: Daniel Calviño Sánchez <danxuliu@gmail.com>
  • Loading branch information
danxuliu committed Nov 9, 2020
1 parent 9782020 commit c1d018e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 77 deletions.
18 changes: 11 additions & 7 deletions src/mainFilesSidebarLoader.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,7 @@
*
*/

import Vue from 'vue'
import FilesSidebarCallView from './views/FilesSidebarCallView'
import FilesSidebarTab from './views/FilesSidebarTab'
import { leaveConversation } from './services/participantsService'

const isEnabled = function(fileInfo) {
Expand All @@ -47,7 +45,6 @@ const isEnabled = function(fileInfo) {
return false
}

const View = Vue.extend(FilesSidebarTab)
// It might be enough to keep the instance only in the Tab object itself,
// without using a shared variable that can be destroyed if a new tab is
// mounted and the previous one was not destroyed yet, as the tabs seem to
Expand All @@ -68,15 +65,22 @@ window.addEventListener('DOMContentLoaded', () => {
if (tabInstance) {
tabInstance.$destroy()
}
tabInstance = new View()
// Only mount after we have all the info we need
await tabInstance.update(fileInfo)

// Dirty hack to force the style on parent component
const tabChat = document.querySelector('#tab-chat')
tabChat.style.height = '100%'
// Remove paddding to maximize space for the chat view
tabChat.style.padding = '0'

OCA.Talk.fileInfo = this.fileInfo
tabInstance = OCA.Talk.newTab()
tabInstance.$mount(el)
},
update(fileInfo) {
tabInstance.update(fileInfo)
OCA.Talk.fileInfo = fileInfo
},
destroy() {
OCA.Talk.fileInfo = null
tabInstance.$destroy()
tabInstance = null
},
Expand Down
70 changes: 0 additions & 70 deletions src/views/FilesSidebarTab.vue

This file was deleted.

0 comments on commit c1d018e

Please sign in to comment.