Folders: Set FullPath and FullPathUIDs when feature flag is off and query requests (#81896)
* set FullPath and FullPathUIDs if feature flag is off and query requests Co-authored-by: Sofia Papagiannaki <1632407+papagian@users.noreply.github.com>
This commit is contained in:
co-authored by
Sofia Papagiannaki
parent
92e05ec8e9
commit
15223a4b85
@@ -148,11 +148,29 @@ func (s *Service) GetFolders(ctx context.Context, q folder.GetFoldersQuery) ([]*
|
||||
}
|
||||
}
|
||||
|
||||
if !s.features.IsEnabled(ctx, featuremgmt.FlagNestedFolders) {
|
||||
qry.WithFullpath = false // do not request full path if nested folders are disabled
|
||||
qry.WithFullpathUIDs = false
|
||||
}
|
||||
|
||||
dashFolders, err := s.store.GetFolders(ctx, qry)
|
||||
if err != nil {
|
||||
return nil, folder.ErrInternal.Errorf("failed to fetch subfolders: %w", err)
|
||||
}
|
||||
|
||||
if !s.features.IsEnabled(ctx, featuremgmt.FlagNestedFolders) {
|
||||
if q.WithFullpathUIDs || q.WithFullpath {
|
||||
for _, f := range dashFolders { // and fix the full path with folder title (unescaped)
|
||||
if q.WithFullpath {
|
||||
f.Fullpath = f.Title
|
||||
}
|
||||
if q.WithFullpathUIDs {
|
||||
f.FullpathUIDs = f.UID
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return dashFolders, nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user