Skip to content

Commit

Permalink
Fix resolving single files, minor improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Aug 17, 2022
1 parent 57271fb commit 2a36a1d
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,11 @@ import { basename } from 'path'
import { DateTime } from 'luxon'
import { mapActions } from 'vuex'
import { createLocationSpaces, isLocationSpacesActive } from '../../../../router'
import { LinkShareRoles } from 'web-client/src/helpers/share'
import {
linkRoleInternalFile,
linkRoleInternalFolder,
LinkShareRoles
} from 'web-client/src/helpers/share'
import { defineComponent } from '@vue/runtime-core'
import { formatDateFromDateTime, formatRelativeDateFromDateTime } from 'web-pkg/src/helpers'
Expand Down Expand Up @@ -381,7 +385,9 @@ export default defineComponent({
},
isAliasLink() {
return this.link.permissions === '0'
return [linkRoleInternalFolder.label, linkRoleInternalFile.label].includes(
this.link.description
)
}
},
watch: {
Expand Down
8 changes: 8 additions & 0 deletions packages/web-app-files/src/components/SideBar/SideBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ import {
usePublicLinkPassword,
useStore
} from 'web-pkg/src/composables'
import { ShareTypes } from 'web-client/src/helpers/share'
export default defineComponent({
components: { FileInfo, SpaceInfo, SideBar },
Expand Down Expand Up @@ -132,6 +133,13 @@ export default defineComponent({
if (this.hasShareJail && isLocationSpacesActive(this.$router, 'files-spaces-share')) {
return false
}
if (
!pathSegments.length &&
this.highlightedFile?.shareTypes?.includes(ShareTypes.link.value)
) {
// alias link for a single resource
return false
}
return !pathSegments.length
},
highlightedFileThumbnail() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,15 +40,18 @@ export class FolderLoaderLegacyPersonal implements FolderLoader {
)
resources = resources.map(buildResource)

const currentFolder = resources.shift()
const hasShareJail = useCapabilityShareJailEnabled(store)
yield store.dispatch('Files/loadSharesTree', {
client,
path: currentFolder.path
})
const currentFolder =
resources.length > 1 || resources[0].isFolder ? resources.shift() : undefined
if (currentFolder) {
const hasShareJail = useCapabilityShareJailEnabled(store)
yield store.dispatch('Files/loadSharesTree', {
client,
path: currentFolder.path
})

for (const file of resources) {
file.indicators = getIndicators(file, store.state.Files.sharesTree, hasShareJail.value)
for (const file of resources) {
file.indicators = getIndicators(file, store.state.Files.sharesTree, hasShareJail.value)
}
}

store.commit('Files/LOAD_FILES', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,15 +37,18 @@ export class FolderLoaderSpacesPersonal implements FolderLoader {
)
resources = resources.map(buildResource)

const currentFolder = resources.shift()
const hasShareJail = useCapabilityShareJailEnabled(store)
yield store.dispatch('Files/loadSharesTree', {
client: clientService.owncloudSdk,
path: currentFolder.path
})
const currentFolder =
resources.length > 1 || resources[0].isFolder ? resources.shift() : undefined
if (currentFolder) {
const hasShareJail = useCapabilityShareJailEnabled(store)
yield store.dispatch('Files/loadSharesTree', {
client: clientService.owncloudSdk,
path: currentFolder.path
})

for (const file of resources) {
file.indicators = getIndicators(file, store.state.Files.sharesTree, hasShareJail.value)
for (const file of resources) {
file.indicators = getIndicators(file, store.state.Files.sharesTree, hasShareJail.value)
}
}

store.commit('Files/LOAD_FILES', {
Expand Down
4 changes: 2 additions & 2 deletions packages/web-runtime/src/pages/resolvePublicLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ export default defineComponent({
} else {
tokenInfo = yield owncloudSdk.shares.getUnprotectedTokenInfo(unref(token))
}
} catch (e) { } // oC10
} catch (e) { } // backend doesn't support the token info endpoint
ref.tokenInfo = tokenInfo
})
Expand Down Expand Up @@ -196,7 +196,7 @@ export default defineComponent({
return this.$router.push({ name: '/login' })
}
return this.$router.push({ name: 'files-spaces-personal', params: { storageId: fullPath } })
return this.$router.push({ name: `files-spaces-personal`, params: { storageId: fullPath } })
}
} else {
publicLink = await this.loadPublicLinkTask.perform()
Expand Down

0 comments on commit 2a36a1d

Please sign in to comment.