Skip to content

feat(notifications): add "False Alarm" discard action with undo toast for email status changes - #97

Merged
SagiEv merged 8 commits into
mainfrom
bugfix/general
Nov 6, 2026
Merged

SagiEv merged 8 commits into
mainfrom
bugfix/general

Conversation

@SagiEv

@SagiEv SagiEv commented Nov 6, 2026

Copy link
Copy Markdown
Owner

Summary

Resolves false-positive email classifications by introducing a "False Alarm" action directly on Dashboard notifications. Clicking it immediately reverts an auto-updated job application status back to its previous state, restores the original application date, removes the false event from the activity log, and displays an Undo toast allowing the user to restore the change if clicked by mistake.


Key Changes

1. Frontend (React / Vite)

  • Dashboard Notifications (DashboardPage.jsx):
    • Added a compact False Alarm button on actionable email sync notifications.
    • Immediate Execution: Clicking the button instantly reverts the status and updates the notification state to ✓ Reverted to prevent duplicate clicks.
    • Undo Toast: Pops up an interactive toast with an Undo button. Clicking Undo restores the status back to the detected state.
  • Query Hook (useNotifications.js):
    • Added revertNotification and unrevertNotification mutations.
    • Automatically invalidates React Query caches for ['notifications'], ['applications'], and ['dailyStats'].

2. Backend Orchestrator (Node.js / Express)

  • API Endpoints (notifications.routes.js, notifications.controller.js):
    • POST /api/notifications/:id/revert: Reverts application status and date, wipes the false activity log event, and marks notification as reverted.
    • POST /api/notifications/:id/unrevert: Undoes the revert and reapplies the detected status if requested from the Undo toast.
  • Service Layer (notifications.service.js):
    • Date Rollback: Accurately restores applications.date to the previous date (from metadata snapshot or prior history event).
    • Clean Activity Log: Deletes the auto-updated entry from application_history (applicationHistoryRepo.remove) without creating dummy notes, keeping the activity timeline and last_activity_date (ghosting metrics) completely intact.
    • Legacy Fallback: Gracefully deduces previous status and date from history even for existing notifications created before this change.
  • Mail Poller (mailPoller.service.js):
    • Snapshots previous_status and previous_date in the notification metadata payload upon auto-update.
  • Repository (notifications.repository.js):
    • Added findById and update methods with defensive fallback handling if schema columns are not yet migrated in Supabase.

3. Database (Supabase)

  • Migration (20261106000000_add_notifications_metadata.sql):
    • Adds metadata JSONB DEFAULT '{}'::jsonb and reverted BOOLEAN DEFAULT false to the notifications table with an index on reverted.

Testing & Verification

  • Unit Tests: backend/tests/services/notifications.service.test.js (7/7 tests passing).
  • Backend Test Suite: All 51 test suites and 405 tests passing (npm run test).
  • Frontend Build: Successfully built with Vite (npm run build).

@vercel

vercel Bot commented Nov 6, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
job-pilot Ready Ready Preview Nov 6, 2026 12:32am UTC

@SagiEv
SagiEv merged commit d9d728c into main Nov 6, 2026
6 checks passed

This branch was successfully deployed

1 active deployment
Preview — 2f0694df Deployed Nov 6, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant