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 personal drive ID in personal space/upload #6909

Merged
merged 1 commit into from
May 9, 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
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