Do conversion inside collections.Add
This commit is contained in:
parent
05dee79560
commit
c932df0252
@ -10,6 +10,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
|
"github.com/microsoftgraph/msgraph-sdk-go/models"
|
||||||
"github.com/spatialcurrent/go-lazy/pkg/lazy"
|
"github.com/spatialcurrent/go-lazy/pkg/lazy"
|
||||||
|
|
||||||
"github.com/alcionai/corso/src/internal/common/idname"
|
"github.com/alcionai/corso/src/internal/common/idname"
|
||||||
@ -193,11 +194,11 @@ func newColl(
|
|||||||
// Adds an itemID to the collection. This will make it eligible to be
|
// Adds an itemID to the collection. This will make it eligible to be
|
||||||
// populated. The return values denotes if the item was previously
|
// populated. The return values denotes if the item was previously
|
||||||
// present or is new one.
|
// present or is new one.
|
||||||
func (oc *Collection) Add(cdi CorsoDriveItemable) bool {
|
func (oc *Collection) Add(item models.DriveItemable) bool {
|
||||||
// _, found := oc.driveItems[ptr.Val(item.GetId())]
|
// _, found := oc.driveItems[ptr.Val(item.GetId())]
|
||||||
// oc.driveItems[ptr.Val(item.GetId())] = item
|
// oc.driveItems[ptr.Val(item.GetId())] = item
|
||||||
|
|
||||||
//cdi := ToCorsoDriveItemable(item)
|
cdi := ToCorsoDriveItemable(item)
|
||||||
_, found := oc.driveItems[ptr.Val(cdi.GetId())]
|
_, found := oc.driveItems[ptr.Val(cdi.GetId())]
|
||||||
oc.driveItems[ptr.Val(cdi.GetId())] = cdi
|
oc.driveItems[ptr.Val(cdi.GetId())] = cdi
|
||||||
|
|
||||||
|
|||||||
@ -696,7 +696,7 @@ func (c *Collections) handleDelete(
|
|||||||
|
|
||||||
func (c *Collections) getCollectionPath(
|
func (c *Collections) getCollectionPath(
|
||||||
driveID string,
|
driveID string,
|
||||||
item CorsoDriveItemable,
|
item models.DriveItemable,
|
||||||
) (path.Path, error) {
|
) (path.Path, error) {
|
||||||
var (
|
var (
|
||||||
pb = odConsts.DriveFolderPrefixBuilder(driveID)
|
pb = odConsts.DriveFolderPrefixBuilder(driveID)
|
||||||
@ -845,7 +845,7 @@ func (c *Collections) PopulateDriveCollections(
|
|||||||
|
|
||||||
func (c *Collections) processItem(
|
func (c *Collections) processItem(
|
||||||
ctx context.Context,
|
ctx context.Context,
|
||||||
di models.DriveItemable,
|
item models.DriveItemable,
|
||||||
driveID, driveName string,
|
driveID, driveName string,
|
||||||
oldPrevPaths, currPrevPaths, newPrevPaths map[string]string,
|
oldPrevPaths, currPrevPaths, newPrevPaths map[string]string,
|
||||||
seenFolders map[string]string,
|
seenFolders map[string]string,
|
||||||
@ -855,7 +855,7 @@ func (c *Collections) processItem(
|
|||||||
counter *count.Bus,
|
counter *count.Bus,
|
||||||
skipper fault.AddSkipper,
|
skipper fault.AddSkipper,
|
||||||
) error {
|
) error {
|
||||||
item := ToCorsoDriveItemable(di)
|
// item := ToCorsoDriveItemable(di)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
itemID = ptr.Val(item.GetId())
|
itemID = ptr.Val(item.GetId())
|
||||||
@ -870,7 +870,7 @@ func (c *Collections) processItem(
|
|||||||
"item_is_folder", isFolder)
|
"item_is_folder", isFolder)
|
||||||
|
|
||||||
if item.GetMalware() != nil {
|
if item.GetMalware() != nil {
|
||||||
addtl := graph.ItemInfo(di)
|
addtl := graph.ItemInfo(item)
|
||||||
skip := fault.FileSkip(fault.SkipMalware, driveID, itemID, itemName, addtl)
|
skip := fault.FileSkip(fault.SkipMalware, driveID, itemID, itemName, addtl)
|
||||||
|
|
||||||
if isFolder {
|
if isFolder {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user