Skip to content

Commit

Permalink
Fix personal drive ID in personal space/upload
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed May 9, 2022
1 parent 8433aa3 commit 8997826
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 44 deletions.
9 changes: 9 additions & 0 deletions changelog/unreleased/enhancement-introduce-sharing-jail
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Enhancement: Introduce sharing jail

We've added the sharing jail to oCIS which means that navigating and
working with shares now happens inside the `Shares` navigation item.

https://github.com/owncloud/web/pull/6593
https://github.com/owncloud/web/pull/6909
https://github.com/owncloud/web/issues/5152
https://github.com/owncloud/web/issues/6448
1 change: 1 addition & 0 deletions changelog/unreleased/enhancement-resumeable-uploads
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ We've implemented Uppy as a library for handling uploads. This concludes the fol
- Removed `vue2-dropzone` and `vue-drag-drop` libraries

https://github.com/owncloud/web/pull/6202
https://github.com/owncloud/web/issues/5031
https://github.com/owncloud/web/issues/6268
60 changes: 20 additions & 40 deletions packages/web-app-files/src/components/AppBar/CreateAndUpload.vue
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,22 @@ export default defineComponent({
path: '',
fileFolderCreationLoading: false
}),
asyncComputed: {
personalDriveId: {
async get() {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.getToken
)
const drivesResponse = await graphClient.drives.listMyDrives('', 'driveType eq personal')
if (!drivesResponse.data) {
throw new Error('No personal space found')
}
return drivesResponse.data.value[0].id
}
}
},
computed: {
...mapGetters(['getToken', 'capabilities', 'configuration', 'newFileHandlers', 'user']),
...mapGetters('Files', ['files', 'currentFolder', 'publicLinkPassword']),
Expand Down Expand Up @@ -268,16 +284,7 @@ export default defineComponent({
if (this.isPersonalLocation) {
if (this.hasShareJail) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.getToken
)
const userResponse = await graphClient.users.getMe()
if (!userResponse.data) {
console.error('graph.user.getMe() has no data')
return
}
path = buildWebDavSpacesPath(userResponse.data.id, path || '')
path = buildWebDavSpacesPath(this.personalDriveId, path || '')
} else {
path = buildWebDavFilesPath(this.user.id, path)
}
Expand Down Expand Up @@ -400,16 +407,7 @@ export default defineComponent({
if (this.isPersonalLocation) {
if (this.hasShareJail) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.getToken
)
const userResponse = await graphClient.users.getMe()
if (!userResponse.data) {
console.error('graph.user.getMe() has no data')
return
}
path = buildWebDavSpacesPath(userResponse.data.id, path || '')
path = buildWebDavSpacesPath(this.personalDriveId, path || '')
} else {
path = buildWebDavFilesPath(this.user.id, path)
}
Expand Down Expand Up @@ -506,16 +504,7 @@ export default defineComponent({
if (this.isPersonalLocation) {
if (this.hasShareJail) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.getToken
)
const userResponse = await graphClient.users.getMe()
if (!userResponse.data) {
console.error('graph.user.getMe() has no data')
return
}
path = buildWebDavSpacesPath(userResponse.data.id, path || '')
path = buildWebDavSpacesPath(this.personalDriveId, path || '')
} else {
path = buildWebDavFilesPath(this.user.id, path)
}
Expand Down Expand Up @@ -597,16 +586,7 @@ export default defineComponent({
let path = pathUtil.join(this.currentPath, fileName)
if (this.isPersonalLocation) {
if (this.hasShareJail) {
const graphClient = clientService.graphAuthenticated(
this.configuration.server,
this.getToken
)
const userResponse = await graphClient.users.getMe()
if (!userResponse.data) {
console.error('graph.user.getMe() has no data')
return
}
path = buildWebDavSpacesPath(userResponse.data.id, path || '')
path = buildWebDavSpacesPath(this.personalDriveId, path || '')
} else {
path = buildWebDavFilesPath(this.user.id, path)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,15 +29,15 @@ export class FolderLoaderSpacesPersonal implements FolderLoader {
try {
store.commit('Files/CLEAR_CURRENT_FILES_LIST')

const userResponse = yield graphClient.users.getMe()
if (!userResponse.data) {
throw new Error('graph.user.getMe() has no data')
const drivesResponse = yield graphClient.drives.listMyDrives('', 'driveType eq personal')
if (!drivesResponse.data) {
throw new Error('No personal space found')
}

let resources = yield fetchResources(
clientService.owncloudSdk,
buildWebDavSpacesPath(
userResponse.data.id,
drivesResponse.data.value[0].id,
path || router.currentRoute.params.item || ''
),
DavProperties.Default
Expand Down

0 comments on commit 8997826

Please sign in to comment.