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

refactor: follow-up for #10433 #10677

Merged
merged 3 commits into from
Mar 27, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ export default defineComponent({
onConfirm: (displayName: string) => {
const linkShare = this.linkShare
linkShare.displayName = displayName
return Promise.resolve(this.$emit('updateLink', { linkShare }))
this.$emit('updateLink', { linkShare })
}
})
},
Expand All @@ -521,8 +521,9 @@ export default defineComponent({
inputLabel: this.$gettext('Email address'),
inputType: 'email',
onInput: (value, setError) => setError(this.getEmailValidationMsg(value)),
onConfirm: (value: string) =>
Promise.resolve(this.$emit('updateLink', { linkShare: { ...this.linkShare } }))
onConfirm: () => {
this.$emit('updateLink', { linkShare: { ...this.linkShare } })
}
})
},
getEmailValidationMsg(email: string) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,9 @@ describe('FileShares', () => {
it('reacts on delete events', async () => {
const { wrapper } = getWrapper({ collaborators })
const { dispatchModal } = useModals()
;(wrapper.findComponent<any>('collaborator-list-item-stub').vm as any).$emit('onDelete')
wrapper
.findComponent<typeof CollaboratorListItem>('collaborator-list-item-stub')
.vm.$emit('onDelete')
await wrapper.vm.$nextTick()
expect(dispatchModal).toHaveBeenCalledTimes(1)
})
Expand Down
2 changes: 1 addition & 1 deletion packages/web-pkg/src/composables/piniaStores/modals.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export type Modal = {
customComponent?: CustomModalComponent
customComponentAttrs?: () => Record<string, unknown>
onCancel?: () => void
onConfirm?: (value: string) => Promise<void>
onConfirm?: (value: string) => void | Promise<void>
onInput?: (value: string, setError: (error: string) => void) => void
}

Expand Down
4 changes: 3 additions & 1 deletion packages/web-runtime/src/components/ModalWrapper.vue
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,9 @@ export default defineComponent({
updateModal(unref(modal)?.id, 'confirmDisabled', true)

if (unref(modal)?.onConfirm) {
await loadingService.addTask(() => unref(modal).onConfirm(value))
await loadingService.addTask(async () => {
await unref(modal).onConfirm(value)
})
} else if (unref(customComponentRef)?.onConfirm) {
await loadingService.addTask(() => unref(customComponentRef).onConfirm())
}
Expand Down
48 changes: 24 additions & 24 deletions tests/e2e/cucumber/features/shares/share.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,27 +12,27 @@ Feature: share
Given "Brian" disables auto-accepting using API
And "Alice" logs in
And "Alice" creates the following folder in personal space using API
| name |
| folder_to_shared |
| folder_to_customShared |
| shared_folder |
| name |
| folder_to_shared |
| folder_to_shared_2 |
| shared_folder |
And "Alice" opens the "files" app
And "Alice" uploads the following resource
| resource | to |
| lorem.txt | folder_to_shared |
| lorem-big.txt | folder_to_customShared |
| resource | to |
| lorem.txt | folder_to_shared |
| lorem-big.txt | folder_to_shared_2 |
When "Alice" shares the following resource using the sidebar panel
| resource | recipient | type | role | resourceType |
| folder_to_shared | Brian | user | Can edit | folder |
| shared_folder | Brian | user | Can edit | folder |
| folder_to_customShared | Brian | user | Can edit | folder |
| resource | recipient | type | role | resourceType |
| folder_to_shared | Brian | user | Can edit | folder |
| shared_folder | Brian | user | Can edit | folder |
| folder_to_shared_2 | Brian | user | Can edit | folder |

And "Brian" opens the "files" app
And "Brian" navigates to the shared with me page
And "Brian" enables the sync for the following shares
| name |
| folder_to_shared |
| folder_to_customShared |
| name |
| folder_to_shared |
| folder_to_shared_2 |
Then "Brian" should not see a sync status for the folder "shared_folder"
When "Brian" enables the sync for the following share using the context menu
| name |
Expand All @@ -44,12 +44,12 @@ Feature: share
| resource | as |
| folder_to_shared/lorem.txt | lorem_new.txt |
And "Brian" uploads the following resource
| resource | to |
| simple.pdf | folder_to_shared |
| testavatar.jpeg | folder_to_customShared |
| resource | to |
| simple.pdf | folder_to_shared |
| testavatar.jpeg | folder_to_shared_2 |
When "Brian" deletes the following resources using the sidebar panel
| resource | from |
| lorem-big.txt | folder_to_customShared |
| resource | from |
| lorem-big.txt | folder_to_shared_2 |
And "Alice" opens the "files" app
And "Alice" uploads the following resource
| resource | to | option |
Expand All @@ -58,17 +58,17 @@ Feature: share
| resource | to |
| simple.pdf | folder_to_shared |
And "Alice" removes following sharee
| resource | recipient |
| folder_to_customShared | Brian |
| resource | recipient |
| folder_to_shared_2 | Brian |
When "Alice" deletes the following resources using the sidebar panel
| resource | from |
| lorem_new.txt | folder_to_shared |
| folder_to_shared | |
And "Alice" logs out
Then "Brian" should not be able to see the following shares
| resource | owner |
| folder_to_customShared | Alice Hansen |
| folder_to_shared | Alice Hansen |
| resource | owner |
| folder_to_shared_2 | Alice Hansen |
| folder_to_shared | Alice Hansen |
And "Brian" logs out


Expand Down