Minor cleanup to mail resolver fetch (#2808)
Remove old code that explicitly fetched the Inbox. The issue in Graph SDK that was causing this is no longer present.
Retrieval of Inbox is tested by [test](41f0b86073/src/internal/connector/exchange/data_collections_test.go (L235)) for making collections
---
#### Does this PR need a docs update or release note?
- [ ] ✅ Yes, it's included
- [ ] 🕐 Yes, but in a later PR
- [x] ⛔ No
#### Type of change
- [ ] 🌻 Feature
- [ ] 🐛 Bugfix
- [ ] 🗺️ Documentation
- [ ] 🤖 Test
- [ ] 💻 CI/Deployment
- [x] 🧹 Tech Debt/Cleanup
#### Issue(s)
* #2486
#### Test Plan
- [ ] 💪 Manual
- [x] ⚡ Unit test
- [ ] 💚 E2E
This commit is contained in:
parent
a9c4479a7b
commit
6f99bba624
@ -38,28 +38,23 @@ func (mc *mailFolderCache) init(
|
||||
|
||||
// populateMailRoot manually fetches directories that are not returned during Graph for msgraph-sdk-go v. 40+
|
||||
// rootFolderAlias is the top-level directory for exchange.Mail.
|
||||
// DefaultMailFolder is the traditional "Inbox" for exchange.Mail
|
||||
// Action ensures that cache will stop at appropriate level.
|
||||
// @error iff the struct is not properly instantiated
|
||||
func (mc *mailFolderCache) populateMailRoot(ctx context.Context) error {
|
||||
for _, fldr := range []string{rootFolderAlias, DefaultMailFolder} {
|
||||
var directory string
|
||||
f, err := mc.getter.GetContainerByID(ctx, mc.userID, rootFolderAlias)
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "fetching root folder")
|
||||
}
|
||||
|
||||
f, err := mc.getter.GetContainerByID(ctx, mc.userID, fldr)
|
||||
if err != nil {
|
||||
return clues.Wrap(err, "fetching root folder")
|
||||
}
|
||||
|
||||
if fldr == DefaultMailFolder {
|
||||
directory = DefaultMailFolder
|
||||
}
|
||||
|
||||
temp := graph.NewCacheFolder(f,
|
||||
path.Builder{}.Append(directory), // storage path
|
||||
path.Builder{}.Append(directory)) // display location
|
||||
if err := mc.addFolder(temp); err != nil {
|
||||
return clues.Wrap(err, "adding resolver dir").WithClues(ctx)
|
||||
}
|
||||
temp := graph.NewCacheFolder(
|
||||
f,
|
||||
// Root folder doesn't store any mail messages so it isn't given any paths.
|
||||
// Giving it a path/location would cause us to add extra path elements that
|
||||
// the user doesn't see in the regular UI for Exchange.
|
||||
path.Builder{}.Append(), // storage path
|
||||
path.Builder{}.Append()) // display location
|
||||
if err := mc.addFolder(temp); err != nil {
|
||||
return clues.Wrap(err, "adding resolver dir").WithClues(ctx)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user