Skip to content

Commit

Permalink
Add method documentation
Browse files Browse the repository at this point in the history
add param checks
  • Loading branch information
felixheidecke committed Oct 8, 2019
1 parent 7cf0fde commit a26dc88
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -1723,7 +1723,18 @@
return OC.linkToRemoteBase('dav') + '/files/' + uid + encodedPath;
},

/**
* Fetch shareTypes of a certain directory
* @param {String} dir directory string
* @return {Promise} object with name and shareTypes
*/
getDirShareInfo: function(dir) {
// Dir can't be empty
if (typeof dir !== 'string' || dir.length === 0) {
console.error('getDirShareInfo(). param must be typeof string and can not be empty!')
return false
}

var client = this.filesClient
var options = {
properties : ['{' + OC.Files.Client.NS_OWNCLOUD + '}share-types']
Expand All @@ -1741,10 +1752,21 @@
})
},

/**
* Fetch shareInfos recursively from current
* directory down to root
* @param {String} dir directory string
* @return {Promise} array of objects with name and shareTypes
*/
getPathShareInfo: function(path) {
if (typeof dir !== 'string') {
console.error('getDirShareInfo(). param must be typeof string!')
return false
}

var crumbs = [];
var pathToHere = '';
var parts = (path === '/') ? ['/'] : path.split('/')
var parts = (path === '/' || path.length === 0) ? ['/'] : path.split('/')

for (var i = 0; i < parts.length; i++) {
var part = parts[i];
Expand Down

0 comments on commit a26dc88

Please sign in to comment.