diff --git a/apps/files/src/components/FileDetails.vue b/apps/files/src/components/FileDetails.vue index eae84b47ba7..1e2239cae7e 100644 --- a/apps/files/src/components/FileDetails.vue +++ b/apps/files/src/components/FileDetails.vue @@ -20,7 +20,7 @@
sidebar.app === this.currentTab) + }, + + isFavoritesEnabled() { + return this.capabilities.files && this.capabilities.files.favorites } }, watch: { diff --git a/apps/files/src/default.js b/apps/files/src/default.js index a2ecba609ff..51f3c341ab1 100644 --- a/apps/files/src/default.js +++ b/apps/files/src/default.js @@ -85,6 +85,9 @@ const navItems = [ iconMaterial: 'star', route: { name: 'files-favorites' + }, + enabled(capabilities) { + return capabilities.files && capabilities.files.favorites } }, { diff --git a/apps/files/src/fileactions.js b/apps/files/src/fileactions.js index fe75b622653..ef5ce3e0c1d 100644 --- a/apps/files/src/fileactions.js +++ b/apps/files/src/fileactions.js @@ -39,7 +39,7 @@ export default { return this.$gettext('Mark as favorite') }, isEnabled: () => { - return this.isAuthenticated + return this.isAuthenticated && this.capabilities.files.favorites } }, { diff --git a/changelog/unreleased/favorites-capabilities b/changelog/unreleased/favorites-capabilities new file mode 100644 index 00000000000..ec5f3ea3c66 --- /dev/null +++ b/changelog/unreleased/favorites-capabilities @@ -0,0 +1,6 @@ +Enhancement: Add favorites capabilities + +We've added a check of favorites capabilities to enable disabling of favorites list and favorite action. + +https://github.com/owncloud/ocis/issues/354 +https://github.com/owncloud/phoenix/pull/3754 \ No newline at end of file diff --git a/src/store/navigation.js b/src/store/navigation.js index 816dca04c36..c75655d6237 100644 --- a/src/store/navigation.js +++ b/src/store/navigation.js @@ -49,10 +49,17 @@ const getters = { * @param state * @returns {function(*): *[]} */ - getNavItems: state => extension => { + getNavItems: (state, rootState) => extension => { const staticNavItems = state.staticNavItems[extension] || [] const dynamicNavItems = state.dynamicNavItems[extension] || [] - return [...staticNavItems, ...dynamicNavItems] + + return [...staticNavItems, ...dynamicNavItems].filter(navItem => { + if (!navItem.enabled) { + return true + } + + return navItem.enabled(rootState.capabilities) + }) }, /** * Get all extension ids that have at least one navigation item.