fix: integrate correct AddCategories (#4926)

fixes duplication of AddCategories function.
calls the correct AddCategories function

#### Does this PR need a docs update or release note?
- [x]  No

#### Type of change
- [x] 🐛 Bugfix

#### Issue(s)
#4754 

#### Test Plan

<!-- How will this be tested prior to merging.-->
- [x] 💪 Manual
- [x]  Unit test
- [x] 💚 E2E
This commit is contained in:
Hitesh Pattanayak 2023-12-23 00:49:41 +05:30 committed by GitHub
parent a1590e0d2f
commit 926489d004
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 22 deletions

View File

@ -226,30 +226,11 @@ func sharePointBackupCreateSelectors(
sel := selectors.NewSharePointBackup(append(slices.Clone(sites), weburls...))
return addCategories(sel, cats), nil
return utils.AddCategories(sel, cats), nil
}
func includeAllSitesWithCategories(ins idname.Cacher, categories []string) *selectors.SharePointBackup {
return addCategories(selectors.NewSharePointBackup(ins.IDs()), categories)
}
func addCategories(sel *selectors.SharePointBackup, cats []string) *selectors.SharePointBackup {
// Issue #2631: Libraries are the only supported feature for SharePoint at this time.
if len(cats) == 0 {
sel.Include(sel.LibraryFolders(selectors.Any()))
}
for _, d := range cats {
switch d {
// [TODO] uncomment when lists are enabled
// case flags.DataLists:
// sel.Include(sel.Lists(selectors.Any()))
case flags.DataLibraries:
sel.Include(sel.LibraryFolders(selectors.Any()))
}
}
return sel
return utils.AddCategories(selectors.NewSharePointBackup(ins.IDs()), categories)
}
// ------------------------------------------------------------------------------------------------

View File

@ -69,7 +69,7 @@ func MakeSharePointOpts(cmd *cobra.Command) SharePointOpts {
func SharePointAllowedCategories() map[string]struct{} {
return map[string]struct{}{
flags.DataLibraries: {},
// flags.DataLists: {},
// flags.DataLists: {}, [TODO]: uncomment when lists are enabled
}
}