diff options
Diffstat (limited to 'core/js/shareitemmodel.js')
-rw-r--r-- | core/js/shareitemmodel.js | 50 |
1 files changed, 49 insertions, 1 deletions
diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index a784f59f67f..ae4c07e3f4e 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -272,6 +272,10 @@ return this.get('allowPublicUploadStatus'); }, + isPublicEditingAllowed: function() { + return this.get('allowPublicEditingStatus'); + }, + /** * @returns {boolean} */ @@ -345,6 +349,14 @@ }, /** + * @returns {string} + */ + getReshareWithDisplayName: function() { + var reshare = this.get('reshare'); + return reshare.share_with_displayname || reshare.share_with; + }, + + /** * @returns {number} */ getReshareType: function() { @@ -391,6 +403,26 @@ return share.share_with_displayname; }, + /** + * returns the array index of a sharee for a provided shareId + * + * @param shareId + * @returns {number} + */ + findShareWithIndex: function(shareId) { + var shares = this.get('shares'); + if(!_.isArray(shares)) { + throw "Unknown Share"; + } + for(var i = 0; i < shares.length; i++) { + var shareWith = shares[i]; + if(shareWith.id === shareId) { + return i; + } + } + throw "Unknown Sharee"; + }, + getShareType: function(shareIndex) { /** @type OC.Share.Types.ShareInfo **/ var share = this.get('shares')[shareIndex]; @@ -553,7 +585,7 @@ return superShare; }, - fetch: function() { + fetch: function(options) { var model = this; this.trigger('request', this); @@ -577,6 +609,10 @@ shares: sharesMap, reshare: reshare })); + + if(!_.isUndefined(options) && _.isFunction(options.success)) { + options.success(); + } }); return deferred; @@ -647,6 +683,17 @@ }); } + var allowPublicEditingStatus = true; + if(!_.isUndefined(data.shares)) { + $.each(data.shares, function (key, value) { + if (value.share_type === OC.Share.SHARE_TYPE_LINK) { + allowPublicEditingStatus = (value.permissions & OC.PERMISSION_UPDATE) ? true : false; + return true; + } + }); + } + + var hideFileListStatus = false; if(!_.isUndefined(data.shares)) { $.each(data.shares, function (key, value) { @@ -730,6 +777,7 @@ linkShare: linkShare, permissions: permissions, allowPublicUploadStatus: allowPublicUploadStatus, + allowPublicEditingStatus: allowPublicEditingStatus, hideFileListStatus: hideFileListStatus }; }, |