Browse Source

Do not show action menu if no actions are available

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
tags/v14.0.0beta4
John Molakvoæ (skjnldsv) 5 years ago
parent
commit
b082278f04
No account linked to committer's email address
2 changed files with 12 additions and 4 deletions
  1. 7
    1
      apps/files/js/fileactions.js
  2. 5
    3
      apps/files_sharing/js/share.js

+ 7
- 1
apps/files/js/fileactions.js View File

@@ -558,7 +558,13 @@
}
});

this._renderMenuTrigger($tr, context);
var menuActions = Object.values(this.actions.all).filter(function (action) {
return action.type !== OCA.Files.FileActions.TYPE_INLINE;
});
// do not render the menu if nothing is in it
if (menuActions.length > 0) {
this._renderMenuTrigger($tr, context);
}

if (triggerEvent){
fileList.$fileList.trigger(jQuery.Event("fileActionsReady", {fileList: fileList, $files: $tr}));

+ 5
- 3
apps/files_sharing/js/share.js View File

@@ -42,14 +42,16 @@
var fileActions = fileList.fileActions;
var oldCreateRow = fileList._createRow;
fileList._createRow = function(fileData) {

var tr = oldCreateRow.apply(this, arguments);
var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData);
if (fileData.permissions === 0) {
// no permission, disabling sidebar
delete fileActions.actions.all.Comment;
delete fileActions.actions.all.Details;
delete fileActions.actions.all.Goto;
}

var tr = oldCreateRow.apply(this, arguments);
var sharePermissions = OCA.Sharing.Util.getSharePermissions(fileData);
tr.attr('data-share-permissions', sharePermissions);
if (fileData.shareOwner) {
tr.attr('data-share-owner', fileData.shareOwner);

Loading…
Cancel
Save