From e18ddb073506d082cc6c52d4d499e68ede5b7c9c Mon Sep 17 00:00:00 2001 From: Eliezer Steinbock <3090527+elie222@users.noreply.github.com> Date: Fri, 19 Dec 2025 14:06:59 +0200 Subject: [PATCH 1/2] Allow processing history against read emails --- .../assistant/BulkRunRules.tsx | 56 ++++++++++++++++--- version.txt | 2 +- 2 files changed, 49 insertions(+), 9 deletions(-) diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx index 55bbfef6f3..3ad145b1f6 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx @@ -1,6 +1,7 @@ "use client"; import { useRef, useState } from "react"; +import Link from "next/link"; import { HistoryIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; import { SectionDescription } from "@/components/Typography"; @@ -23,6 +24,9 @@ import { } from "@/components/ui/dialog"; import { useAccount } from "@/providers/EmailAccountProvider"; import { fetchWithAccount } from "@/utils/fetch"; +import { Toggle } from "@/components/Toggle"; +import { hasTierAccess } from "@/utils/premium"; +import { usePremiumModal } from "@/app/(app)/premium/PremiumModal"; export function BulkRunRules() { const { emailAccountId } = useAccount(); @@ -36,12 +40,19 @@ export function BulkRunRules() { const queue = useAiQueueState(); - const { hasAiAccess, isLoading: isLoadingPremium } = usePremium(); + const { hasAiAccess, isLoading: isLoadingPremium, tier } = usePremium(); + const { PremiumModal, openModal } = usePremiumModal(); + + const isBusinessPlusTier = hasTierAccess({ + tier: tier || null, + minimumTier: "BUSINESS_PLUS_MONTHLY", + }); const [running, setRunning] = useState(false); const [startDate, setStartDate] = useState(); const [endDate, setEndDate] = useState(); + const [includeRead, setIncludeRead] = useState(false); const [runResult, setRunResult] = useState<{ count: number; } | null>(null); @@ -69,8 +80,9 @@ export function BulkRunRules() { {data && ( <> - This runs your rules on unread emails currently in your inbox - (that have not been previously processed). + This runs your rules on {includeRead ? "all" : "unread"}{" "} + emails currently in your inbox (that have not been previously + processed). {processedThreadIds.size > 0 && ( @@ -84,7 +96,7 @@ export function BulkRunRules() { )} {hasAiAccess ? ( -
+
{ @@ -108,6 +120,29 @@ export function BulkRunRules() { />
+
+ setIncludeRead(enabled)} + disabled={running || !isBusinessPlusTier} + /> + {!isBusinessPlusTier && ( + { + e.preventDefault(); + openModal(); + }} + className="text-sm text-primary hover:underline whitespace-nowrap" + > + Upgrade to Professional to enable + + )} +
+ +
@@ -183,7 +219,11 @@ export function BulkRunRules() { // fetch batches of messages and add them to the ai queue async function onRun( emailAccountId: string, - { startDate, endDate }: { startDate: Date; endDate?: Date }, + { + startDate, + endDate, + includeRead, + }: { startDate: Date; endDate?: Date; includeRead?: boolean }, onThreadsQueued: (threadIds: string[]) => void, onComplete: ( status: "success" | "error" | "cancelled", @@ -207,7 +247,7 @@ async function onRun( limit: LIMIT, after: startDate, ...(endDate ? { before: endDate } : {}), - isUnread: true, + ...(!includeRead ? { isUnread: true } : {}), ...(nextPageToken ? { nextPageToken } : {}), }; diff --git a/version.txt b/version.txt index 098c5314fa..2f1bd38e4b 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v2.25.0 +v2.25.1 From ee29103729e4150a7494e89f94a7137e13370f04 Mon Sep 17 00:00:00 2001 From: Eliezer Steinbock <3090527+elie222@users.noreply.github.com> Date: Fri, 19 Dec 2025 14:30:12 +0200 Subject: [PATCH 2/2] fix --- apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx | 2 +- version.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx b/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx index 3ad145b1f6..de502f0a08 100644 --- a/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx +++ b/apps/web/app/(app)/[emailAccountId]/assistant/BulkRunRules.tsx @@ -141,7 +141,6 @@ export function BulkRunRules() { )}
-