summaryrefslogtreecommitdiffstats
path: root/core/js/shareitemmodel.js
diff options
context:
space:
mode:
authorThomas Müller <thomas.mueller@tmit.eu>2015-09-24 14:57:23 +0200
committerThomas Müller <thomas.mueller@tmit.eu>2015-09-24 14:57:23 +0200
commitd7a923671fa4b10f74dc615b583f6d4f5935d45b (patch)
tree65331c8392505e13cdb777baa3475fa5ba0732e7 /core/js/shareitemmodel.js
parentbf4c144c6fb1455e01da2dc0b116957fc02b39a9 (diff)
parent0db9b28f3fa6bfdc236218c84a507da47cd29e43 (diff)
downloadnextcloud-server-d7a923671fa4b10f74dc615b583f6d4f5935d45b.tar.gz
nextcloud-server-d7a923671fa4b10f74dc615b583f6d4f5935d45b.zip
Merge pull request #19305 from owncloud/share-hasusershares
Fix ShareItemModel.hasUserShares to only check shares of current item
Diffstat (limited to 'core/js/shareitemmodel.js')
-rw-r--r--core/js/shareitemmodel.js17
1 files changed, 15 insertions, 2 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js
index db80a9aa76f..13396670aae 100644
--- a/core/js/shareitemmodel.js
+++ b/core/js/shareitemmodel.js
@@ -297,8 +297,7 @@
* @returns {boolean}
*/
hasUserShares: function() {
- var shares = this.get('shares');
- return _.isArray(shares) && shares.length > 0;
+ return this.getSharesWithCurrentItem().length > 0;
},
/**
@@ -408,6 +407,20 @@
},
/**
+ * Returns all share entries that only apply to the current item
+ * (file/folder)
+ *
+ * @return {Array.<OC.Share.Types.ShareInfo>}
+ */
+ getSharesWithCurrentItem: function() {
+ var shares = this.get('shares') || [];
+ var fileId = this.fileInfoModel.get('id');
+ return _.filter(shares, function(share) {
+ return share.item_source === fileId;
+ });
+ },
+
+ /**
* @param shareIndex
* @returns {string}
*/