mirror of https://github.com/buster-so/buster.git
Fix the url builder for slack messages to have correct route
This commit is contained in:
parent
9eae2f6507
commit
2b6cdbe476
|
@ -1,6 +1,7 @@
|
|||
import { db, eq } from '@buster/database/connection';
|
||||
import { checkForDuplicateMessages, updateMessage } from '@buster/database/queries';
|
||||
import { chats, messages } from '@buster/database/schema';
|
||||
import type { AssetType } from '@buster/server-shared';
|
||||
import {
|
||||
SlackMessagingService,
|
||||
addReaction,
|
||||
|
@ -653,7 +654,7 @@ export const slackAgentTask: ReturnType<
|
|||
let responseText = "I've finished working on your request!";
|
||||
let chatFileInfo: {
|
||||
mostRecentFileId: string | null;
|
||||
mostRecentFileType: string | null;
|
||||
mostRecentFileType: AssetType | null;
|
||||
mostRecentVersionNumber: number | null;
|
||||
} | null = null;
|
||||
|
||||
|
@ -750,7 +751,16 @@ export const slackAgentTask: ReturnType<
|
|||
chatFileInfo?.mostRecentFileType &&
|
||||
chatFileInfo?.mostRecentVersionNumber !== null
|
||||
) {
|
||||
buttonUrl = `${busterUrl}/app/chats/${payload.chatId}/${chatFileInfo.mostRecentFileType}s/${chatFileInfo.mostRecentFileId}?${chatFileInfo.mostRecentFileType}_version_number=${chatFileInfo.mostRecentVersionNumber}`;
|
||||
if (chatFileInfo.mostRecentFileType === 'dashboard_file') {
|
||||
buttonUrl = `${busterUrl}/app/dashboards/${chatFileInfo.mostRecentFileId}?dashboard_version_number=${chatFileInfo.mostRecentVersionNumber}`;
|
||||
} else if (chatFileInfo.mostRecentFileType === 'metric_file') {
|
||||
buttonUrl = `${busterUrl}/app/metrics/${chatFileInfo.mostRecentFileId}?metric_version_number=${chatFileInfo.mostRecentVersionNumber}`;
|
||||
} else if (chatFileInfo.mostRecentFileType === 'report_file') {
|
||||
buttonUrl = `${busterUrl}/app/reports/${chatFileInfo.mostRecentFileId}?report_version_number=${chatFileInfo.mostRecentVersionNumber}`;
|
||||
} else {
|
||||
const _exhaustiveCheck: 'chat' | 'collection' = chatFileInfo.mostRecentFileType;
|
||||
buttonUrl = `${busterUrl}/app/chats/${payload.chatId}`;
|
||||
}
|
||||
}
|
||||
|
||||
// Convert markdown to Slack format
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
-- Update existing values in chats table to match asset_type_enum values
|
||||
UPDATE public"chats" SET "most_recent_file_type" = 'metric_file' WHERE "most_recent_file_type" = 'metric';--> statement-breakpoint
|
||||
UPDATE public."chats" SET "most_recent_file_type" = 'dashboard_file' WHERE "most_recent_file_type" = 'dashboard';--> statement-breakpoint
|
||||
UPDATE public."chats" SET "most_recent_file_type" = 'report_file' WHERE "most_recent_file_type" = 'report';--> statement-breakpoint
|
||||
ALTER TABLE "chats" ALTER COLUMN "most_recent_file_type" SET DATA TYPE "public"."asset_type_enum" USING "most_recent_file_type"::"public"."asset_type_enum";--> statement-breakpoint
|
File diff suppressed because it is too large
Load Diff
|
@ -764,6 +764,13 @@
|
|||
"when": 1758572594466,
|
||||
"tag": "0109_icy_supernaut",
|
||||
"breakpoints": true
|
||||
},
|
||||
{
|
||||
"idx": 110,
|
||||
"version": "7",
|
||||
"when": 1758658933810,
|
||||
"tag": "0110_third_ozymandias",
|
||||
"breakpoints": true
|
||||
}
|
||||
]
|
||||
}
|
|
@ -848,7 +848,7 @@ export const chats = pgTable(
|
|||
mode: 'string',
|
||||
}),
|
||||
mostRecentFileId: uuid('most_recent_file_id'),
|
||||
mostRecentFileType: varchar('most_recent_file_type', { length: 255 }),
|
||||
mostRecentFileType: assetTypeEnum('most_recent_file_type'),
|
||||
mostRecentVersionNumber: integer('most_recent_version_number'),
|
||||
slackChatAuthorization: slackChatAuthorizationEnum('slack_chat_authorization'),
|
||||
slackThreadTs: text('slack_thread_ts'),
|
||||
|
|
Loading…
Reference in New Issue