Skip to content

Commit 9f108d8

Browse files
authored
Merge pull request #50814 from nextcloud/fix/tags
fix(systemtags): do not hide if no tags
2 parents fa7874f + 18c1fbc commit 9f108d8

File tree

6 files changed

+30
-20
lines changed

6 files changed

+30
-20
lines changed
Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ window.addEventListener('DOMContentLoaded', function() {
2323
const contentElement = document.querySelector('body > .content')
2424
|| document.querySelector('body > #content')
2525

26+
let vueParent
27+
2628
// Make sure we have a proper layout
2729
if (contentElement) {
2830
// Make sure we have a mountpoint
@@ -31,14 +33,20 @@ window.addEventListener('DOMContentLoaded', function() {
3133
sidebarElement.id = 'app-sidebar'
3234
contentElement.appendChild(sidebarElement)
3335
}
36+
37+
// Helps with vue debug, as we mount the sidebar to the
38+
// content element which is a vue instance itself
39+
vueParent = contentElement.__vue__ as Vue
3440
}
3541

3642
// Init vue app
3743
const View = Vue.extend(SidebarView)
3844
const AppSidebar = new View({
3945
name: 'SidebarRoot',
40-
})
41-
AppSidebar.$mount('#app-sidebar')
46+
parent: vueParent,
47+
}).$mount('#app-sidebar')
48+
49+
// Expose Sidebar methods
4250
window.OCA.Files.Sidebar.open = AppSidebar.open
4351
window.OCA.Files.Sidebar.close = AppSidebar.close
4452
window.OCA.Files.Sidebar.setFullScreenMode = AppSidebar.setFullScreenMode

apps/files/src/views/Sidebar.vue

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@
3838
<SystemTags v-if="isSystemTagsEnabled && showTagsDefault"
3939
v-show="showTags"
4040
:disabled="!fileInfo?.canEdit()"
41-
:file-id="fileInfo.id"
42-
@has-tags="value => showTags = value" />
41+
:file-id="fileInfo.id" />
4342
<LegacyView v-for="view in views"
4443
:key="view.cid"
4544
:component="view"
@@ -93,19 +92,20 @@
9392
</template>
9493
</NcAppSidebar>
9594
</template>
96-
<script>
97-
import { getCurrentUser } from '@nextcloud/auth'
98-
import { getCapabilities } from '@nextcloud/capabilities'
99-
import { showError } from '@nextcloud/dialogs'
95+
<script lang="ts">
96+
import { davRemoteURL, davRootPath, File, Folder, formatFileSize } from '@nextcloud/files'
97+
import { defineComponent } from 'vue'
10098
import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
101-
import { File, Folder, davRemoteURL, davRootPath, formatFileSize } from '@nextcloud/files'
10299
import { encodePath } from '@nextcloud/paths'
100+
import { fetchNode } from '../services/WebdavClient.ts'
103101
import { generateUrl } from '@nextcloud/router'
104-
import { ShareType } from '@nextcloud/sharing'
102+
import { getCapabilities } from '@nextcloud/capabilities'
103+
import { getCurrentUser } from '@nextcloud/auth'
105104
import { mdiStar, mdiStarOutline } from '@mdi/js'
106-
import { fetchNode } from '../services/WebdavClient.ts'
107-
import axios from '@nextcloud/axios'
105+
import { ShareType } from '@nextcloud/sharing'
106+
import { showError } from '@nextcloud/dialogs'
108107
import $ from 'jquery'
108+
import axios from '@nextcloud/axios'
109109
110110
import NcAppSidebar from '@nextcloud/vue/dist/Components/NcAppSidebar.js'
111111
import NcActionButton from '@nextcloud/vue/dist/Components/NcActionButton.js'
@@ -120,7 +120,7 @@ import SidebarTab from '../components/SidebarTab.vue'
120120
import SystemTags from '../../../systemtags/src/components/SystemTags.vue'
121121
import logger from '../logger.ts'
122122
123-
export default {
123+
export default defineComponent({
124124
name: 'Sidebar',
125125
126126
components: {
@@ -464,7 +464,10 @@ export default {
464464
* Toggle the tags selector
465465
*/
466466
toggleTags() {
467-
this.showTagsDefault = this.showTags = !this.showTags
467+
// toggle
468+
this.showTags = !this.showTags
469+
// save the new state
470+
this.setShowTagsDefault(this.showTags)
468471
},
469472
470473
/**
@@ -585,7 +588,7 @@ export default {
585588
this.hasLowHeight = document.documentElement.clientHeight < 1024
586589
},
587590
},
588-
}
591+
})
589592
</script>
590593
<style lang="scss" scoped>
591594
.app-sidebar {

apps/systemtags/src/components/SystemTags.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,6 @@ export default Vue.extend({
117117
this.loadingTags = true
118118
try {
119119
this.selectedTags = await fetchTagsForFile(this.fileId)
120-
this.$emit('has-tags', this.selectedTags.length > 0)
121120
} catch (error) {
122121
showError(t('systemtags', 'Failed to load selected tags'))
123122
}

dist/files-sidebar.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-sidebar.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

webpack.modules.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ module.exports = {
3535
'settings-personal-availability': path.join(__dirname, 'apps/dav/src', 'settings-personal-availability.js'),
3636
},
3737
files: {
38-
sidebar: path.join(__dirname, 'apps/files/src', 'sidebar.js'),
38+
sidebar: path.join(__dirname, 'apps/files/src', 'sidebar.ts'),
3939
main: path.join(__dirname, 'apps/files/src', 'main.ts'),
4040
init: path.join(__dirname, 'apps/files/src', 'init.ts'),
4141
search: path.join(__dirname, 'apps/files/src/plugins/search', 'folderSearch.ts'),

0 commit comments

Comments
 (0)