Skip to content
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
4 changes: 2 additions & 2 deletions apps/files_sharing/src/components/SharingEntryLink.vue
Original file line number Diff line number Diff line change
Expand Up @@ -525,10 +525,10 @@ export default {
* @return {Array}
*/
externalLinkActions() {
const filterValidAction = (action) => (action.shareType.includes(ShareTypes.SHARE_TYPE_LINK) || action.shareType.includes(ShareTypes.SHARE_TYPE_EMAIL)) && !action.advanced
// filter only the registered actions for said link
return this.ExternalShareActions.actions
.filter(action => action.shareType.includes(ShareTypes.SHARE_TYPE_LINK)
|| action.shareType.includes(ShareTypes.SHARE_TYPE_EMAIL))
.filter(filterValidAction)
},

isPasswordPolicyEnabled() {
Expand Down
8 changes: 7 additions & 1 deletion apps/files_sharing/src/services/ExternalShareActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,19 @@ export default class ExternalShareActions {
return this._state
}

/**
* @typedef ExternalShareActionData
* @property {import('vue').Component} is Vue component to render, for advanced actions the `async onSave` method of the component will be called when saved
*/

/**
* Register a new option/entry for the a given share type
*
* @param {object} action new action component to register
* @param {string} action.id unique action id
* @param {Function} action.data data to bind the component to
* @param {(data: any) => ExternalShareActionData & Record<string, unknown>} action.data data to bind the component to
* @param {Array} action.shareType list of \@nextcloud/sharing.Types.SHARE_XXX to be mounted on
* @param {boolean} action.advanced `true` if the action entry should be rendered within advanced settings
* @param {object} action.handlers list of listeners
* @return {boolean}
*/
Expand Down
34 changes: 34 additions & 0 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,13 @@
</label>
<textarea id="share-note-textarea" :value="share.note" @input="share.note = $event.target.value" />
</template>
<ExternalShareAction v-for="action in externalLinkActions"
:id="action.id"
ref="externalLinkActions"
:key="action.id"
:action="action"
:file-info="fileInfo"
:share="share" />
<NcCheckboxRadioSwitch :checked.sync="setCustomPermissions">
{{ t('files_sharing', 'Custom permissions') }}
</NcCheckboxRadioSwitch>
Expand Down Expand Up @@ -234,6 +241,7 @@

<script>
import { getLanguage } from '@nextcloud/l10n'
import { Type as ShareType } from '@nextcloud/sharing'

import NcButton from '@nextcloud/vue/dist/Components/NcButton.js'
import NcInputField from '@nextcloud/vue/dist/Components/NcInputField.js'
Expand All @@ -256,6 +264,8 @@ import MenuDownIcon from 'vue-material-design-icons/MenuDown.vue'
import MenuUpIcon from 'vue-material-design-icons/MenuUp.vue'
import DotsHorizontalIcon from 'vue-material-design-icons/DotsHorizontal.vue'

import ExternalShareAction from '../components/ExternalShareAction.vue'

import GeneratePassword from '../utils/GeneratePassword.js'
import Share from '../models/Share.js'
import ShareRequests from '../mixins/ShareRequests.js'
Expand All @@ -281,6 +291,7 @@ export default {
CloseIcon,
CircleIcon,
EditIcon,
ExternalShareAction,
LinkIcon,
GroupIcon,
ShareIcon,
Expand Down Expand Up @@ -318,6 +329,8 @@ export default {
isFirstComponentLoad: true,
test: false,
creating: false,

ExternalShareActions: OCA.Sharing.ExternalShareActions.state,
Comment thread
artonge marked this conversation as resolved.
}
},

Expand Down Expand Up @@ -670,6 +683,18 @@ export default {
}
return undefined
},

/**
* Additional actions for the menu
*
* @return {Array}
*/
externalLinkActions() {
const filterValidAction = (action) => (action.shareType.includes(ShareType.SHARE_TYPE_LINK) || action.shareType.includes(ShareType.SHARE_TYPE_EMAIL)) && action.advanced
// filter only the advanced registered actions for said link
return this.ExternalShareActions.actions
.filter(filterValidAction)
},
},
watch: {
setCustomPermissions(isChecked) {
Expand Down Expand Up @@ -860,6 +885,15 @@ export default {
this.queueUpdate(...permissionsAndAttributes)
}

if (this.$refs.externalLinkActions?.length > 0) {
await Promise.allSettled(this.$refs.externalLinkActions.map((action) => {
if (typeof action.$children.at(0)?.onSave !== 'function') {
return Promise.resolve()
}
return action.$children.at(0)?.onSave?.()
}))
}

this.$emit('close-sharing-details')
},
/**
Expand Down
3 changes: 0 additions & 3 deletions dist/556-556.js

This file was deleted.

1 change: 0 additions & 1 deletion dist/556-556.js.map

This file was deleted.

3 changes: 3 additions & 0 deletions dist/8670-8670.js

Large diffs are not rendered by default.

File renamed without changes.
1 change: 1 addition & 0 deletions dist/8670-8670.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/files_sharing-files_sharing_tab.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/files_sharing-files_sharing_tab.js.map

Large diffs are not rendered by default.