Folders: Allow listing folders with write permission (#83527)
* Folders: Allow listing folders with write permission * Check for subfolder access if parent does not have * Add test * GetFolders: fix ordering * Apply suggestion from code review
This commit is contained in:
committed by
GitHub
parent
39232a0776
commit
1208888bb6
@@ -477,6 +477,10 @@ func (ss *sqlStore) GetFolders(ctx context.Context, q getFoldersQuery) ([]*folde
|
||||
}
|
||||
|
||||
if len(q.ancestorUIDs) == 0 {
|
||||
if q.OrderByTitle {
|
||||
s.WriteString(` ORDER BY f0.title ASC`)
|
||||
}
|
||||
|
||||
err := sess.SQL(s.String(), args...).Find(&partialFolders)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -488,6 +492,9 @@ func (ss *sqlStore) GetFolders(ctx context.Context, q getFoldersQuery) ([]*folde
|
||||
// filter out folders if they are not in the subtree of the given ancestor folders
|
||||
if err := batch(len(q.ancestorUIDs), int(q.BatchSize), func(start2, end2 int) error {
|
||||
s2, args2 := getAncestorsSQL(ss.db.GetDialect(), q.ancestorUIDs, start2, end2, s.String(), args)
|
||||
if q.OrderByTitle {
|
||||
s2 += " ORDER BY f0.title ASC"
|
||||
}
|
||||
err := sess.SQL(s2, args2...).Find(&partialFolders)
|
||||
if err != nil {
|
||||
return err
|
||||
|
||||
Reference in New Issue
Block a user