Skip to content

Commit b289150

Browse files
authored
Merge pull request #12560 from nextcloud/stb14-share-menu-click-fix
[stable14] Fix share link password input
2 parents e1873e8 + d8a8c03 commit b289150

3 files changed

Lines changed: 33 additions & 17 deletions

File tree

apps/files_sharing/css/sharetabview.scss

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,13 @@
2323
.shareWithLoading {
2424
padding-left: 10px;
2525
right: 35px;
26-
top: 0px;
26+
top: 3px;
2727
}
28-
.shareWithConfirm,
29-
.clipboardButton,
30-
.linkPass .icon-loading-small {
28+
.shareWithConfirm {
3129
position: absolute;
3230
right: 2px;
3331
top: 6px;
3432
padding: 14px;
35-
}
36-
.shareWithConfirm {
3733
opacity: 0.5;
3834
}
3935
.shareWithField:focus ~ .shareWithConfirm {
@@ -46,6 +42,21 @@
4642
padding: 14px;
4743
}
4844
.popovermenu {
45+
.linkPassMenu {
46+
.share-pass-submit {
47+
width: auto !important;
48+
}
49+
.icon-loading-small {
50+
background-color: var(--color-main-background);
51+
position: absolute;
52+
right: 8px;
53+
margin: 3px;
54+
padding: 10px;
55+
width: 32px;
56+
height: 32px;
57+
z-index: 10;
58+
}
59+
}
4960
.datepicker {
5061
margin-left: 35px;
5162
}

core/js/sharedialoglinkshareview.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@
9393
' </span></li>' +
9494
' <li class="{{#unless isPasswordSet}}hidden{{/unless}} linkPassMenu"><span class="shareOption menuitem icon-share-pass">' +
9595
' <input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" autocomplete="new-password" />' +
96+
' <input type="submit" class="icon-confirm share-pass-submit" value="" />' +
9697
' <span class="icon icon-loading-small hidden"></span>' +
9798
' </span></li>' +
9899
'{{/if}}' +
@@ -189,8 +190,8 @@
189190
// open menu
190191
'click .share-menu .icon-more': 'onToggleMenu',
191192
// password
192-
'focusout input.linkPassText': 'onPasswordEntered',
193-
'keyup input.linkPassText': 'onPasswordKeyUp',
193+
'click input.share-pass-submit': 'onPasswordEntered',
194+
'keyup input.linkPassText': 'onPasswordKeyUp', // check for the enter key
194195
'change .showPasswordCheckbox': 'onShowPasswordClick',
195196
'change .publicEditingCheckbox': 'onAllowPublicEditingChange',
196197
// copy link url
@@ -374,11 +375,12 @@
374375
},
375376
error: function(model, msg) {
376377
// destroy old tooltips
377-
$input.tooltip('destroy');
378+
var $container = $input.parent();
379+
$container.tooltip('destroy');
378380
$input.addClass('error');
379-
$input.attr('title', msg);
380-
$input.tooltip({placement: 'bottom', trigger: 'manual'});
381-
$input.tooltip('show');
381+
$container.attr('title', msg);
382+
$container.tooltip({placement: 'bottom', trigger: 'manual'});
383+
$container.tooltip('show');
382384
}
383385
});
384386
},

core/js/tests/specs/sharedialogviewSpec.js

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,26 +127,29 @@ describe('OC.Share.ShareDialogView', function() {
127127
describe('Share with link', function() {
128128
// TODO: test ajax calls
129129
// TODO: test password field visibility (whenever enforced or not)
130-
it('update password on focus out', function() {
130+
it('update password on enter', function() {
131131
$('#allowShareWithLink').val('yes');
132132

133133
dialog.model.set('linkShare', {
134134
isLinkShare: true
135135
});
136136
dialog.render();
137137

138-
// Enable password, enter password and focusout
138+
// Toggle linkshare
139+
dialog.$el.find('.linkCheckbox').click();
140+
141+
// Enable password and enter password
139142
dialog.$el.find('[name=showPassword]').click();
140143
dialog.$el.find('.linkPassText').focus();
141144
dialog.$el.find('.linkPassText').val('foo');
142-
dialog.$el.find('.linkPassText').focusout();
145+
dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13}));
143146

144147
expect(saveLinkShareStub.calledOnce).toEqual(true);
145148
expect(saveLinkShareStub.firstCall.args[0]).toEqual({
146149
password: 'foo'
147150
});
148151
});
149-
it('update password on enter', function() {
152+
it('update password on submit', function() {
150153
$('#allowShareWithLink').val('yes');
151154

152155
dialog.model.set('linkShare', {
@@ -161,7 +164,7 @@ describe('OC.Share.ShareDialogView', function() {
161164
dialog.$el.find('[name=showPassword]').click();
162165
dialog.$el.find('.linkPassText').focus();
163166
dialog.$el.find('.linkPassText').val('foo');
164-
dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13}));
167+
dialog.$el.find('.linkPassText + .icon-confirm').click();
165168

166169
expect(saveLinkShareStub.calledOnce).toEqual(true);
167170
expect(saveLinkShareStub.firstCall.args[0]).toEqual({

0 commit comments

Comments
 (0)