Exclude hidden files from recent recommendations#354
Exclude hidden files from recent recommendations#354blkqi wants to merge 1 commit intonextcloud:masterfrom
Conversation
Signed-off-by: Brett Kleinschmidt <blk@blk.me>
7225783 to
80d1349
Compare
| try { | ||
| $next = $next->getParent(); | ||
| } catch (NotFoundException $e) { | ||
| break; |
There was a problem hiding this comment.
won't you run into an infinite loop here?
I think you would be better off with recursion. If the current node is hidden, you return false. If there is a parent you return $this->isNodeExcluded($node->getParent(), $showHidden);. Else you return false.
There was a problem hiding this comment.
Thank you for taking a look!
The sequence ends when a dotfile is found (return true) or the root node is found (break). In other words, it is always bounded by the depth of the node. If there were a clearer way to identify the root node other than by exception handling then I would be more than happy to use it.
While I agree that recursion is generally a more natural approach to tree traversal problems, I don't think anything is lost in this context by iterating. And in the recursive case, we would want to introduce a new function so that isNodeExcluded can be adapted to other types of exclusions related to the target node (name, mimetype, tag, etc.).
|
Please rebase? 🙈 |
Resolves #71 by
getMostRecentRecommendationto better allow for filtering of results.isNodeExcludedin order to exclude nodes which are either hidden files or descendants of hidden folders. A traversal of the file system hierarchy is necessary to find hidden ancestors, which greatly reduces the worst-case time complexity.The number of candidate files is arbitrarily limited by 10 times the actual number requested.