|
155 | 155 | </template> |
156 | 156 | <NcCheckboxRadioSwitch |
157 | 157 | v-if="canTogglePasswordProtectedByTalkAvailable" |
158 | | - v-model="isPasswordProtectedByTalk" |
159 | | - @update:modelValue="onPasswordProtectedByTalkChange"> |
| 158 | + v-model="isPasswordProtectedByTalk"> |
160 | 159 | {{ t('files_sharing', 'Video verification') }} |
161 | 160 | </NcCheckboxRadioSwitch> |
162 | 161 | <NcCheckboxRadioSwitch v-model="hasExpirationDate" :disabled="isExpiryDateEnforced"> |
|
178 | 177 | <NcCheckboxRadioSwitch |
179 | 178 | v-if="isPublicShare" |
180 | 179 | v-model="share.hideDownload" |
181 | | - :disabled="canChangeHideDownload" |
182 | | - @update:modelValue="queueUpdate('hideDownload')"> |
| 180 | + :disabled="canChangeHideDownload"> |
183 | 181 | {{ t('files_sharing', 'Hide download') }} |
184 | 182 | </NcCheckboxRadioSwitch> |
185 | 183 | <NcCheckboxRadioSwitch |
@@ -400,6 +398,13 @@ export default { |
400 | 398 | creating: false, |
401 | 399 | initialToken: this.share.token, |
402 | 400 | loadingToken: false, |
| 401 | + initialPermissions: undefined, |
| 402 | + initialExpireDate: undefined, |
| 403 | + initialNote: undefined, |
| 404 | + initialLabel: undefined, |
| 405 | + initialHideDownload: undefined, |
| 406 | + initialSendPasswordByTalk: undefined, |
| 407 | + initialHasDownloadPermission: undefined, |
403 | 408 |
|
404 | 409 | externalShareActions: getSidebarActions(), |
405 | 410 | // legacy |
@@ -867,6 +872,14 @@ export default { |
867 | 872 | }, |
868 | 873 |
|
869 | 874 | beforeMount() { |
| 875 | + this.initialPermissions = this.share.permissions |
| 876 | + this.initialExpireDate = this.share.expireDate |
| 877 | + this.initialNote = this.share.note |
| 878 | + this.initialLabel = this.share.label |
| 879 | + this.initialHideDownload = this.share.hideDownload |
| 880 | + this.initialSendPasswordByTalk = this.share.sendPasswordByTalk |
| 881 | + this.initialHasDownloadPermission = this.share.hasDownloadPermission |
| 882 | +
|
870 | 883 | this.initializePermissions() |
871 | 884 | this.initializeAttributes() |
872 | 885 | logger.debug('Share object received', { share: this.share }) |
@@ -931,6 +944,16 @@ export default { |
931 | 944 |
|
932 | 945 | cancel() { |
933 | 946 | this.share.token = this.initialToken |
| 947 | + this.share.permissions = this.initialPermissions |
| 948 | + this.share.expireDate = this.initialExpireDate |
| 949 | + this.share.note = this.initialNote |
| 950 | + this.share.label = this.initialLabel |
| 951 | + this.share.hideDownload = this.initialHideDownload |
| 952 | + this.share.sendPasswordByTalk = this.initialSendPasswordByTalk |
| 953 | + this.share.hasDownloadPermission = this.initialHasDownloadPermission |
| 954 | +
|
| 955 | + this.$set(this.share, 'newPassword', undefined) |
| 956 | +
|
934 | 957 | this.$emit('close-sharing-details') |
935 | 958 | }, |
936 | 959 |
|
@@ -1065,7 +1088,7 @@ export default { |
1065 | 1088 |
|
1066 | 1089 | async saveShare() { |
1067 | 1090 | const permissionsAndAttributes = ['permissions', 'attributes', 'note', 'expireDate'] |
1068 | | - const publicShareAttributes = ['label', 'hideDownload'] |
| 1091 | + const publicShareAttributes = ['label', 'hideDownload', 'sendPasswordByTalk'] |
1069 | 1092 | // Only include password if it's being actively changed |
1070 | 1093 | if (this.hasUnsavedPassword) { |
1071 | 1094 | publicShareAttributes.push('password') |
@@ -1099,6 +1122,13 @@ export default { |
1099 | 1122 | this.share.password = '' |
1100 | 1123 | } |
1101 | 1124 |
|
| 1125 | + // "Video verification" must be disabled if the password was |
| 1126 | + // disabled, as it does not make sense and would also prevent |
| 1127 | + // saving if it is still enabled. |
| 1128 | + if (this.isPasswordProtectedByTalk && !this.isPasswordProtected) { |
| 1129 | + this.isPasswordProtectedByTalk = false |
| 1130 | + } |
| 1131 | +
|
1102 | 1132 | if (!this.hasExpirationDate) { |
1103 | 1133 | this.share.expireDate = '' |
1104 | 1134 | } |
@@ -1228,30 +1258,14 @@ export default { |
1228 | 1258 | */ |
1229 | 1259 | onPasswordChange(password) { |
1230 | 1260 | if (password === '') { |
1231 | | - this.$delete(this.share, 'newPassword') |
| 1261 | + this.$set(this.share, 'newPassword', undefined) |
1232 | 1262 | this.passwordError = this.isNewShare && this.isPasswordEnforced |
1233 | 1263 | return |
1234 | 1264 | } |
1235 | 1265 | this.passwordError = !this.isValidShareAttribute(password) |
1236 | 1266 | this.$set(this.share, 'newPassword', password) |
1237 | 1267 | }, |
1238 | 1268 |
|
1239 | | - /** |
1240 | | - * Update the password along with "sendPasswordByTalk". |
1241 | | - * |
1242 | | - * If the password was modified the new password is sent; otherwise |
1243 | | - * updating a mail share would fail, as in that case it is required that |
1244 | | - * a new password is set when enabling or disabling |
1245 | | - * "sendPasswordByTalk". |
1246 | | - */ |
1247 | | - onPasswordProtectedByTalkChange() { |
1248 | | - if (this.isEmailShareType || this.hasUnsavedPassword) { |
1249 | | - this.queueUpdate('sendPasswordByTalk', 'password') |
1250 | | - } else { |
1251 | | - this.queueUpdate('sendPasswordByTalk') |
1252 | | - } |
1253 | | - }, |
1254 | | -
|
1255 | 1269 | isValidShareAttribute(value) { |
1256 | 1270 | if ([null, undefined].includes(value)) { |
1257 | 1271 | return false |
|
0 commit comments