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

feat(files_sharing): add send mail toggle #50064

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
5 changes: 3 additions & 2 deletions apps/files_sharing/src/mixins/ShareRequests.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default {
*
* @param {object} data destructuring object
* @param {string} data.path path to the file/folder which should be shared
* @param {string} data.sendMail send a mail to the recipient can be 'true' or 'false'
* @param {number} data.shareType 0 = user; 1 = group; 3 = public link; 6 = federated cloud share
* @param {string} data.shareWith user/group id with which the file should be shared (optional for shareType > 1)
* @param {boolean} [data.publicUpload] allow public upload to a public shared folder
Expand All @@ -33,9 +34,9 @@ export default {
* @return {Share} the new share
* @throws {Error}
*/
async createShare({ path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes }) {
async createShare({ path, permissions, sendMail, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes }) {
try {
const request = await axios.post(shareUrl, { path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes })
const request = await axios.post(shareUrl, { path, permissions, sendMail, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes })
if (!request?.data?.ocs) {
throw request
}
Expand Down
21 changes: 14 additions & 7 deletions apps/files_sharing/src/views/SharingDetailsTab.vue
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,12 @@
</NcCheckboxRadioSwitch>
</div>
</div>
<div v-if="isNewShare && isUserShare" class="sharingTabDetailsView__general-control">
<NcCheckboxRadioSwitch type="switch"
:checked.sync="sendNotificationMailOnCreation">
{{ t('settings', 'Send email notification') }}
</NcCheckboxRadioSwitch>
</div>
<div class="sharingTabDetailsView__advanced-control">
<NcButton id="advancedSectionAccordionAdvancedControl"
type="tertiary"
Expand Down Expand Up @@ -329,8 +335,8 @@ export default {
data() {
return {
writeNoteToRecipientIsChecked: false,
sendNotificationMailOnCreation: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
sendNotificationMailOnCreation: true,
sendNotificationMailOnCreation: true,

sharingPermission: BUNDLED_PERMISSIONS.ALL.toString(),
revertSharingPermission: BUNDLED_PERMISSIONS.ALL.toString(),
setCustomPermissions: false,
passwordError: false,
advancedSectionAccordionExpanded: false,
Expand Down Expand Up @@ -923,6 +929,10 @@ export default {
incomingShare.password = this.share.password
}

if (this.sendNotificationMailOnCreation) {
incomingShare.sendMail = 'true'
}

this.creating = true
const share = await this.addShare(incomingShare)
this.creating = false
Expand Down Expand Up @@ -965,6 +975,7 @@ export default {
attributes: JSON.stringify(share.attributes),
...(share.note ? { note: share.note } : {}),
...(share.password ? { password: share.password } : {}),
...(share.sendMail ? { sendMail: share.sendMail } : {}),
})
return resultingShare
} catch (error) {
Expand Down Expand Up @@ -1125,13 +1136,9 @@ export default {
}
}

&__advanced-control {
&__advanced-control, &__general-control {
width: 100%;

button {
margin-top: 0.5em;
}

margin-top: 0.5em;
}

&__advanced {
Expand Down
Loading