aboutsummaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
Diffstat (limited to 'core/js')
-rw-r--r--core/js/shareitemmodel.js11
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js6
2 files changed, 13 insertions, 4 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 1cf116f08f9..ae3cb0ce2e3 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -116,7 +116,8 @@
// TODO: use backbone's default value mechanism once this is a separate model
var requiredAttributes = [
- { name: 'password', defaultValue: '' },
+ { name: 'password', defaultValue: '' },
+ { name: 'passwordChanged', defaultValue: false },
{ name: 'permissions', defaultValue: OC.PERMISSION_READ },
{ name: 'expiration', defaultValue: this.configModel.getDefaultExpirationDateString() }
];
@@ -136,11 +137,16 @@
}
});
+ var password = {
+ password: attributes.password,
+ passwordChanged: attributes.passwordChanged
+ };
+
OC.Share.share(
itemType,
itemSource,
OC.Share.SHARE_TYPE_LINK,
- attributes.password,
+ password,
attributes.permissions,
this.fileInfoModel.get('name'),
attributes.expiration,
@@ -208,6 +214,7 @@
*/
setPassword: function(password) {
this.get('linkShare').password = password;
+ this.get('linkShare').passwordChanged = true;
},
addShare: function(attributes, options) {
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 0117f517d4c..1c05bf21968 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -146,7 +146,8 @@ describe('OC.Share.ShareDialogView', function() {
expect(fakeServer.requests[1].method).toEqual('POST');
var body = OC.parseQueryString(fakeServer.requests[1].requestBody);
- expect(body.shareWith).toEqual('foo');
+ expect(body['shareWith[password]']).toEqual('foo');
+ expect(body['shareWith[passwordChanged]']).toEqual('true');
fetchStub.reset();
@@ -185,7 +186,8 @@ describe('OC.Share.ShareDialogView', function() {
expect(fakeServer.requests[1].method).toEqual('POST');
var body = OC.parseQueryString(fakeServer.requests[1].requestBody);
- expect(body.shareWith).toEqual('foo');
+ expect(body['shareWith[password]']).toEqual('foo');
+ expect(body['shareWith[passwordChanged]']).toEqual('true');
fetchStub.reset();