From 12e178dc18105471e04db9550b29dd3e708dd603 Mon Sep 17 00:00:00 2001 From: Flavien David Date: Mon, 6 Jan 2025 09:01:50 +0100 Subject: [PATCH] Remove legacy "autoReadPattern" slack. --- connectors/migrations/db/migration_43.sql | 2 ++ connectors/src/connectors/slack/index.ts | 31 ----------------------- connectors/src/lib/models/slack.ts | 6 ----- types/src/connectors/slack.ts | 2 -- 4 files changed, 2 insertions(+), 39 deletions(-) create mode 100644 connectors/migrations/db/migration_43.sql diff --git a/connectors/migrations/db/migration_43.sql b/connectors/migrations/db/migration_43.sql new file mode 100644 index 000000000000..5a6d5e7f8789 --- /dev/null +++ b/connectors/migrations/db/migration_43.sql @@ -0,0 +1,2 @@ +-- Migration created on Jan 06, 2025 +ALTER TABLE slack_configurations DROP COLUMN "autoReadChannelPattern"; \ No newline at end of file diff --git a/connectors/src/connectors/slack/index.ts b/connectors/src/connectors/slack/index.ts index 8f4d70e864c9..9843b63e7686 100644 --- a/connectors/src/connectors/slack/index.ts +++ b/connectors/src/connectors/slack/index.ts @@ -90,7 +90,6 @@ export class SlackConnectorManager extends BaseConnectorManager> { - const slackConfiguration = - await SlackConfigurationResource.fetchByConnectorId(connectorId); - if (!slackConfiguration) { - return new Err( - new Error( - `Failed to find a Slack configuration for connector ${connectorId}` - ) - ); - } - if (!slackConfiguration.autoReadChannelPattern) { - return new Ok(null); - } - return new Ok(slackConfiguration.autoReadChannelPattern); -} - export async function getAutoReadChannelPatterns( connectorId: ModelId ): Promise> { diff --git a/connectors/src/lib/models/slack.ts b/connectors/src/lib/models/slack.ts index 9ed7481f67d4..8178d926decd 100644 --- a/connectors/src/lib/models/slack.ts +++ b/connectors/src/lib/models/slack.ts @@ -18,7 +18,6 @@ export class SlackConfigurationModel extends BaseModel declare connectorId: ForeignKey; // Whitelisted domains are in the format "domain:group_id". declare whitelistedDomains?: readonly string[]; - declare autoReadChannelPattern?: string | null; declare autoReadChannelPatterns: SlackAutoReadPattern[]; } @@ -47,11 +46,6 @@ SlackConfigurationModel.init( type: DataTypes.ARRAY(DataTypes.STRING), allowNull: true, }, - // TODO(2025-01-02 AutoReadCleanUp) Remove once fully migrated to `autoReadChannelPatterns`. - autoReadChannelPattern: { - type: DataTypes.STRING, - allowNull: true, - }, autoReadChannelPatterns: { type: DataTypes.JSONB, allowNull: true, diff --git a/types/src/connectors/slack.ts b/types/src/connectors/slack.ts index 76429183afe5..a8593f6b939e 100644 --- a/types/src/connectors/slack.ts +++ b/types/src/connectors/slack.ts @@ -21,8 +21,6 @@ export function isSlackAutoReadPatterns( export const SlackConfigurationTypeSchema = t.type({ botEnabled: t.boolean, whitelistedDomains: t.union([t.array(t.string), t.undefined]), - // TODO(2025-01-02 AutoReadCleanUp) Remove once fully migrated to `autoReadChannelPatterns`. - autoReadChannelPattern: t.union([t.string, t.null, t.undefined]), autoReadChannelPatterns: SlackAutoReadPatternsSchema, });