Force save share link password if click outside (#17848)

Force save share link password if click outside
This commit is contained in:
John Molakvoæ 2019-11-12 08:31:00 +01:00 committed by GitHub
commit e76e85c9c0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 25 additions and 1 deletions

Binary file not shown.

Binary file not shown.

View file

@ -42,6 +42,9 @@
/** @type {boolean} **/
showPending: false,
/** @type {boolean} **/
hasPasswordChanged: false,
/** @type {string} **/
password: '',
@ -323,6 +326,7 @@
password: '',
cid: shareId
});
this.hasPasswordChanged = false
} else {
if (!OC.Util.isIE()) {
$li.find('.linkPassText').focus();
@ -331,8 +335,13 @@
},
onPasswordKeyUp: function(event) {
if(event.keyCode === 13) {
var $element = $(event.target);
var $li = $element.closest('li[data-share-id]');
var shareId = $li.data('share-id');
if (event.keyCode === 13) {
this.onPasswordEntered(event);
} else {
this.hasPasswordChanged = shareId
}
},
@ -368,6 +377,8 @@
.removeClass('hidden')
.addClass('inlineblock');
this.hasPasswordChanged = false
this.model.saveLinkShare({
password: password,
cid: shareId
@ -656,6 +667,10 @@
}
}
this.$el.on('beforeHide', function() {
this.onMenuhide()
}.bind(this));
this.$el.html(linkShareTemplate({
linkShares: linkShares,
shareAllowed: true,
@ -694,6 +709,15 @@
}
},
onMenuhide: function() {
if (this.hasPasswordChanged) {
var shareId = this.hasPasswordChanged
var target = this.$el.find('li[data-share-id=' + shareId + '] #linkPassText-' + shareId);
console.debug('Force saving password for share number ', shareId)
this.onPasswordEntered({ target: target })
}
},
/**
* @returns {Function} from Handlebars
* @private