summaryrefslogtreecommitdiffstats
path: root/core/js/shareitemmodel.js
diff options
context:
space:
mode:
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 d883497433f..0c8b5f6f199 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}
*/