summaryrefslogtreecommitdiffstats
path: root/core/js/sharedialoglinkshareview.js
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-11-01 14:55:32 +0100
committerDaniel Calviño Sánchez <danxuliu@gmail.com>2018-11-01 21:33:11 +0100
commit0a70544cd93c02e0ec5c2571400b5d00ed97c456 (patch)
tree6c26e4bdfab66f35dc555f426c7f665225deeedb /core/js/sharedialoglinkshareview.js
parent9dea41f8fee933f496a452efc10bcbac9d3b2df5 (diff)
downloadnextcloud-server-0a70544cd93c02e0ec5c2571400b5d00ed97c456.tar.gz
nextcloud-server-0a70544cd93c02e0ec5c2571400b5d00ed97c456.zip
Password policy fix and menu open on first share
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/js/sharedialoglinkshareview.js')
-rw-r--r--core/js/sharedialoglinkshareview.js27
1 files changed, 25 insertions, 2 deletions
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 53ad88984a1..4ea8c0fa153 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -189,6 +189,8 @@
shareData.password = this.password
}
+ var newShareId = false;
+
// We need a password before the share creation
if (isPasswordEnforced && !this.showPending && this.password === '') {
this.showPending = shareId;
@@ -196,18 +198,32 @@
$li.find('#enforcedPassText').focus();
} else {
// else, we have a password or it is not enforced
- this.model.saveLinkShare(shareData, {
+ $.when(this.model.saveLinkShare(shareData, {
success: function() {
$loading.addClass('hidden');
$li.find('.icon').removeClass('hidden');
self.render();
+ // open the menu by default
+ // we can only do that after the render
+ if (newShareId) {
+ var shares = self.$el.find('li[data-share-id]');
+ var $newShare = self.$el.find('li[data-share-id="'+newShareId+'"]');
+ // only open the menu by default if this is the first share
+ if ($newShare && shares.length === 1) {
+ $menu = $newShare.find('.popovermenu');
+ OC.showMenu(null, $menu);
+ }
+ }
},
error: function() {
OC.Notification.showTemporary(t('core', 'Unable to create a link share'));
$loading.addClass('hidden');
$li.find('.icon').removeClass('hidden');
}
- })
+ })).then(function(response) {
+ // resolve before success
+ newShareId = response.ocs.data.id
+ });
}
},
@@ -515,6 +531,12 @@
this.$el.find('.datepicker').datepicker({dateFormat : 'dd-mm-yy'});
+ var minPasswordLength = 4
+ // password policy?
+ if(oc_capabilities.password_policy && oc_capabilities.password_policy.minLength) {
+ minPasswordLength = oc_capabilities.password_policy.minLength;
+ }
+
var popoverBase = {
social: social,
urlLabel: t('core', 'Link'),
@@ -550,6 +572,7 @@
isPasswordEnforced: isPasswordEnforced,
enforcedPasswordLabel: t('core', 'Password protection for links is mandatory'),
passwordPlaceholder: passwordPlaceholderInitial,
+ minPasswordLength: minPasswordLength,
};
var pendingPopoverMenu = this.pendingPopoverMenuTemplate(_.extend({}, pendingPopover))