Don't merge directories if they're marked as new (#1940)
## Description If we have a collection marked as new and we have a base directory, do not merge the base with the collection. ## 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 - [x] 🐛 Bugfix - [ ] 🗺️ Documentation - [ ] 🤖 Test - [ ] 💻 CI/Deployment - [ ] 🐹 Trivial/Minor ## Issue(s) * #1740 ## Test Plan - [ ] 💪 Manual - [x] ⚡ Unit test - [ ] 💚 E2E
This commit is contained in:
parent
76ebd7254d
commit
843772ec50
@ -756,7 +756,8 @@ func traverseBaseDir(
|
||||
// in the node. That allows us to propagate subtree operations (e.x. move)
|
||||
// while selectively skipping merging old and new versions for some
|
||||
// directories. The expected usecase for this is delta token expiry in M365.
|
||||
if node.collection != nil && node.collection.DoNotMergeItems() {
|
||||
if node.collection != nil &&
|
||||
(node.collection.DoNotMergeItems() || node.collection.State() == data.NewState) {
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@ -1148,6 +1148,37 @@ func (suite *HierarchyBuilderUnitSuite) TestBuildDirectoryTreeSingleSubtree() {
|
||||
},
|
||||
),
|
||||
},
|
||||
{
|
||||
name: "NewDoesntMerge",
|
||||
inputCollections: func() []data.Collection {
|
||||
mc1 := mockconnector.NewMockExchangeCollection(dirPath, 1)
|
||||
mc1.ColState = data.NewState
|
||||
mc1.Names[0] = testFileName2
|
||||
mc1.Data[0] = testFileData2
|
||||
|
||||
return []data.Collection{mc1}
|
||||
},
|
||||
expected: expectedTreeWithChildren(
|
||||
[]string{
|
||||
testTenant,
|
||||
service,
|
||||
testUser,
|
||||
category,
|
||||
},
|
||||
[]*expectedNode{
|
||||
{
|
||||
name: testInboxDir,
|
||||
children: []*expectedNode{
|
||||
{
|
||||
name: testFileName2,
|
||||
children: []*expectedNode{},
|
||||
data: testFileData2,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
),
|
||||
},
|
||||
}
|
||||
|
||||
for _, test := range table {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user