diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2020-01-09 11:50:56 +0100 |
---|---|---|
committer | Backportbot <backportbot-noreply@rullzer.com> | 2020-01-10 14:50:23 +0000 |
commit | 8eded83d500baf8af9517c5f1733992221391423 (patch) | |
tree | b51197d4320400b26f741f8ac489d33aad162d13 /apps/files_sharing | |
parent | 4b28da1dd9a6acf4f04b69474f18ce883323caa3 (diff) | |
download | nextcloud-server-8eded83d500baf8af9517c5f1733992221391423.tar.gz nextcloud-server-8eded83d500baf8af9517c5f1733992221391423.zip |
Fix sharing note placeholder
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_sharing')
-rw-r--r-- | apps/files_sharing/src/components/SharingEntryLink.vue | 6 | ||||
-rw-r--r-- | apps/files_sharing/src/mixins/SharesMixin.js | 20 | ||||
-rw-r--r-- | apps/files_sharing/src/models/Share.js | 4 | ||||
-rw-r--r-- | apps/files_sharing/src/views/SharingLinkList.vue | 2 |
4 files changed, 21 insertions, 11 deletions
diff --git a/apps/files_sharing/src/components/SharingEntryLink.vue b/apps/files_sharing/src/components/SharingEntryLink.vue index 3c54a3f8aef..cb02e289b7f 100644 --- a/apps/files_sharing/src/components/SharingEntryLink.vue +++ b/apps/files_sharing/src/components/SharingEntryLink.vue @@ -242,9 +242,9 @@ }" :class="{ error: errors.note}" :disabled="saving" - :value.sync="share.note" + :value="share.note" icon="icon-edit" - @update:value="debounceQueueUpdate('note')" /> + @update:value="onNoteChange" /> </template> <!-- external sharing via url (social...) --> @@ -733,7 +733,7 @@ export default { */ onPasswordSubmit() { if (this.hasUnsavedPassword) { - this.share.password = this.share.newPassword + this.share.password = this.share.newPassword.trim() this.queueUpdate('password') } }, diff --git a/apps/files_sharing/src/mixins/SharesMixin.js b/apps/files_sharing/src/mixins/SharesMixin.js index c8ffbd6f5c5..19b2a9a6875 100644 --- a/apps/files_sharing/src/mixins/SharesMixin.js +++ b/apps/files_sharing/src/mixins/SharesMixin.js @@ -88,12 +88,12 @@ export default { */ hasNote: { get: function() { - return !!this.share.note + return this.share.note !== '' }, set: function(enabled) { this.share.note = enabled - ? t('files_sharing', 'Enter a note for the share recipient') - : '' + ? null // enabled but user did not changed the content yet + : '' // empty = no note = disabled }, }, @@ -117,10 +117,10 @@ export default { // fallback to default in case of unavailable data return { days: window.dayNamesShort - ? window.dayNamesShort // provided by nextcloud + ? window.dayNamesShort // provided by nextcloud : ['Sun.', 'Mon.', 'Tue.', 'Wed.', 'Thu.', 'Fri.', 'Sat.'], months: window.monthNamesShort - ? window.monthNamesShort // provided by nextcloud + ? window.monthNamesShort // provided by nextcloud : ['Jan.', 'Feb.', 'Mar.', 'Apr.', 'May.', 'Jun.', 'Jul.', 'Aug.', 'Sep.', 'Oct.', 'Nov.', 'Dec.'], placeholder: { date: 'Select Date', // TODO: Translate @@ -183,6 +183,16 @@ export default { }, /** + * When the note change, we trim, save and dispatch + * + * @param {string} note the note + */ + onNoteChange: debounce(function(note) { + this.share.note = note.trim() + this.queueUpdate('note') + }, 500), + + /** * Delete share button handler */ async onDelete() { diff --git a/apps/files_sharing/src/models/Share.js b/apps/files_sharing/src/models/Share.js index 13b68ad68be..35a95119542 100644 --- a/apps/files_sharing/src/models/Share.js +++ b/apps/files_sharing/src/models/Share.js @@ -250,7 +250,7 @@ export default class Share { * @memberof Share */ set note(note) { - this.#share.note = note.trim() + this.#share.note = note } /** @@ -303,7 +303,7 @@ export default class Share { * @memberof Share */ set password(password) { - this.#share.password = password.trim() + this.#share.password = password } // SHARED ITEM DATA --------------------------------------------- diff --git a/apps/files_sharing/src/views/SharingLinkList.vue b/apps/files_sharing/src/views/SharingLinkList.vue index 20789f7211a..1fcfbecd4cb 100644 --- a/apps/files_sharing/src/views/SharingLinkList.vue +++ b/apps/files_sharing/src/views/SharingLinkList.vue @@ -21,7 +21,7 @@ --> <template> - <ul class="sharing-link-list" v-if="canLinkShare"> + <ul v-if="canLinkShare" class="sharing-link-list"> <!-- If no link shares, show the add link default entry --> <SharingEntryLink v-if="!hasLinkShares && canReshare" :can-reshare="canReshare" |