Skip to content
Open
6 changes: 6 additions & 0 deletions PR_DESCRIPTION_DRAFT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# fix(dashboard): remove default active status filter from subscribers table (#2538)
Comment thread
cubic-dev-ai[bot] marked this conversation as resolved.
Outdated

## Summary
Resolves #2538 by removing the pre-selected `status: ["active"]` filter on the subscribers data table so pending subscribers and newly configured pages are visible without requiring manual filter resets.

Closes #2538
29 changes: 29 additions & 0 deletions packages/api/src/router/statusPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
upsertSelfSignupSubscriber,
verifySelfSignupSubscriber,
} from "@openstatus/services/page-subscriber";
import { sendEmailVerification } from "@openstatus/subscriptions";
import { TRPCError } from "@trpc/server";
import { endOfDay, startOfDay, subDays } from "date-fns";
import { z } from "zod";
Expand Down Expand Up @@ -1252,6 +1253,34 @@ export const statusPageRouter = createTRPCRouter({
});
}

const baseUrl = _page.customDomain
? `https://${_page.customDomain}`
: process.env.NEXT_PUBLIC_APP_URL
? `${process.env.NEXT_PUBLIC_APP_URL}`
: `https://${_page.slug}.openstatus.dev`;
const verifyUrl = `${baseUrl}/verify/${subscription.token}`;

try {
await sendEmailVerification(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1: A visitor now receives two subscription confirmation emails. This PR sends the verification email directly in statusPage.subscribe, but the status-page frontend (header.tsx) still calls emailRouter.sendPageSubscriptionVerification in the subscribe mutation's onSuccess, and that procedure also resends the same verification email for the same subscriber/token. Since sendPageSubscription doesn't set a Resend idempotency key, both emails are delivered. Inline the server-side send here and drop the frontend follow-up call (or the reverse), so only one email is sent.

Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/api/src/router/statusPage.ts, line 1264:

<comment>A visitor now receives two subscription confirmation emails. This PR sends the verification email directly in `statusPage.subscribe`, but the status-page frontend (`header.tsx`) still calls `emailRouter.sendPageSubscriptionVerification` in the subscribe mutation's `onSuccess`, and that procedure also resends the same verification email for the same subscriber/token. Since `sendPageSubscription` doesn't set a Resend idempotency key, both emails are delivered. Inline the server-side send here and drop the frontend follow-up call (or the reverse), so only one email is sent.</comment>

<file context>
@@ -1252,6 +1253,34 @@ export const statusPageRouter = createTRPCRouter({
+      const verifyUrl = `${baseUrl}/verify/${subscription.token}`;
+
+      try {
+        await sendEmailVerification(
+          {
+            id: subscription.id,
</file context>

{
id: subscription.id,
pageId: _page.id,
pageName: _page.title || _page.slug,
pageSlug: _page.slug,
channelType: "email",
email: opts.input.email,
token: subscription.token,
componentIds: opts.input.subscribeComponents
? opts.input.pageComponents
: [],
customDomain: _page.customDomain,
},
verifyUrl,
);
} catch (err) {
console.error("Failed to send subscription verification email:", err);
}

return { id: subscription.id, token: subscription.token };
}),

Expand Down
Loading