Skip to content

Commit

Permalink
Fix injection
Browse files Browse the repository at this point in the history
  • Loading branch information
JammingBen committed Dec 20, 2022
1 parent 33a4aa1 commit 20c41d8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 14 deletions.
15 changes: 10 additions & 5 deletions packages/web-app-files/src/components/SideBar/PrivateLinkItem.vue
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,19 @@
</oc-button>
</template>

<script>
<script lang="ts">
import { mapActions } from 'vuex'
import copyToClipboard from 'copy-to-clipboard'
import { unref } from 'vue'
import { ComputedRef, inject, unref, defineComponent } from 'vue'
import { Resource } from 'web-client'
export default {
export default defineComponent({
name: 'PrivateLinkItem',
inject: ['displayedItem'],
setup() {
return {
displayedItem: inject<ComputedRef<Resource>>('displayedItem')
}
},
data: () => ({
copied: false,
timeout: null
Expand Down Expand Up @@ -56,5 +61,5 @@ export default {
}, 550)
}
}
}
})
</script>
Original file line number Diff line number Diff line change
Expand Up @@ -113,17 +113,17 @@ import {
SpacePeopleShareRoles
} from 'web-client/src/helpers/share'
import * as uuid from 'uuid'
import { defineComponent, PropType } from 'vue'
import { ComputedRef, defineComponent, inject, PropType } from 'vue'
import {
useCapabilityFilesSharingAllowCustomPermissions,
useCapabilityFilesSharingCanDenyAccess,
useStore
} from 'web-pkg/src/composables'
import { Resource } from 'web-client'
export default defineComponent({
name: 'RoleDropdown',
components: { RoleItem },
inject: ['incomingParentShare'],
props: {
resource: {
type: Object,
Expand Down Expand Up @@ -152,6 +152,7 @@ export default defineComponent({
setup() {
const store = useStore()
return {
incomingParentShare: inject<ComputedRef<Resource>>('incomingParentShare'),
hasRoleDenyAccess: useCapabilityFilesSharingCanDenyAccess(store),
hasRoleCustomPermissions: useCapabilityFilesSharingAllowCustomPermissions(store)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@
</div>
</template>
<script lang="ts">
import { defineComponent, PropType, unref } from 'vue'
import { ComputedRef, defineComponent, inject, PropType } from 'vue'
import { DateTime } from 'luxon'
import { mapGetters, mapActions, mapState, mapMutations } from 'vuex'
import {
Expand All @@ -134,7 +134,7 @@ import NameAndCopy from './Links/NameAndCopy.vue'
import { useGraphClient } from 'web-pkg/src/composables'
import CreateQuickLink from './Links/CreateQuickLink.vue'
import { getLocaleFromLanguage } from 'web-pkg/src/helpers'
import { SpaceResource } from 'web-client/src/helpers'
import { Resource, SpaceResource } from 'web-client/src/helpers'
import { isLocationSharesActive } from '../../../router'
export default defineComponent({
Expand All @@ -144,7 +144,6 @@ export default defineComponent({
DetailsAndEdit,
NameAndCopy
},
inject: ['displayedItem', 'incomingParentShare'],
props: {
space: {
type: Object as PropType<SpaceResource>,
Expand All @@ -161,6 +160,8 @@ export default defineComponent({
return {
...useGraphClient(),
file: inject<ComputedRef<Resource>>('displayedItem'),
incomingParentShare: inject<ComputedRef<Resource>>('incomingParentShare'),
hasSpaces: useCapabilitySpacesEnabled(),
hasShareJail: useCapabilityShareJailEnabled(),
hasResharing: useCapabilityFilesSharingResharing(),
Expand All @@ -176,10 +177,6 @@ export default defineComponent({
...mapState(['user']),
...mapState('Files', ['sharesTree']),
file() {
return unref(this.displayedItem)
},
addButtonLabel() {
return this.$gettext('Add link')
},
Expand Down

0 comments on commit 20c41d8

Please sign in to comment.