summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-20 11:22:24 +0200
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-07-21 15:02:21 +0200
commit58debbe42c16ee4ab7d36ffc91a53ae953c09021 (patch)
tree1f2e0a7bc16ea5a3462a9f7d947444b01792e13f
parente302cadae27ed560960b2b87810023ec4827aa4d (diff)
downloadnextcloud-server-58debbe42c16ee4ab7d36ffc91a53ae953c09021.tar.gz
nextcloud-server-58debbe42c16ee4ab7d36ffc91a53ae953c09021.zip
Tests fixes and design bump
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
-rw-r--r--.gitignore1
-rw-r--r--apps/files/css/files.scss3
-rw-r--r--apps/files_sharing/css/sharetabview.scss22
-rw-r--r--core/js/sharedialoglinkshareview.js2
-rw-r--r--core/js/sharedialogresharerinfoview.js12
-rw-r--r--core/js/shareitemmodel.js7
-rw-r--r--core/js/tests/specs/sharedialoglinkshareview.js2
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js186
-rw-r--r--lib/private/Share/Share.php1
9 files changed, 45 insertions, 191 deletions
diff --git a/.gitignore b/.gitignore
index c7b6b396635..a11e3a14597 100644
--- a/.gitignore
+++ b/.gitignore
@@ -121,6 +121,7 @@ nbproject
/build/jsdocs/
/npm-debug.log
/PhantomJS_*
+/build/package-lock.json
# puphpet
puphpet
diff --git a/apps/files/css/files.scss b/apps/files/css/files.scss
index 2a71af038cf..017253fdf8e 100644
--- a/apps/files/css/files.scss
+++ b/apps/files/css/files.scss
@@ -94,7 +94,8 @@
@include icon-color('star-dark', 'files', $color-black, 2, true);
}
.nav-icon-sharingin,
-.nav-icon-sharingout {
+.nav-icon-sharingout,
+.nav-icon-shareoverview {
@include icon-color('share', 'files', $color-black);
}
.nav-icon-sharinglinks {
diff --git a/apps/files_sharing/css/sharetabview.scss b/apps/files_sharing/css/sharetabview.scss
index 82a04936bfd..b3516c68573 100644
--- a/apps/files_sharing/css/sharetabview.scss
+++ b/apps/files_sharing/css/sharetabview.scss
@@ -135,10 +135,16 @@
margin-left: 0;
margin-right: 0;
}
+ // share note on the sidebar
+ .share-note {
+ border-radius: var(--border-radius);
+ margin-bottom: 10px;
+ margin-left: 37px;
+ }
}
// Sharing tab users list
-#shareWithList {
+.shareWithList {
list-style-type: none;
display: flex;
flex-direction: column;
@@ -218,4 +224,18 @@
left: 8px;
right: auto;
}
+}
+
+.reshare,
+#link label,
+#expiration label {
+ display: inline-flex;
+ align-items: center;
+ .avatar {
+ margin-right: 5px;
+ }
+}
+
+.resharerInfoView.subView {
+ position: relative;
} \ No newline at end of file
diff --git a/core/js/sharedialoglinkshareview.js b/core/js/sharedialoglinkshareview.js
index 19ce4d65c5c..925d8ed918e 100644
--- a/core/js/sharedialoglinkshareview.js
+++ b/core/js/sharedialoglinkshareview.js
@@ -21,7 +21,7 @@
var TEMPLATE =
'{{#if shareAllowed}}' +
- '<ul id="shareWithList" class="shareWithList">' +
+ '<ul id="shareLink" class="shareWithList">' +
' <li data-share-id="{{cid}}">' +
' <div class="avatar icon-public-white"></div><span class="username" title="{{linkShareLabel}}">{{linkShareLabel}}</span>' +
' <span class="sharingOptionsGroup">' +
diff --git a/core/js/sharedialogresharerinfoview.js b/core/js/sharedialogresharerinfoview.js
index f4bf9afa0b2..fadd0a41f7b 100644
--- a/core/js/sharedialogresharerinfoview.js
+++ b/core/js/sharedialogresharerinfoview.js
@@ -19,7 +19,8 @@
'<span class="reshare">' +
' <div class="avatar" data-userName="{{reshareOwner}}"></div>' +
' {{sharedByText}}' +
- '</span><br/>'
+ '</span>' +
+ '{{#if hasShareNote}}<div class="share-note">{{shareNote}}</div>{{/if}}'
;
/**
@@ -72,7 +73,10 @@
var reshareTemplate = this.template();
var ownerDisplayName = this.model.getReshareOwnerDisplayname();
+ var shareNote = this.model.getReshareNote();
+
var sharedByText = '';
+
if (this.model.getReshareType() === OC.Share.SHARE_TYPE_GROUP) {
sharedByText = t(
'core',
@@ -105,9 +109,13 @@
);
}
+
+
this.$el.html(reshareTemplate({
reshareOwner: this.model.getReshareOwner(),
- sharedByText: sharedByText
+ sharedByText: sharedByText,
+ shareNote: shareNote,
+ hasShareNote: shareNote !== ''
}));
this.$el.find('.avatar').each(function() {
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index 68e55443dd2..241b9c19c0d 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -343,6 +343,13 @@
/**
* @returns {string}
*/
+ getReshareNote: function() {
+ return this.get('reshare').note;
+ },
+
+ /**
+ * @returns {string}
+ */
getReshareWith: function() {
return this.get('reshare').share_with;
},
diff --git a/core/js/tests/specs/sharedialoglinkshareview.js b/core/js/tests/specs/sharedialoglinkshareview.js
index 12f5e762cee..9d07dcb479d 100644
--- a/core/js/tests/specs/sharedialoglinkshareview.js
+++ b/core/js/tests/specs/sharedialoglinkshareview.js
@@ -92,7 +92,7 @@ describe('OC.Share.ShareDialogLinkShareView', function () {
var $passwordDiv = view.$el.find('#linkPass');
$passwordText = view.$el.find('.linkPassText');
- $workingIcon = view.$el.find('.linkPass .icon-loading-small');
+ $workingIcon = view.$el.find('.linkPassMenu .icon-loading-small');
sinon.stub(shareModel, 'saveLinkShare');
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 5fd920a758c..33d3be51440 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -214,188 +214,6 @@ describe('OC.Share.ShareDialogView', function() {
focusStub.restore();
selectStub.restore();
});
- describe('password', function() {
- var slideToggleStub;
-
- beforeEach(function() {
- $('#allowShareWithLink').val('yes');
- configModel.set({
- enforcePasswordForPublicLink: false
- });
-
- slideToggleStub = sinon.stub($.fn, 'slideToggle');
- });
- afterEach(function() {
- slideToggleStub.restore();
- });
-
- it('enforced but toggled does not fire request', function() {
- configModel.set('enforcePasswordForPublicLink', true);
- dialog.render();
-
- dialog.$el.find('.linkCheckbox').click();
-
- // The password linkPass field is shown (slideToggle is called).
- // No request is made yet
- expect(slideToggleStub.callCount).toEqual(1);
- expect(slideToggleStub.getCall(0).thisValue.eq(0).attr('id')).toEqual('linkPass');
- expect(fakeServer.requests.length).toEqual(0);
-
- // Now untoggle share by link
- dialog.$el.find('.linkCheckbox').click();
- dialog.render();
-
- // Password field disappears and no ajax requests have been made
- expect(fakeServer.requests.length).toEqual(0);
- expect(slideToggleStub.callCount).toEqual(2);
- expect(slideToggleStub.getCall(1).thisValue.eq(0).attr('id')).toEqual('linkPass');
- });
- });
- describe('expiration date', function() {
- var shareData;
- var shareItem;
- var clock;
- var expectedMinDate;
-
- beforeEach(function() {
- // pick a fake date
- clock = sinon.useFakeTimers(new Date(2014, 0, 20, 14, 0, 0).getTime());
- expectedMinDate = new Date(2014, 0, 21, 14, 0, 0);
-
- configModel.set({
- enforcePasswordForPublicLink: false,
- isDefaultExpireDateEnabled: false,
- isDefaultExpireDateEnforced: false,
- defaultExpireDate: 7
- });
-
- shareModel.set('linkShare', {
- isLinkShare: true,
- token: 'tehtoken',
- permissions: OC.PERMISSION_READ,
- expiration: null
- });
- });
- afterEach(function() {
- clock.restore();
- });
-
- it('does not check expiration date checkbox when no date was set', function() {
- shareModel.get('linkShare').expiration = null;
- dialog.render();
-
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(false);
- expect(dialog.$el.find('.datepicker').val()).toEqual('');
- });
- it('does not check expiration date checkbox for new share', function() {
- dialog.render();
-
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(false);
- expect(dialog.$el.find('.datepicker').val()).toEqual('');
- });
- it('checks expiration date checkbox and populates field when expiration date was set', function() {
- shareModel.get('linkShare').expiration = '2014-02-01 00:00:00';
- dialog.render();
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- expect(dialog.$el.find('.datepicker').val()).toEqual('01-02-2014');
- });
- it('sets default date when default date setting is enabled', function() {
- configModel.set('isDefaultExpireDateEnabled', true);
- dialog.render();
- dialog.$el.find('.linkCheckbox').click();
- // here fetch would be called and the server returns the expiration date
- shareModel.get('linkShare').expiration = '2014-1-27 00:00:00';
- dialog.render();
-
- // enabled by default
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- expect(dialog.$el.find('.datepicker').val()).toEqual('27-01-2014');
-
- // disabling is allowed
- dialog.$el.find('[name=expirationCheckbox]').click();
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(false);
- });
- it('enforces default date when enforced date setting is enabled', function() {
- configModel.set({
- isDefaultExpireDateEnabled: true,
- isDefaultExpireDateEnforced: true
- });
- dialog.render();
- dialog.$el.find('.linkCheckbox').click();
- // here fetch would be called and the server returns the expiration date
- shareModel.get('linkShare').expiration = '2014-1-27 00:00:00';
- dialog.render();
-
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- expect(dialog.$el.find('.datepicker').val()).toEqual('27-01-2014');
-
- // disabling is not allowed
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true);
- dialog.$el.find('[name=expirationCheckbox]').click();
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- });
- it('enforces default date when enforced date setting is enabled and password is enforced', function() {
- configModel.set({
- enforcePasswordForPublicLink: true,
- isDefaultExpireDateEnabled: true,
- isDefaultExpireDateEnforced: true
- });
- dialog.render();
- dialog.$el.find('.linkCheckbox').click();
- // here fetch would be called and the server returns the expiration date
- shareModel.get('linkShare').expiration = '2014-1-27 00:00:00';
- dialog.render();
-
- //Enter password
- dialog.$el.find('.linkPassText').val('foo');
- dialog.$el.find('.linkPassText').trigger(new $.Event('keyup', {keyCode: 13}));
- fakeServer.requests[0].respond(
- 200,
- { 'Content-Type': 'application/json' },
- JSON.stringify({data: {token: 'xyz'}, status: 'success'})
- );
-
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- expect(dialog.$el.find('.datepicker').val()).toEqual('27-01-2014');
-
- // disabling is not allowed
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('disabled')).toEqual(true);
- dialog.$el.find('[name=expirationCheckbox]').click();
- expect(dialog.$el.find('[name=expirationCheckbox]').prop('checked')).toEqual(true);
- });
- it('sets picker minDate to today and no maxDate by default', function() {
- dialog.render();
- dialog.$el.find('.linkCheckbox').click();
- dialog.$el.find('[name=expirationCheckbox]').click();
- expect($.datepicker._defaults.minDate).toEqual(expectedMinDate);
- expect($.datepicker._defaults.maxDate).toEqual(null);
- });
- it('limits the date range to X days after share time when enforced', function() {
- configModel.set({
- isDefaultExpireDateEnabled: true,
- isDefaultExpireDateEnforced: true
- });
- dialog.render();
- dialog.$el.find('.linkCheckbox').click();
- expect($.datepicker._defaults.minDate).toEqual(expectedMinDate);
- expect($.datepicker._defaults.maxDate).toEqual(new Date(2014, 0, 27, 0, 0, 0, 0));
- });
- it('limits the date range to X days after share time when enforced, even when redisplayed the next days', function() {
- // item exists, was created two days ago
- var shareItem = shareModel.get('linkShare');
- shareItem.expiration = '2014-1-27';
- // share time has time component but must be stripped later
- shareItem.stime = new Date(2014, 0, 20, 11, 0, 25).getTime() / 1000;
- configModel.set({
- isDefaultExpireDateEnabled: true,
- isDefaultExpireDateEnforced: true
- });
- dialog.render();
- expect($.datepicker._defaults.minDate).toEqual(expectedMinDate);
- expect($.datepicker._defaults.maxDate).toEqual(new Date(2014, 0, 27, 0, 0, 0, 0));
- });
- });
-
});
describe('check for avatar', function() {
beforeEach(function() {
@@ -455,8 +273,8 @@ describe('OC.Share.ShareDialogView', function() {
it('test correct function calls', function() {
expect(avatarStub.calledThrice).toEqual(true);
expect(placeholderStub.callCount).toEqual(4);
- expect(dialog.$('.shareWithList').children().length).toEqual(5);
- expect(dialog.$('.avatar').length).toEqual(6);
+ expect(dialog.$('.shareWithList').children().length).toEqual(6);
+ expect(dialog.$('.avatar').length).toEqual(7);
});
it('test avatar owner', function() {
diff --git a/lib/private/Share/Share.php b/lib/private/Share/Share.php
index 52e0628987b..0a9371d35b8 100644
--- a/lib/private/Share/Share.php
+++ b/lib/private/Share/Share.php
@@ -86,7 +86,6 @@ class Share extends Constants {
);
if(count(self::$backendTypes) === 1) {
Util::addScript('core', 'merged-share-backend');
- \OC_Util::addStyle('core', 'share');
}
return true;
}