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:
ashmrtn 2023-03-23 08:27:21 -07:00 committed by GitHub
parent a9c4479a7b
commit 6f99bba624
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -38,29 +38,24 @@ func (mc *mailFolderCache) init(
// populateMailRoot manually fetches directories that are not returned during Graph for msgraph-sdk-go v. 40+ // 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. // 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. // Action ensures that cache will stop at appropriate level.
// @error iff the struct is not properly instantiated // @error iff the struct is not properly instantiated
func (mc *mailFolderCache) populateMailRoot(ctx context.Context) error { func (mc *mailFolderCache) populateMailRoot(ctx context.Context) error {
for _, fldr := range []string{rootFolderAlias, DefaultMailFolder} { f, err := mc.getter.GetContainerByID(ctx, mc.userID, rootFolderAlias)
var directory string
f, err := mc.getter.GetContainerByID(ctx, mc.userID, fldr)
if err != nil { if err != nil {
return clues.Wrap(err, "fetching root folder") return clues.Wrap(err, "fetching root folder")
} }
if fldr == DefaultMailFolder { temp := graph.NewCacheFolder(
directory = DefaultMailFolder 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
temp := graph.NewCacheFolder(f, // the user doesn't see in the regular UI for Exchange.
path.Builder{}.Append(directory), // storage path path.Builder{}.Append(), // storage path
path.Builder{}.Append(directory)) // display location path.Builder{}.Append()) // display location
if err := mc.addFolder(temp); err != nil { if err := mc.addFolder(temp); err != nil {
return clues.Wrap(err, "adding resolver dir").WithClues(ctx) return clues.Wrap(err, "adding resolver dir").WithClues(ctx)
} }
}
return nil return nil
} }