Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement quickaccess removal for delete-action #14723

Closed
wants to merge 2 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,7 @@
var removeFunction = function(fileName) {
var $tr = self.findFileEl(fileName);
self.showFileBusyState($tr, true);
self.removeFromQuickaccess(dir + fileName);
return self.filesClient.remove(dir + '/' + fileName)
.done(function() {
if (OC.joinPaths(self.getCurrentDirectory(), '/') === OC.joinPaths(dir, '/')) {
Expand Down Expand Up @@ -2979,6 +2980,41 @@
});
},

/**
* Remove Item from Quickaccesslist, recursively remove all folders lying beneath the appfolder
*
* @param {String} appfolder folder to be removed
*/
removeFromQuickaccess: function(appfolder){

var quickAccessList = 'sublist-favorites';
var listULElements = document.getElementById(quickAccessList);
if (!listULElements) {
return;
}

var apppath=appfolder;
if(appfolder.startsWith("//")){
apppath=appfolder.substring(1, appfolder.length);
}

$(listULElements).find('[data-dir="' + apppath + '"]').remove();


$(listULElements).children().each(function(i) {
if($(this).attr('data-dir').match(appfolder+"/[\\s\\S]*")){
$(this).remove();
}
});

if (listULElements.childElementCount === 0) {
var collapsibleButton = $(listULElements).parent().find('button.collapse');
collapsibleButton.hide();
$("#button-collapse-parent-favorites").removeClass('collapsible');
}

},

/**
* Creates the file summary section
*/
Expand Down