Skip to content

Commit 18bdec2

Browse files
authored
Revert "[parents_migration] Add and backfill Google Drive "Shared with me" fo…" (#9543)
This reverts commit 5176705.
1 parent 5176705 commit 18bdec2

File tree

5 files changed

+6
-70
lines changed

5 files changed

+6
-70
lines changed

connectors/migrations/20241218_backfill_gdrive_shared_with_me.ts

Lines changed: 0 additions & 37 deletions
This file was deleted.

connectors/src/connectors/google_drive/index.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
409409
// that are not living in a shared drive.
410410
nodes.push({
411411
provider: c.type,
412-
internalId: getInternalId(GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID),
412+
internalId: GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID,
413413
parentInternalId: null,
414414
type: "folder" as const,
415415
preventSelection: true,
@@ -435,10 +435,7 @@ export class GoogleDriveConnectorManager extends BaseConnectorManager<null> {
435435
// The "Shared with me" view requires to look for folders
436436
// with the flag `sharedWithMe=true`, but there is no need to check for the parents.
437437
let gdriveQuery = `mimeType='application/vnd.google-apps.folder'`;
438-
if (
439-
parentInternalId ===
440-
getInternalId(GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID)
441-
) {
438+
if (parentInternalId === GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID) {
442439
gdriveQuery += ` and sharedWithMe=true`;
443440
} else {
444441
gdriveQuery += ` and '${parentDriveId}' in parents`;

connectors/src/connectors/google_drive/temporal/activities.ts

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,7 @@ import StatsD from "hot-shots";
77
import PQueue from "p-queue";
88
import { Op } from "sequelize";
99

10-
import {
11-
GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID,
12-
GOOGLE_DRIVE_USER_SPACE_VIRTUAL_DRIVE_ID,
13-
} from "@connectors/connectors/google_drive/lib/consts";
10+
import { GOOGLE_DRIVE_USER_SPACE_VIRTUAL_DRIVE_ID } from "@connectors/connectors/google_drive/lib/consts";
1411
import { getGoogleDriveObject } from "@connectors/connectors/google_drive/lib/google_drive_api";
1512
import { getFileParentsMemoized } from "@connectors/connectors/google_drive/lib/hierarchy";
1613
import { syncOneFile } from "@connectors/connectors/google_drive/temporal/file";
@@ -57,26 +54,6 @@ type LightGoogleDrive = {
5754

5855
export const statsDClient = new StatsD();
5956

60-
/**
61-
* Upserts to data_sources_folders (core) a top-level folder "Shared with me".
62-
*/
63-
export async function upsertSharedWithMeFolder(connectorId: ModelId) {
64-
const connector = await ConnectorResource.fetchById(connectorId);
65-
if (!connector) {
66-
throw new Error(`Connector ${connectorId} not found`);
67-
}
68-
69-
const folderId = getInternalId(GOOGLE_DRIVE_SHARED_WITH_ME_VIRTUAL_ID);
70-
await upsertDataSourceFolder({
71-
dataSourceConfig: dataSourceConfigFromConnector(connector),
72-
folderId,
73-
parents: [folderId],
74-
parentId: null,
75-
title: "Shared with me",
76-
mimeType: "application/vnd.dust.googledrive.folder",
77-
});
78-
}
79-
8057
export async function getDrives(
8158
connectorId: ModelId
8259
): Promise<LightGoogleDrive[]> {

connectors/src/connectors/google_drive/temporal/workflows.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ const {
2525
garbageCollectorFinished,
2626
markFolderAsVisited,
2727
shouldGarbageCollect,
28-
upsertSharedWithMeFolder,
2928
} = proxyActivities<typeof activities>({
3029
startToCloseTimeout: "20 minutes",
3130
});
@@ -105,8 +104,6 @@ export async function googleDriveFullSync({
105104
}
106105
});
107106

108-
await upsertSharedWithMeFolder(connectorId);
109-
110107
// Temp to clean up the running workflows state
111108
foldersToBrowse = uniq(foldersToBrowse);
112109

connectors/src/resources/connector/google_drive.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ import type { Transaction } from "sequelize";
33

44
import {
55
GoogleDriveConfig,
6+
GoogleDriveSheet,
7+
} from "@connectors/lib/models/google_drive";
8+
import {
69
GoogleDriveFiles,
710
GoogleDriveFolders,
8-
GoogleDriveSheet,
911
GoogleDriveSyncToken,
1012
} from "@connectors/lib/models/google_drive";
1113
import type {

0 commit comments

Comments
 (0)