Skip to content

Commit 9688857

Browse files
committed
feat(files_sharing): add send mail toggle
For new internal shares, show the user a toggle for them configure if they want to send the share receiver a notification mail. This is subject to whether the share receiver has an email attached to their account. Signed-off-by: nfebe <[email protected]>
1 parent 48f9062 commit 9688857

File tree

2 files changed

+20
-8
lines changed

2 files changed

+20
-8
lines changed

apps/files_sharing/src/mixins/ShareRequests.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default {
2222
*
2323
* @param {object} data destructuring object
2424
* @param {string} data.path path to the file/folder which should be shared
25+
* @param {string} data.sendMail send a mail to the recipient can be 'true' or 'false'
2526
* @param {number} data.shareType 0 = user; 1 = group; 3 = public link; 6 = federated cloud share
2627
* @param {string} data.shareWith user/group id with which the file should be shared (optional for shareType > 1)
2728
* @param {boolean} [data.publicUpload] allow public upload to a public shared folder
@@ -35,9 +36,9 @@ export default {
3536
* @return {Share} the new share
3637
* @throws {Error}
3738
*/
38-
async createShare({ path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes }) {
39+
async createShare({ path, permissions, sendMail, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes }) {
3940
try {
40-
const request = await axios.post(shareUrl, { path, permissions, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes })
41+
const request = await axios.post(shareUrl, { path, permissions, sendMail, shareType, shareWith, publicUpload, password, sendPasswordByTalk, expireDate, label, note, attributes })
4142
if (!request?.data?.ocs) {
4243
throw request
4344
}

apps/files_sharing/src/views/SharingDetailsTab.vue

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,12 @@
8484
</NcCheckboxRadioSwitch>
8585
</div>
8686
</div>
87+
<div v-if="isNewShare && isUserShare" class="sharingTabDetailsView__general-control">
88+
<NcCheckboxRadioSwitch type="switch"
89+
:checked.sync="sendNotificationMailOnCreation">
90+
{{ t('settings', 'Send email notification') }}
91+
</NcCheckboxRadioSwitch>
92+
</div>
8793
<div class="sharingTabDetailsView__advanced-control">
8894
<NcButton id="advancedSectionAccordionAdvancedControl"
8995
type="tertiary"
@@ -353,6 +359,7 @@ export default {
353359
data() {
354360
return {
355361
writeNoteToRecipientIsChecked: false,
362+
sendNotificationMailOnCreation: true,
356363
sharingPermission: BUNDLED_PERMISSIONS.ALL.toString(),
357364
revertSharingPermission: BUNDLED_PERMISSIONS.ALL.toString(),
358365
setCustomPermissions: false,
@@ -1027,6 +1034,13 @@ export default {
10271034
}
10281035
}
10291036
1037+
if (this.sendNotificationMailOnCreation) {
1038+
incomingShare.sendMail = 'true'
1039+
}
1040+
1041+
this.creating = true
1042+
share = await this.addShare(incomingShare)
1043+
this.creating = false
10301044
this.share = share
10311045
this.creating = false
10321046
this.$emit('add:share', this.share)
@@ -1069,6 +1083,7 @@ export default {
10691083
attributes: JSON.stringify(share.attributes),
10701084
...(share.note ? { note: share.note } : {}),
10711085
...(share.password ? { password: share.password } : {}),
1086+
...(share.sendMail ? { sendMail: share.sendMail } : {}),
10721087
})
10731088
return resultingShare
10741089
} catch (error) {
@@ -1229,13 +1244,9 @@ export default {
12291244
}
12301245
}
12311246
1232-
&__advanced-control {
1247+
&__advanced-control, &__general-control {
12331248
width: 100%;
1234-
1235-
button {
1236-
margin-top: 0.5em;
1237-
}
1238-
1249+
margin-top: 0.5em;
12391250
}
12401251
12411252
&__advanced {

0 commit comments

Comments
 (0)