Skip to content

Commit 92d8448

Browse files
fix(slack): remove stale preview gate references
1 parent 81f4086 commit 92d8448

4 files changed

Lines changed: 36 additions & 29 deletions

File tree

apps/sim/app/workspace/[workspaceId]/home/components/message-content/components/special-tags/special-tags.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2319,9 +2319,9 @@ function ServiceAccountConnectDisplay({
23192319
const connected = locallyConnected
23202320

23212321
// Creating a credential mutates the workspace — hide it from read-only
2322-
// members, and honour the provider's own preview gate (custom Slack bots
2323-
// ride the slack_v2 flag) so chat can't surface what the integrations page
2324-
// deliberately hides.
2322+
// members, and honor the owning block's visibility (custom Slack bots follow
2323+
// slack_v2) so chat can't surface what the integrations page deliberately
2324+
// hides.
23252325
if (!target || target.hidden || !canEdit || !workspaceId) return null
23262326

23272327
const label = reconnectCredentialId

apps/sim/blocks/registry-lookup.test.ts

Lines changed: 27 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,33 @@ describe('getBlock prototype safety', () => {
3333
/**
3434
* The list and the detail read must agree about a type.
3535
*
36-
* `slack_v2` is `preview`-gated while `slack` v1 deliberately stays in the
37-
* toolbar so a workspace has a Slack block during the gate. Resolving the
38-
* detail to the newest version and then hiding it answered `404` for a type
39-
* `GET /api/v2/blocks` was publishing in the same breath.
36+
* A preview successor can be hidden while its released base version remains in
37+
* the toolbar. Resolving the detail to the newest version and then hiding it
38+
* would answer `404` for a type `GET /api/v2/blocks` publishes in the same
39+
* breath. Once the successor is released, both surfaces must resolve to it.
4040
*/
4141
describe('version resolution for a viewer', () => {
42-
it.each(['slack', 'table'])(
43-
'resolves %s to a version the unrevealed viewer can actually see',
44-
async (type) => {
45-
const { getLatestBlockForViewer, getAllBlocks } = await import('@/blocks/registry')
46-
47-
const detail = getLatestBlockForViewer(type)
48-
const listed = getAllBlocks().find(
49-
(block) =>
50-
!block.hideFromToolbar && (block.type === type || block.type.startsWith(`${type}_v`))
51-
)
52-
53-
expect(Boolean(detail)).toBe(Boolean(listed))
54-
if (detail && listed) expect(detail.type).toBe(listed.type)
55-
}
56-
)
42+
it('falls back to the released table block while table_v2 is unrevealed', async () => {
43+
const { getLatestBlockForViewer, getAllBlocks } = await import('@/blocks/registry')
44+
const detail = getLatestBlockForViewer('table')
45+
const listed = getAllBlocks().find(
46+
(block) =>
47+
!block.hideFromToolbar && (block.type === 'table' || block.type.startsWith('table_v'))
48+
)
49+
50+
expect(detail?.type).toBe('table')
51+
expect(listed?.type).toBe('table')
52+
})
53+
54+
it('resolves Slack to the released slack_v2 block', async () => {
55+
const { getLatestBlockForViewer, getAllBlocks } = await import('@/blocks/registry')
56+
const detail = getLatestBlockForViewer('slack')
57+
const listed = getAllBlocks().find(
58+
(block) =>
59+
!block.hideFromToolbar && (block.type === 'slack' || block.type.startsWith('slack_v'))
60+
)
61+
62+
expect(detail?.type).toBe('slack_v2')
63+
expect(listed?.type).toBe('slack_v2')
64+
})
5765
})

apps/sim/blocks/registry.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -142,11 +142,10 @@ export function getLatestBlockForViewer(type: string): BlockConfig | undefined {
142142
*
143143
* The detail read walks these rather than taking `getLatestBlock` and hiding
144144
* the result, because "newest" and "visible to this viewer" are different
145-
* questions. `slack_v2` is `preview`-gated while `slack` v1 deliberately stays
146-
* in the toolbar so the workspace has a Slack block at all — so resolving to
147-
* the newest and then hiding it answers `404` for a type the list is
148-
* simultaneously publishing. Walking down to the newest *visible* version is
149-
* what makes the two agree.
145+
* questions. For example, `table_v2` is `preview`-gated while `table` remains
146+
* in the toolbar — so resolving to the newest and then hiding it answers `404`
147+
* for a type the list is simultaneously publishing. Walking down to the newest
148+
* *visible* version is what makes the two agree.
150149
*/
151150
function versionCandidates(type: string): BlockConfig[] {
152151
const normalized = normalizeType(type)

apps/sim/lib/copilot/integration-tools.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ vi.mock('@/blocks/registry-maps', () => ({
99
type: 'svc',
1010
tools: { access: ['svc_send_v2'] },
1111
},
12-
// Preview successor sharing the released block's tools (the slack/slack_v2
13-
// paradigm) — both owners must remain available for projection.
12+
// A preview successor sharing the released block's tools keeps both owners
13+
// available for projection.
1414
svc_v2: {
1515
type: 'svc_v2',
1616
preview: true,

0 commit comments

Comments
 (0)