The fastest, cheapest, most efficient open-source agent harness. Run more than 500 agents on a $10 VPS.
Rust agent-orchestrationai-agentsai-assistantdesktopllmlocal-firstmcppersonal-aiprivacyrustsecond-braintauri
refactor(notifications): strip action buttons from CoreNotificationCard
Steven Enamakelecb158d1ba81
diff --git a/app/src/components/notifications/CoreNotificationCard.tsx b/app/src/components/notifications/CoreNotificationCard.tsxindex 1ef12194b1..712a2e6fe3 100644--- a/app/src/components/notifications/CoreNotificationCard.tsx+++ b/app/src/components/notifications/CoreNotificationCard.tsx@@ -1,20 +1,7 @@-import debug from 'debug';-import { useState } from 'react';-import { useT } from '../../lib/i18n/I18nContext';-import { callCoreRpc } from '../../services/coreRpcClient';-import { useAppDispatch } from '../../store/hooks';-import {- clearNotificationActions,- markRead,- type NotificationItem,-} from '../../store/notificationSlice';-import Button from '../ui/Button';+import { type NotificationItem } from '../../store/notificationSlice';import NotificationBody from './NotificationBody';-// Namespaced debug per project logging rules (mirrors nativeNotifications).-const log = debug('notifications:core-card');-/** Relative human-readable time string from epoch ms, e.g. "2m ago". */function relativeTime(timestampMs: number): string {const diff = Math.max(0, Date.now() - timestampMs);@@ -27,62 +14,25 @@ function relativeTime(timestampMs: number): string {return `${Math.floor(h / 24)}d ago`;}-/**- * Map a known meeting auto-join action id to its i18n key so button labels- * are localized rather than trusting the (English) label the core sends.- * Unknown action ids fall back to the server-provided label.- */-const ACTION_LABEL_KEYS: Record<string, string> = {- join_listen: 'notifications.meeting.joinListen',- join_active: 'notifications.meeting.joinActive',- skip: 'notifications.meeting.skip',- always_join: 'notifications.meeting.alwaysJoin',-};--/** Primary (filled) vs secondary (outline) styling per action id. */-function isPrimaryAction(actionId: string): boolean {- return actionId === 'join_listen' || actionId === 'join_active';-}-interface Props {notification: NotificationItem;}/**- * Renders a core-originated notification (from `state.notifications.items`)- * that carries action buttons — e.g. the calendar auto-join prompt- * (issue #3507). Clicking a button dispatches the- * `openhuman.agent_meetings_notification_action` RPC and marks the item read.+ * Display-only fallback for a core-originated notification (from+ * `state.notifications.items`) that carries actions but has no dedicated card.+ *+ * Both action-producing domains today — the approval gate and flow approvals —+ * render through `GateApprovalCard` / `FlowApprovalCard`, so nothing currently+ * reaches this card. It stays as the catch-all so an action-carrying+ * notification from a future producer is still *shown* rather than silently+ * dropped: `NotificationCenter` sources core items only through this branch.+ * It deliberately renders no buttons — the meeting auto-join prompt that owned+ * them went with the Meet domain, and its+ * `openhuman.agent_meetings_notification_action` RPC no longer exists.*/const CoreNotificationCard = ({ notification: n }: Props) => {const { t } = useT();- const dispatch = useAppDispatch();- const [pendingActionId, setPendingActionId] = useState<string | null>(null);- const [error, setError] = useState<string | null>(null);-- const handleAction = async (actionId: string, payload: unknown) => {- if (pendingActionId) return; // ignore double-clicks while a call is in flight- setPendingActionId(actionId);- setError(null);- log('action click id=%s notification=%s', actionId, n.id);- try {- await callCoreRpc<{ ok: boolean }>({- method: 'openhuman.agent_meetings_notification_action',- params: { action_id: actionId, payload },- });- log('action ok id=%s', actionId);- dispatch(markRead({ id: n.id }));- // Remove the buttons so the handled prompt can't be re-clicked (which would- // re-fire bot:join, or flip always_join after a skip). Without this the- // card stays pinned in NotificationCenter with live actions.- dispatch(clearNotificationActions({ id: n.id }));- } catch (err) {- log('action failed id=%s err=%o', actionId, err);- setError(t('notifications.meeting.actionError'));- } finally {- setPendingActionId(null);- }- };return (<div@@ -119,30 +69,7 @@ const CoreNotificationCard = ({ notification: n }: Props) => {</p>)}- {/* Action buttons */}- {n.actions && n.actions.length > 0 && (- <div className="flex flex-wrap items-center gap-2 mt-2">- {n.actions.map(action => {- const labelKey = ACTION_LABEL_KEYS[action.actionId];- const label = labelKey ? t(labelKey) : action.label;- const primary = isPrimaryAction(action.actionId);- return (- <Button- key={action.actionId}- variant={primary ? 'primary' : 'secondary'}- size="xs"- disabled={pendingActionId !== null}- onClick={() => {- void handleAction(action.actionId, action.payload);- }}>- {label}- </Button>- );- })}- </div>- )}- {error && <p className="text-xs text-red-600 mt-1.5">{error}</p>}</div></div></div>