Skip to content

Commit

Permalink
use ocis storageId whenever possible
Browse files Browse the repository at this point in the history
use roles whenever possible
refactor share loading out of link and share panel component into parent component and load the data only once
use fileId for public link sharing
cleanup expected failures
get rid of bug demonstration test
add gherkin debug helpers
bump sdk
bump ocis
  • Loading branch information
fschade committed Jun 27, 2022
1 parent 037b2fb commit 3063fc2
Show file tree
Hide file tree
Showing 17 changed files with 195 additions and 171 deletions.
2 changes: 1 addition & 1 deletion .drone.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# The version of OCIS to use in pipelines that test against OCIS
OCIS_COMMITID=49541e6cc244f933e1d42b0462664eb6f1ab4ad4
OCIS_COMMITID=2e79be6bfd92d373eb63039e66354fe9d13aaae0
OCIS_BRANCH=master
1 change: 1 addition & 0 deletions .drone.star
Original file line number Diff line number Diff line change
Expand Up @@ -2196,6 +2196,7 @@ def ocisService():
"STORAGE_USERS_DRIVER_OWNCLOUD_DATADIR": "/srv/app/tmp/ocis/owncloud/data",
"WEB_ASSET_PATH": "%s/dist" % dir["web"],
"WEB_UI_CONFIG": "/srv/config/drone/config-ocis.json",
"FRONTEND_ENABLE_RESHARING": "true",
},
"commands": [
"cd %s/ocis-build" % dir["base"],
Expand Down
6 changes: 6 additions & 0 deletions changelog/unreleased/enhancement-ocis-resharing
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Enhancement: Re-sharing for ocis

We've enhanced web to be able to re-share resources for ocis, which works from sharing jails, project and personal spaces.
Beside that we also send roles, space-ref and path as separate values to the sharing api which simplifies the usage of it.

https://github.com/owncloud/web/pull/7086
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export default defineComponent({
client: this.$client,
path: this.file.path,
$gettext: this.$gettext,
...(this.currentStorageId && { storageId: this.currentStorageId })
storageId: this.file.fileId
})
this.shareIndicators = getIndicators(this.file, this.sharesTree)
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,6 @@ export default {
return this.$gettext('Invite')
},
currentStorageId() {
return this.$route.params.storageId
},
resourceIsSpace() {
return this.highlightedFile.type === 'space'
},
Expand Down Expand Up @@ -326,13 +323,6 @@ export default {
this.selectedRole.permissions(this.hasResharing || this.resourceIsSpace)
)
let storageId
if (this.resourceIsSpace) {
storageId = this.highlightedFile.id
} else if (this.currentStorageId) {
storageId = this.currentStorageId
}
this.addShare({
client: this.$client,
graphClient: this.graphClient,
Expand All @@ -342,8 +332,9 @@ export default {
displayName: collaborator.label,
shareType: collaborator.value.shareType,
permissions: bitmask,
role: this.selectedRole,
expirationDate: this.expirationDate,
storageId
storageId: this.highlightedFile.fileId || this.highlightedFile.id
})
})
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,8 @@ export default {
graphClient: this.graphClient,
share: this.share,
permissions: bitmask,
expirationDate: expirationDate || ''
expirationDate: expirationDate || '',
role
})
}
}
Expand Down
25 changes: 4 additions & 21 deletions packages/web-app-files/src/components/SideBar/Shares/FileLinks.vue
Original file line number Diff line number Diff line change
Expand Up @@ -118,9 +118,9 @@ import { getParentPaths } from '../../../helpers/path'
import { ShareTypes, LinkShareRoles, SharePermissions } from '../../../helpers/share'
import { cloneStateObject } from '../../../helpers/store'
import { showQuickLinkPasswordModal } from '../../../quickActions'
import CreateQuickLink from './Links/CreateQuickLink.vue'
import DetailsAndEdit from './Links/DetailsAndEdit.vue'
import NameAndCopy from './Links/NameAndCopy.vue'
import CreateQuickLink from './Links/CreateQuickLink.vue'
export default defineComponent({
name: 'FileLinks',
Expand Down Expand Up @@ -336,25 +336,8 @@ export default defineComponent({
return this.$route.params.storageId || null
}
},
watch: {
highlightedFile(newItem, oldItem) {
if (oldItem !== newItem) {
this.reloadLinks()
}
}
},
mounted() {
this.reloadLinks()
},
methods: {
...mapActions('Files', [
'addLink',
'updateLink',
'removeLink',
'loadSharesTree',
'loadCurrentFileOutgoingShares'
]),
...mapActions('Files', ['addLink', 'updateLink', 'removeLink']),
...mapActions(['showMessage', 'createModal', 'hideModal']),
toggleLinkListCollapsed() {
Expand Down Expand Up @@ -485,9 +468,9 @@ export default defineComponent({
permissions: link.permissions,
quicklink: link.quicklink,
name: link.name,
spaceRef: this.highlightedFile.fileId,
...(this.currentStorageId && {
storageId: this.currentStorageId,
spaceRef: `${this.currentStorageId}${this.highlightedFile.path}`
storageId: this.currentStorageId
})
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,6 @@
</template>

<script lang="ts">
import { dirname } from 'path'
import { useTask } from 'vue-concurrency'
import { mapGetters, mapActions, mapState } from 'vuex'
import { watch, computed, ref, unref } from '@vue/composition-api'
Expand Down Expand Up @@ -295,28 +294,13 @@ export default {
)
}
},
watch: {
highlightedFile: {
handler: function (newItem, oldItem) {
if (oldItem !== newItem) {
this.$_reloadShares()
}
},
immediate: true
}
},
mounted() {
async mounted() {
if (this.showSpaceMembers) {
this.loadSpaceMembersTask.perform()
}
},
methods: {
...mapActions('Files', [
'loadCurrentFileOutgoingShares',
'loadSharesTree',
'deleteShare',
'loadIncomingShares'
]),
...mapActions('Files', ['deleteShare']),
...mapActions(['createModal', 'hideModal', 'showMessage']),
toggleShareesListCollapsed() {
this.sharesListCollapsed = !this.sharesListCollapsed
Expand Down Expand Up @@ -387,25 +371,6 @@ export default {
})
})
},
$_reloadShares() {
const requestParams = {
client: this.$client,
$gettext: this.$gettext,
...(this.currentStorageId && { storageId: this.currentStorageId })
}
this.loadCurrentFileOutgoingShares({
...requestParams,
path: this.highlightedFile.path
})
this.loadIncomingShares({
...requestParams,
path: this.highlightedFile.path
})
this.loadSharesTree({
...requestParams,
path: dirname(this.highlightedFile.path)
})
},
getSharedParentRoute(parentShare) {
if (!parentShare.indirect) {
return null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ import { defineComponent } from '@vue/composition-api'
import FileLinks from './FileLinks.vue'
import FileShares from './FileShares.vue'
import SpaceMembers from './SpaceMembers.vue'
import { mapActions, mapGetters } from 'vuex'
import { dirname } from 'path'
import { clientService } from 'web-pkg/src/services'
import { useStore } from 'web-pkg/src/composables'
export default defineComponent({
name: 'SharesPanel',
Expand All @@ -26,6 +30,57 @@ export default defineComponent({
props: {
showSpaceMembers: { type: Boolean, default: false },
showLinks: { type: Boolean, default: false }
},
setup() {
const store = useStore()
const graphClient = clientService.graphAuthenticated(
store.getters.configuration.server,
store.getters.getToken
)
return { graphClient }
},
watch: {
highlightedFile: {
handler: function (newItem, oldItem) {
if (oldItem !== newItem) {
this.$_reloadShares()
}
},
immediate: true
}
},
computed: {
...mapGetters('Files', ['highlightedFile'])
},
methods: {
...mapActions('Files', [
'loadCurrentFileOutgoingShares',
'loadSharesTree',
'loadIncomingShares'
]),
$_reloadShares() {
this.loadCurrentFileOutgoingShares({
client: this.$client,
graphClient: this.graphClient,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId,
resource: this.highlightedFile
})
this.loadIncomingShares({
client: this.$client,
path: this.highlightedFile.path,
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId
})
this.loadSharesTree({
client: this.$client,
path: this.highlightedFile.path === '' ? '/' : dirname(this.highlightedFile.path),
$gettext: this.$gettext,
storageId: this.highlightedFile.fileId
})
}
}
})
</script>
Loading

0 comments on commit 3063fc2

Please sign in to comment.