Skip to content

Commit 7a9ea03

Browse files
committed
Fix share link password input
Signed-off-by: John Molakvoæ (skjnldsv) <[email protected]>
1 parent def8af3 commit 7a9ea03

File tree

6 files changed

+31
-19
lines changed

6 files changed

+31
-19
lines changed

apps/files_sharing/css/sharetabview.scss

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,16 +48,13 @@
4848
.shareWithLoading {
4949
padding-left: 10px;
5050
right: 35px;
51-
top: 0px;
51+
top: 3px;
5252
}
53-
.shareWithConfirm,
54-
.linkPass .icon-loading-small {
53+
.shareWithConfirm {
5554
position: absolute;
5655
right: 2px;
5756
top: 6px;
5857
padding: 14px;
59-
}
60-
.shareWithConfirm {
6158
opacity: 0.5;
6259
}
6360
.shareWithField:focus ~ .shareWithConfirm {
@@ -70,6 +67,21 @@
7067
padding: 14px;
7168
}
7269
.popovermenu {
70+
.linkPassMenu {
71+
.share-pass-submit {
72+
width: auto !important;
73+
}
74+
.icon-loading-small {
75+
background-color: var(--color-main-background);
76+
position: absolute;
77+
right: 8px;
78+
margin: 3px;
79+
padding: 10px;
80+
width: 32px;
81+
height: 32px;
82+
z-index: 10;
83+
}
84+
}
7385
.datepicker {
7486
margin-left: 35px;
7587
}

core/js/share/sharedialoglinkshareview_popover_menu.handlebars

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@
5858
<li class="{{#unless isPasswordSet}}hidden{{/unless}} linkPassMenu">
5959
<span class="menuitem icon-share-pass">
6060
<input id="linkPassText-{{cid}}" class="linkPassText" type="password" placeholder="{{passwordPlaceholder}}" autocomplete="new-password" />
61+
<input type="submit" class="icon-confirm share-pass-submit" value="" />
6162
<span class="icon icon-loading-small hidden"></span>
6263
</span>
6364
</li>

core/js/sharedialoglinkshareview.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@
5454
// hide download
5555
'change .hideDownloadCheckbox': 'onHideDownloadChange',
5656
// password
57-
'focusout input.linkPassText': 'onPasswordEntered',
58-
'keyup input.linkPassText': 'onPasswordKeyUp',
57+
'click input.share-pass-submit': 'onPasswordEntered',
58+
'keyup input.linkPassText': 'onPasswordKeyUp', // check for the enter key
5959
'change .showPasswordCheckbox': 'onShowPasswordClick',
6060
'change .passwordByTalkCheckbox': 'onPasswordByTalkChange',
6161
'change .publicEditingCheckbox': 'onAllowPublicEditingChange',
@@ -381,11 +381,12 @@
381381
},
382382
error: function(model, msg) {
383383
// destroy old tooltips
384-
$input.tooltip('destroy');
384+
var $container = $input.parent();
385+
$container.tooltip('destroy');
385386
$input.addClass('error');
386-
$input.attr('title', msg);
387-
$input.tooltip({placement: 'bottom', trigger: 'manual'});
388-
$input.tooltip('show');
387+
$container.attr('title', msg);
388+
$container.tooltip({placement: 'bottom', trigger: 'manual'});
389+
$container.tooltip('show');
389390
}
390391
});
391392
},

core/js/sharetemplates.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

core/js/tests/specs/sharedialoglinkshareview.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -186,13 +186,11 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
186186
});
187187
view.render();
188188

189-
var $passwordDiv = view.$el.find('#linkPass');
190189
$passwordText = view.$el.find('.linkPassText');
191190
$workingIcon = view.$el.find('.linkPassMenu .icon-loading-small');
192191

193192
sinon.stub(shareModel, 'saveLinkShare');
194193

195-
expect($passwordDiv.hasClass('hidden')).toBeFalsy();
196194
expect($passwordText.hasClass('hidden')).toBeFalsy();
197195
expect($workingIcon.hasClass('hidden')).toBeTruthy();
198196

core/js/tests/specs/sharedialogviewSpec.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ 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({
@@ -137,19 +137,19 @@ describe('OC.Share.ShareDialogView', function() {
137137
});
138138
dialog.render();
139139

140-
// Enable password, enter password and focusout
140+
// Enable password and enter password
141141
dialog.$el.find('[name=showPassword]').click();
142142
dialog.$el.find('.linkPassText').focus();
143143
dialog.$el.find('.linkPassText').val('foo');
144-
dialog.$el.find('.linkPassText').focusout();
144+
dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13}));
145145

146146
expect(saveLinkShareStub.calledOnce).toEqual(true);
147147
expect(saveLinkShareStub.firstCall.args[0]).toEqual({
148148
cid: 123,
149149
password: 'foo'
150150
});
151151
});
152-
it('update password on enter', function() {
152+
it('update password on submit', function() {
153153
$('#allowShareWithLink').val('yes');
154154

155155
dialog.model.set({
@@ -163,7 +163,7 @@ describe('OC.Share.ShareDialogView', function() {
163163
dialog.$el.find('[name=showPassword]').click();
164164
dialog.$el.find('.linkPassText').focus();
165165
dialog.$el.find('.linkPassText').val('foo');
166-
dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13}));
166+
dialog.$el.find('.linkPassText + .icon-confirm').click();
167167

168168
expect(saveLinkShareStub.calledOnce).toEqual(true);
169169
expect(saveLinkShareStub.firstCall.args[0]).toEqual({

0 commit comments

Comments
 (0)