summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorVincent Petry <pvince81@owncloud.com>2016-11-30 20:56:10 +0100
committerArthur Schiwon <blizzz@arthur-schiwon.de>2016-12-22 18:35:32 +0100
commit14256d631cf32d8774c7fcffe322d65f964fcd5d (patch)
tree871fc9174c2060060772ede82ac884d7980b98ff /core
parent453f3beffaf629efa5c715f7ca88b5c0a1034af8 (diff)
downloadnextcloud-server-14256d631cf32d8774c7fcffe322d65f964fcd5d.tar.gz
nextcloud-server-14256d631cf32d8774c7fcffe322d65f964fcd5d.zip
Use group display name in sharing API + UI
Diffstat (limited to 'core')
-rw-r--r--core/js/sharedialogresharerinfoview.js2
-rw-r--r--core/js/shareitemmodel.js8
-rw-r--r--core/js/tests/specs/sharedialogviewSpec.js23
-rw-r--r--core/js/tests/specs/shareitemmodelSpec.js5
4 files changed, 35 insertions, 3 deletions
diff --git a/core/js/sharedialogresharerinfoview.js b/core/js/sharedialogresharerinfoview.js
index 654eebf4997..9a9d95cfb60 100644
--- a/core/js/sharedialogresharerinfoview.js
+++ b/core/js/sharedialogresharerinfoview.js
@@ -80,7 +80,7 @@
'core',
'Shared with you and the group {group} by {owner}',
{
- group: this.model.getReshareWith(),
+ group: this.model.getReshareWithDisplayName(),
owner: ownerDisplayName
}
);
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index b01f0f790ac..9b10f067afc 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -345,6 +345,14 @@
},
/**
+ * @returns {string}
+ */
+ getReshareWithDisplayName: function() {
+ var reshare = this.get('reshare');
+ return reshare.share_with_displayname || reshare.share_with;
+ },
+
+ /**
* @returns {number}
*/
getReshareType: function() {
diff --git a/core/js/tests/specs/sharedialogviewSpec.js b/core/js/tests/specs/sharedialogviewSpec.js
index 985610d51fb..cbb74714ff7 100644
--- a/core/js/tests/specs/sharedialogviewSpec.js
+++ b/core/js/tests/specs/sharedialogviewSpec.js
@@ -975,16 +975,35 @@ describe('OC.Share.ShareDialogView', function() {
dialog.render();
expect(dialog.$el.find('.shareWithField').prop('disabled')).toEqual(true);
});
- it('shows reshare owner', function() {
+ it('shows reshare owner for single user share', function() {
shareModel.set({
reshare: {
- uid_owner: 'user1'
+ uid_owner: 'user1',
+ displayname_owner: 'User One',
+ share_type: OC.Share.SHARE_TYPE_USER
},
shares: [],
permissions: OC.PERMISSION_READ
});
dialog.render();
expect(dialog.$el.find('.resharerInfoView .reshare').length).toEqual(1);
+ expect(dialog.$el.find('.resharerInfoView .reshare').text().trim()).toEqual('Shared with you by User One');
+ });
+ it('shows reshare owner for single user share', function() {
+ shareModel.set({
+ reshare: {
+ uid_owner: 'user1',
+ displayname_owner: 'User One',
+ share_with: 'group2',
+ share_with_displayname: 'Group Two',
+ share_type: OC.Share.SHARE_TYPE_GROUP
+ },
+ shares: [],
+ permissions: OC.PERMISSION_READ
+ });
+ dialog.render();
+ expect(dialog.$el.find('.resharerInfoView .reshare').length).toEqual(1);
+ expect(dialog.$el.find('.resharerInfoView .reshare').text().trim()).toEqual('Shared with you and the group Group Two by User One');
});
it('does not show reshare owner if owner is current user', function() {
shareModel.set({
diff --git a/core/js/tests/specs/shareitemmodelSpec.js b/core/js/tests/specs/shareitemmodelSpec.js
index 1cddcb2acaa..3d3baf75d15 100644
--- a/core/js/tests/specs/shareitemmodelSpec.js
+++ b/core/js/tests/specs/shareitemmodelSpec.js
@@ -190,6 +190,7 @@ describe('OC.Share.ShareItemModel', function() {
uid_owner: 'owner',
displayname_owner: 'Owner',
share_with: 'root',
+ share_with_displayname: 'Wurzel',
permissions: 1
},
{
@@ -221,7 +222,11 @@ describe('OC.Share.ShareItemModel', function() {
// user share has higher priority
expect(reshare.share_type).toEqual(OC.Share.SHARE_TYPE_USER);
expect(reshare.share_with).toEqual('root');
+ expect(reshare.share_with_displayname).toEqual('Wurzel');
expect(reshare.id).toEqual('1');
+
+ expect(model.getReshareWith()).toEqual('root');
+ expect(model.getReshareWithDisplayName()).toEqual('Wurzel');
});
it('does not parse link share when for a different file', function() {
/* jshint camelcase: false */