Skip to content

Commit b6ed384

Browse files
authored
revert(analytics): hide disconnected inboxes on the dashboard cards again (#1117)
1 parent f03a366 commit b6ed384

5 files changed

Lines changed: 6 additions & 103 deletions

File tree

apps/builder/src/app/space/[workspaceId]/dashboard/layout.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,15 +38,7 @@ export default async function DashboardLayout({
3838
const cloud = isCloud()
3939
const { targetWorkspace } = userAndWorkspace
4040
const [inboxesResult, { blocked, blockReason }] = await Promise.all([
41-
// Disconnected inboxes stay listed: Settings -> Channels shows an
42-
// integration whether or not its inbox is still connected, so hiding them
43-
// here made a channel silently disappear from one surface while remaining
44-
// on the other, with nothing on screen explaining the difference.
45-
listInboxes({
46-
workspaceId,
47-
includes: ["integration"],
48-
statuses: ["connected", "disconnected"],
49-
}),
41+
listInboxes({ workspaceId, includes: ["integration"] }),
5042
resolveWorkspaceBlockState(targetWorkspace.ownerId),
5143
])
5244
const inboxes = inboxesResult.data.filter((inbox) => inbox.channel !== "smtp")
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import type { ListInboxesResponse } from "@chatbotx.io/business"
2-
import { inboxService, type ListInboxesInput } from "@chatbotx.io/business"
2+
import { inboxService, type ListInboxesRequest } from "@chatbotx.io/business"
33

44
export async function listInboxes(
5-
input: ListInboxesInput,
5+
input: ListInboxesRequest,
66
): Promise<ListInboxesResponse> {
77
return await inboxService.list(input)
88
}

packages/business/__tests__/inbox-service-list-status.test.ts

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

packages/business/src/inbox/schema.ts

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type { InboxStatus } from "@chatbotx.io/database/partials"
21
import { createSelectSchema, inboxModel } from "@chatbotx.io/database/schema"
32
import { zodBigintAsString } from "@chatbotx.io/utils"
43
import { z } from "zod"
@@ -18,26 +17,6 @@ export const listInboxesRequest = z.object({
1817
})
1918
export type ListInboxesRequest = z.infer<typeof listInboxesRequest>
2019

21-
/**
22-
* Server-side input for `inboxService.list`, deliberately NOT part of
23-
* `listInboxesRequest`.
24-
*
25-
* `publishInboxesRequest` is `listInboxesRequest.omit({ workspaceId: true })`,
26-
* so anything added to that schema immediately becomes a documented parameter
27-
* of the public `/v1/inboxes` and `/v1/channels` endpoints. `statuses` is an
28-
* internal rendering concern, so it rides alongside the schema instead: every
29-
* oRPC handler passes only the zod-parsed request and therefore keeps the
30-
* connected-only default, while a server component that needs the wider list
31-
* asks for it explicitly.
32-
*/
33-
export type ListInboxesInput = ListInboxesRequest & {
34-
/**
35-
* Inbox statuses to include. Omitted means `["connected"]` — the
36-
* long-standing behaviour every existing caller relies on.
37-
*/
38-
statuses?: readonly InboxStatus[]
39-
}
40-
4120
export const inboxResource = createSelectSchema(inboxModel, {
4221
id: zodBigintAsString(),
4322
workspaceId: zodBigintAsString(),

packages/business/src/inbox/service.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import { channelLimitReachedException } from "../errors"
2424
import { logger } from "../logger"
2525
import { quotaEnforcementService } from "../quota-enforcement/service"
2626
import { workspaceUsageService } from "../workspace-usage/service"
27-
import type { ListInboxesInput, ListInboxesResponse } from "./schema"
27+
import type { ListInboxesRequest, ListInboxesResponse } from "./schema"
2828

2929
type InboxWhere = Partial<{ id: string; workspaceId: string }>
3030

@@ -40,16 +40,12 @@ class InboxService extends BaseService {
4040
integrationTiktok: true,
4141
}
4242

43-
async list(input: ListInboxesInput): Promise<ListInboxesResponse> {
43+
async list(input: ListInboxesRequest): Promise<ListInboxesResponse> {
4444
// One `where`, shared by the page query and the count, so the two can
4545
// never drift (they previously repeated the same literal side by side).
46-
// `statuses` omitted keeps the connected-only default every existing
47-
// caller — including the public `/v1/inboxes` endpoint — depends on.
4846
const where = {
4947
workspaceId: input.workspaceId,
50-
status: input.statuses
51-
? { in: [...input.statuses] }
52-
: inboxStatuses.enum.connected,
48+
status: inboxStatuses.enum.connected,
5349
}
5450

5551
const pagination = getPaginationWithDefaults(input)

0 commit comments

Comments
 (0)