Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix default storage id for various personal home locations #7156

Merged
merged 1 commit into from
Jun 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/unreleased/bugfix-folder-link-targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Bugfix: Folder link targets

Some views were missing parameters of their default target locations, e.g. the Favorites view and the search result page didn't link to the correct folders anymore. This has been fixed by always setting the personal view with the id of the current user as default.

https://github.com/owncloud/web/pull/7156
6 changes: 5 additions & 1 deletion packages/web-app-files/src/components/Search/List.vue
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import MixinFileActions from '../../mixins/fileActions'
import MixinFilesListFilter from '../../mixins/filesListFilter'
import MixinFilesListScrolling from '../../mixins/filesListScrolling'
import { Resource } from '../../helpers/resource'
import { useStore } from 'web-pkg/src/composables'

const visibilityObserver = new VisibilityObserver()

Expand All @@ -73,10 +74,13 @@ export default defineComponent({
}
},
setup() {
const store = useStore()
return {
...useResourcesViewDefaults<Resource, any, any[]>(),

resourceTargetLocation: createLocationSpaces('files-spaces-personal')
resourceTargetLocation: createLocationSpaces('files-spaces-personal', {
params: { storageId: store.getters.user.id }
})
}
},
computed: {
Expand Down
7 changes: 5 additions & 2 deletions packages/web-app-files/src/components/Search/Preview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import Vue from 'vue'
import { mapGetters, mapState } from 'vuex'
import { createLocationSpaces } from '../../router'
import path from 'path'
import { useCapabilityShareJailEnabled } from 'web-pkg/src/composables'
import { useCapabilityShareJailEnabled, useStore } from 'web-pkg/src/composables'

const visibilityObserver = new VisibilityObserver()

Expand All @@ -43,9 +43,12 @@ export default {
}
},
setup() {
const store = useStore()
return {
hasShareJail: useCapabilityShareJailEnabled(),
resourceTargetLocation: createLocationSpaces('files-spaces-personal'),
resourceTargetLocation: createLocationSpaces('files-spaces-personal', {
params: { storageId: store.getters.user.id }
}),
resourceTargetLocationSpace: createLocationSpaces('files-spaces-project')
}
},
Expand Down
6 changes: 5 additions & 1 deletion packages/web-app-files/src/views/Favorites.vue
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ import { createLocationSpaces } from '../router'
import { useResourcesViewDefaults } from '../composables'
import { defineComponent } from '@vue/composition-api'
import { Resource } from '../helpers/resource'
import { useStore } from 'web-pkg/src/composables'

const visibilityObserver = new VisibilityObserver()

Expand All @@ -86,9 +87,12 @@ export default defineComponent({
mixins: [FileActions, MixinMountSideBar, MixinFilesListFilter],

setup() {
const store = useStore()
return {
...useResourcesViewDefaults<Resource, any, any[]>(),
resourceTargetLocation: createLocationSpaces('files-spaces-personal')
resourceTargetLocation: createLocationSpaces('files-spaces-personal', {
params: { storageId: store.getters.user.id }
})
}
},

Expand Down
6 changes: 5 additions & 1 deletion packages/web-app-files/src/views/LocationPicker.vue
Original file line number Diff line number Diff line change
Expand Up @@ -381,7 +381,11 @@ export default {
})
)
default:
return this.$router.push(createLocationSpaces('files-spaces-personal'))
return this.$router.push(
createLocationSpaces('files-spaces-personal', {
params: { storageId: this.$store.getters.user.id }
})
)
}
},

Expand Down
4 changes: 3 additions & 1 deletion packages/web-app-files/src/views/PrivateLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default {
let resource = await this.$client.files.fileInfo(resourcePath, DavProperties.Default)
resource = buildResource(resource)

const params = {}
const params = {
storageId: this.$store.getters.user.id
}
const query = {}
if (resource.isFolder) {
// if folder: route directly into it
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const selectors = {
listInfo: 'list-info-stub'
}

const user = { id: 'test' }

describe('List component', () => {
afterEach(() => {
jest.clearAllMocks()
Expand Down Expand Up @@ -120,7 +122,8 @@ function createStore(activeFiles) {
options: {
disablePreviews: true
}
})
}),
user: () => user
},
modules: {
Files: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ const searchResult = {
}
}

const user = { id: 'test' }

describe('Preview component', () => {
it('should set correct props on oc-resource component', () => {
const wrapper = getWrapper()
Expand Down Expand Up @@ -94,7 +96,8 @@ function getWrapper({
options: {
disablePreviews: true
}
})
}),
user: () => user
},
modules: {
Files: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const router = {
}
}

const user = { id: 'test' }

const listLoaderStub = 'app-loading-spinner-stub'
const breadcrumbStub = 'oc-breadcrumb-stub'
const listInfoStub = 'list-info-stub'
Expand Down Expand Up @@ -185,7 +187,10 @@ describe('LocationPicker', () => {
expect(spyLeaveLocationPicker).toHaveBeenCalledWith('/some/item')
expect(spyRouterPush).toHaveBeenCalledTimes(1)
expect(spyRouterPush).toHaveBeenCalledWith({
name: 'files-spaces-personal'
name: 'files-spaces-personal',
params: {
storageId: user.id
}
})
})
})
Expand Down Expand Up @@ -440,7 +445,7 @@ describe('LocationPicker', () => {
totalFilesSize: totalFilesSize,
totalFilesCount: totalFilesCount,
generalThemeName: generalThemeName,
user: { id: 'test' }
user
})
}

Expand Down
2 changes: 1 addition & 1 deletion packages/web-app-files/tests/unit/views/views.setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const getStore = function ({
davProperties = [],
publicLinkPassword = null,
slogan = null,
user = null,
user = { id: 'test' },
generalThemeName = '',
capabilities = {},
selectedResourcesForMove = null,
Expand Down