summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-21 11:29:42 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-11-23 13:32:13 +0100
commit9d95391ff14a1c753e8fda4ecaacc007572552f4 (patch)
treee6ebac228b44b83fbfa10645cd9bbe88214c1d54 /apps
parent3a1d8fa45f22503ba9841d71b7ea630d400b2ae5 (diff)
downloadnextcloud-server-9d95391ff14a1c753e8fda4ecaacc007572552f4.tar.gz
nextcloud-server-9d95391ff14a1c753e8fda4ecaacc007572552f4.zip
adjust tests and apply sorting
Signed-off-by: Arthur Schiwon <blizzz@arthur-schiwon.de>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/js/share.js5
-rw-r--r--apps/files_sharing/js/sharedfilelist.js5
-rw-r--r--apps/files_sharing/tests/js/shareSpec.js32
3 files changed, 32 insertions, 10 deletions
diff --git a/apps/files_sharing/js/share.js b/apps/files_sharing/js/share.js
index a7eefe43dbe..9b794ca2d13 100644
--- a/apps/files_sharing/js/share.js
+++ b/apps/files_sharing/js/share.js
@@ -220,9 +220,14 @@
// note: we only update the data attribute because updateIcon()
if (recipients.length) {
$tr.attr('data-share-recipients', OCA.Sharing.Util.formatRecipients(recipients));
+ var recipientData = _.mapObject(shareModel.get('shares'), function (share) {
+ return {shareWith: share.share_with, shareWithDisplayName: share.share_with_displayname};
+ });
+ $tr.attr('data-share-recipient-data', JSON.stringify(recipientData));
}
else {
$tr.removeAttr('data-share-recipients');
+ $tr.removeAttr('data-share-recipient-data');
}
},
diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js
index c7b872772b3..fb4909e764e 100644
--- a/apps/files_sharing/js/sharedfilelist.js
+++ b/apps/files_sharing/js/sharedfilelist.js
@@ -355,7 +355,10 @@
// only store the first ones, they will be the only ones
// displayed
data.recipients[recipient] = true;
- data.recipientData[recipientId] = recipient;
+ data.recipientData[data.recipientsCount] = {
+ 'shareWith': recipientId,
+ 'shareWithDisplayName': recipient
+ };
}
data.recipientsCount++;
}
diff --git a/apps/files_sharing/tests/js/shareSpec.js b/apps/files_sharing/tests/js/shareSpec.js
index 5b0a78c9c64..1b628f5bb0f 100644
--- a/apps/files_sharing/tests/js/shareSpec.js
+++ b/apps/files_sharing/tests/js/shareSpec.js
@@ -140,6 +140,7 @@ describe('OCA.Sharing.Util tests', function() {
size: 12,
permissions: OC.PERMISSION_ALL,
shareOwner: 'User One',
+ shareOwnerId: 'User One',
etag: 'abc',
shareTypes: []
}]);
@@ -161,6 +162,16 @@ describe('OCA.Sharing.Util tests', function() {
size: 12,
permissions: OC.PERMISSION_ALL,
recipientsDisplayName: 'User One, User Two',
+ recipientData: {
+ 0: {
+ shareWith: 'User One',
+ shareWithDisplayName: 'User One'
+ },
+ 1: {
+ shareWith: 'User Two',
+ shareWithDisplayName: 'User Two'
+ }
+ },
etag: 'abc',
shareTypes: [OC.Share.SHARE_TYPE_USER]
}]);
@@ -264,10 +275,10 @@ describe('OCA.Sharing.Util tests', function() {
// simulate updating shares
shareTab._dialog.model.set({
shares: [
- {share_with_displayname: 'User One'},
- {share_with_displayname: 'User Two'},
- {share_with_displayname: 'Group One'},
- {share_with_displayname: 'Group Two'}
+ {share_with_displayname: 'User One', share_with: 'User One'},
+ {share_with_displayname: 'User Two', share_with: 'User Two'},
+ {share_with_displayname: 'Group One', share_with: 'Group One'},
+ {share_with_displayname: 'Group Two', share_with: 'Group Two'}
]
});
@@ -298,9 +309,9 @@ describe('OCA.Sharing.Util tests', function() {
// simulate updating shares
shareTab._dialog.model.set({
shares: [
- {share_with_displayname: 'User One'},
- {share_with_displayname: 'User Two'},
- {share_with_displayname: 'User Three'}
+ {share_with_displayname: 'User One', share_with: 'User One'},
+ {share_with_displayname: 'User Two', share_with: 'User Two'},
+ {share_with_displayname: 'User Three', share_with: 'User Three'}
]
});
@@ -348,7 +359,8 @@ describe('OCA.Sharing.Util tests', function() {
size: 12,
permissions: OC.PERMISSION_ALL,
etag: 'abc',
- shareOwner: 'User One'
+ shareOwner: 'User One',
+ shareOwnerId: 'User One'
}]);
$action = fileList.$el.find('tbody tr:first .action-share');
$tr = fileList.$el.find('tr:first');
@@ -379,7 +391,9 @@ describe('OCA.Sharing.Util tests', function() {
permissions: OC.PERMISSION_ALL,
etag: 'abc',
shareOwner: 'User One',
- recipients: 'User Two'
+ shareOwnerId: 'User One',
+ recipients: 'User Two',
+ recipientData: {'User Two': 'User Two'}
}]);
$action = fileList.$el.find('tbody tr:first .action-share');
$tr = fileList.$el.find('tr:first');