diff options
author | Julius Härtl <jus@bitgrid.net> | 2018-10-30 14:22:33 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2018-11-02 12:09:29 +0100 |
commit | b73e03724c402216ccadb0dab1973f1ddaa14494 (patch) | |
tree | 1f800496784d488d526561bb8897aa913889fbaf /core/js | |
parent | 275cea5d9ceee3236b28df8bda0ba520ffe38db5 (diff) | |
download | nextcloud-server-b73e03724c402216ccadb0dab1973f1ddaa14494.tar.gz nextcloud-server-b73e03724c402216ccadb0dab1973f1ddaa14494.zip |
Show share settings for owner and reshare owners only
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'core/js')
-rw-r--r-- | core/js/share/sharedialogshareelistview.handlebars | 2 | ||||
-rw-r--r-- | core/js/sharedialogshareelistview.js | 5 | ||||
-rw-r--r-- | core/js/shareitemmodel.js | 13 | ||||
-rw-r--r-- | core/js/sharetemplates.js | 20 |
4 files changed, 33 insertions, 7 deletions
diff --git a/core/js/share/sharedialogshareelistview.handlebars b/core/js/share/sharedialogshareelistview.handlebars index 92c07f80290..672888b5ad0 100644 --- a/core/js/share/sharedialogshareelistview.handlebars +++ b/core/js/share/sharedialogshareelistview.handlebars @@ -3,6 +3,7 @@ <li data-share-id="{{shareId}}" data-share-type="{{shareType}}" data-share-with="{{shareWith}}"> <div class="avatar {{#if modSeed}}imageplaceholderseed{{/if}}" data-username="{{shareWith}}" data-avatar="{{shareWithAvatar}}" data-displayname="{{shareWithDisplayName}}" {{#if modSeed}}data-seed="{{shareWith}} {{shareType}}"{{/if}}></div> <span class="username" title="{{shareWithTitle}}">{{shareWithDisplayName}}</span> + {{#if canUpdateShareSettings }} <span class="sharingOptionsGroup"> {{#if editPermissionPossible}} <span> @@ -14,6 +15,7 @@ {{{popoverMenu}}} </div> </span> + {{/if}} </li> {{/each}} {{#each linkReshares}} diff --git a/core/js/sharedialogshareelistview.js b/core/js/sharedialogshareelistview.js index 8b709f0d74d..dc97099dd58 100644 --- a/core/js/sharedialogshareelistview.js +++ b/core/js/sharedialogshareelistview.js @@ -86,6 +86,7 @@ var shareType = this.model.getShareType(shareIndex); var sharedBy = this.model.getSharedBy(shareIndex); var sharedByDisplayName = this.model.getSharedByDisplayName(shareIndex); + var fileOwnerUid = this.model.getFileOwnerUid(shareIndex); var hasPermissionOverride = {}; if (shareType === OC.Share.SHARE_TYPE_GROUP) { @@ -143,6 +144,8 @@ hasCreatePermission: this.model.hasCreatePermission(shareIndex), hasUpdatePermission: this.model.hasUpdatePermission(shareIndex), hasDeletePermission: this.model.hasDeletePermission(shareIndex), + sharedBy: sharedBy, + sharedByDisplayName: sharedByDisplayName, shareWith: shareWith, shareWithDisplayName: shareWithDisplayName, shareWithAvatar: shareWithAvatar, @@ -150,6 +153,8 @@ shareType: shareType, shareId: this.model.get('shares')[shareIndex].id, modSeed: shareWithAvatar || (shareType !== OC.Share.SHARE_TYPE_USER && shareType !== OC.Share.SHARE_TYPE_CIRCLE && shareType !== OC.Share.SHARE_TYPE_ROOM), + owner: fileOwnerUid, + canUpdateShareSettings: (sharedBy === oc_current_user || fileOwnerUid === oc_current_user), isRemoteShare: shareType === OC.Share.SHARE_TYPE_REMOTE, isRemoteGroupShare: shareType === OC.Share.SHARE_TYPE_REMOTE_GROUP, isNoteAvailable: shareType !== OC.Share.SHARE_TYPE_REMOTE && shareType !== OC.Share.SHARE_TYPE_REMOTE_GROUP, diff --git a/core/js/shareitemmodel.js b/core/js/shareitemmodel.js index 1bbdb2448ab..f4f8c023705 100644 --- a/core/js/shareitemmodel.js +++ b/core/js/shareitemmodel.js @@ -455,6 +455,19 @@ }, /** + * @param shareIndex + * @returns {string} + */ + getFileOwnerUid: function(shareIndex) { + /** @type OC.Share.Types.ShareInfo **/ + var share = this.get('shares')[shareIndex]; + if(!_.isObject(share)) { + throw "Unknown Share"; + } + return share.uid_file_owner; + }, + + /** * returns the array index of a sharee for a provided shareId * * @param shareId diff --git a/core/js/sharetemplates.js b/core/js/sharetemplates.js index bd9886e6afd..6ddf05d3284 100644 --- a/core/js/sharetemplates.js +++ b/core/js/sharetemplates.js @@ -300,11 +300,9 @@ templates['sharedialogshareelistview'] = template({"1":function(container,depth0 + alias4(((helper = (helper = helpers.shareWithTitle || (depth0 != null ? depth0.shareWithTitle : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareWithTitle","hash":{},"data":data}) : helper))) + "\">" + alias4(((helper = (helper = helpers.shareWithDisplayName || (depth0 != null ? depth0.shareWithDisplayName : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareWithDisplayName","hash":{},"data":data}) : helper))) - + "</span>\n <span class=\"sharingOptionsGroup\">\n" - + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.editPermissionPossible : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + " <div tabindex=\"0\" class=\"share-menu\"><span class=\"icon icon-more\"></span>\n " - + ((stack1 = ((helper = (helper = helpers.popoverMenu || (depth0 != null ? depth0.popoverMenu : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"popoverMenu","hash":{},"data":data}) : helper))) != null ? stack1 : "") - + "\n </div>\n </span>\n </li>\n"; + + "</span>\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.canUpdateShareSettings : depth0),{"name":"if","hash":{},"fn":container.program(6, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " </li>\n"; },"2":function(container,depth0,helpers,partials,data) { return "imageplaceholderseed"; },"4":function(container,depth0,helpers,partials,data) { @@ -316,6 +314,14 @@ templates['sharedialogshareelistview'] = template({"1":function(container,depth0 + alias4(((helper = (helper = helpers.shareType || (depth0 != null ? depth0.shareType : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"shareType","hash":{},"data":data}) : helper))) + "\""; },"6":function(container,depth0,helpers,partials,data) { + var stack1, helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}); + + return " <span class=\"sharingOptionsGroup\">\n" + + ((stack1 = helpers["if"].call(alias1,(depth0 != null ? depth0.editPermissionPossible : depth0),{"name":"if","hash":{},"fn":container.program(7, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + " <div tabindex=\"0\" class=\"share-menu\"><span class=\"icon icon-more\"></span>\n " + + ((stack1 = ((helper = (helper = helpers.popoverMenu || (depth0 != null ? depth0.popoverMenu : depth0)) != null ? helper : helpers.helperMissing),(typeof helper === "function" ? helper.call(alias1,{"name":"popoverMenu","hash":{},"data":data}) : helper))) != null ? stack1 : "") + + "\n </div>\n </span>\n"; +},"7":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <span>\n <input id=\"canEdit-" @@ -329,7 +335,7 @@ templates['sharedialogshareelistview'] = template({"1":function(container,depth0 + "\">" + alias4(((helper = (helper = helpers.canEditLabel || (depth0 != null ? depth0.canEditLabel : depth0)) != null ? helper : alias2),(typeof helper === alias3 ? helper.call(alias1,{"name":"canEditLabel","hash":{},"data":data}) : helper))) + "</label>\n </span>\n"; -},"8":function(container,depth0,helpers,partials,data) { +},"9":function(container,depth0,helpers,partials,data) { var helper, alias1=depth0 != null ? depth0 : (container.nullContext || {}), alias2=helpers.helperMissing, alias3="function", alias4=container.escapeExpression; return " <li data-share-id=\"" @@ -350,7 +356,7 @@ templates['sharedialogshareelistview'] = template({"1":function(container,depth0 return "<ul id=\"shareWithList\" class=\"shareWithList\">\n" + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.sharees : depth0),{"name":"each","hash":{},"fn":container.program(1, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") - + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.linkReshares : depth0),{"name":"each","hash":{},"fn":container.program(8, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + + ((stack1 = helpers.each.call(alias1,(depth0 != null ? depth0.linkReshares : depth0),{"name":"each","hash":{},"fn":container.program(9, data, 0),"inverse":container.noop,"data":data})) != null ? stack1 : "") + "</ul>\n"; },"useData":true}); templates['sharedialogshareelistview_popover_menu'] = template({"1":function(container,depth0,helpers,partials,data) { |