User Tools

Site Tools


wiki:manara:bugs:137

#137 — notifications still not working on live (Resolved)

← Back to Manara Bugs · View issue #137 in MantisBT


Reported by: Khaled Tarabay on 2026-07-29T07:34:32+01:00
Assigned to: Claude
Resolved by: Claude on 2026-07-29T07:48:29+01:00
Severity: major
Priority: high
Reproducibility: always
Category: General

Description: still when creating a task or a maintenance job or assigning any kind of action to an employee the notifications tab still doesn't show it at all, recheck accordingly because we tested on live and still it didn't work

Resolution: FIXED + verified end-to-end. Two things were wrong, plus the most likely LIVE cause.

What I found

1) Notifications were ONLY raised on TASK assignment. Assigning a MAINTENANCE job or an INSTALLATION to an employee raised NOTHING (no notifyEmployee call existed in either controller) — yet the ticket names maintenance explicitly. Real gap. 2) The task page's “Assign” button (TaskController::assignTo) STILL skipped a self-assignment (“if employeeId !== Auth::id()”), even though Mantis #119 already established a self-assignment SHOULD notify (an owner assigning a task to themselves is the exact “I get no notification” case). store()/update() already didn't skip it — assignTo was the last inconsistent path. So an owner who assigned a task to themselves via that button got nothing.

What I fixed (all in app/controllers/)

- TaskController.php (assignTo): removed the self-skip — every assignment notifies the assignee now, matching store()/update()/#119. - MaintenanceController.php: store() notifies the assigned technician (category maintenance_assigned, entity 'maintenance'); update() notifies when the job is (re)assigned to someone new. Added “use App\Core\Notification”. - InstallationController.php: same — store()/update() now notify the assigned technician (category installation_assigned, entity 'installation'). Both entity types were already mapped in Notification::ENTITY_ROUTES, so clicking the bell item routes to the job.

Verified it ACTUALLY works (real HTTP, signed-in session, against the DB AND the rendered UI, all test rows cleaned up)

- Create a task assigned to a technician → that technician gets an in-app notification (entity=task). - Assign a task to YOURSELF via the Assign button → YOU now get one (the #2 fix). - Create a maintenance job assigned to a technician → notification (entity=maintenance). [NEW] - Create an installation assigned to a technician → notification (entity=installation). [NEW] - The topbar BELL renders the unread badge + lists the item, and the /notifications page shows it. - Full PHPUnit suite green (29 tests / 859 assertions). All three controllers php -l clean.

The most likely reason it "still doesn't work on LIVE" (please action this)

The whole notification system is deliberately BEST-EFFORT: every write is wrapped in try/catch and swallowed so a notification failure can never break the task/job it's attached to. The single most common way that silently produces “no notifications at all” is the `notifications` TABLE not existing on the production DB. That table was added to the app AFTER the initial schema, as migration 022 — an incrementally-grown prod DB that never ran it simply has no table, so every notifyEmployee() call logs an error server-side and returns, showing the user nothing.

ACTION on prod: 1. Open /run-migrations.php?token=… — it applies migration 022 (CREATE TABLE IF NOT EXISTS notifications) among others. This is almost certainly the live fix by itself; the mechanism is proven working once the table exists. 2. Upload this task's 3 changed controllers (TaskController, MaintenanceController, InstallationController) so maintenance/installation/self-assign also notify. 3. Confirm the notification feature's own files are present on live (they're from an earlier build): app/classes/Core/Notification.php, app/controllers/NotificationController.php, app/views/partials/header.php (the bell), app/views/notifications/*, and the /notifications routes in app/routes/web.php. If the bell already renders on live, these are present and the table (step 1) is the cause.

If it still shows nothing after step 1, grab one server error-log line from a task assignment — notifyEmployee logs the exact reason (“Notification::notifyEmployee failed: …”).

Activity / Notes

  • 2026-07-29T07:48:27+01:00 - Claude: FIXED + verified end-to-end. Two things were wrong, plus the most likely LIVE cause.

What I found

1) Notifications were ONLY raised on TASK assignment. Assigning a MAINTENANCE job or an INSTALLATION to an employee raised NOTHING (no notifyEmployee call existed in either controller) — yet the ticket names maintenance explicitly. Real gap. 2) The task page's “Assign” button (TaskController::assignTo) STILL skipped a self-assignment (“if employeeId !== Auth::id()”), even though Mantis #119 already established a self-assignment SHOULD notify (an owner assigning a task to themselves is the exact “I get no notification” case). store()/update() already didn't skip it — assignTo was the last inconsistent path. So an owner who assigned a task to themselves via that button got nothing.

What I fixed (all in app/controllers/)

- TaskController.php (assignTo): removed the self-skip — every assignment notifies the assignee now, matching store()/update()/#119. - MaintenanceController.php: store() notifies the assigned technician (category maintenance_assigned, entity 'maintenance'); update() notifies when the job is (re)assigned to someone new. Added “use App\Core\Notification”. - InstallationController.php: same — store()/update() now notify the assigned technician (category installation_assigned, entity 'installation'). Both entity types were already mapped in Notification::ENTITY_ROUTES, so clicking the bell item routes to the job.

Verified it ACTUALLY works (real HTTP, signed-in session, against the DB AND the rendered UI, all test rows cleaned up)

- Create a task assigned to a technician → that technician gets an in-app notification (entity=task). - Assign a task to YOURSELF via the Assign button → YOU now get one (the #2 fix). - Create a maintenance job assigned to a technician → notification (entity=maintenance). [NEW] - Create an installation assigned to a technician → notification (entity=installation). [NEW] - The topbar BELL renders the unread badge + lists the item, and the /notifications page shows it. - Full PHPUnit suite green (29 tests / 859 assertions). All three controllers php -l clean.

The most likely reason it "still doesn't work on LIVE" (please action this)

The whole notification system is deliberately BEST-EFFORT: every write is wrapped in try/catch and swallowed so a notification failure can never break the task/job it's attached to. The single most common way that silently produces “no notifications at all” is the `notifications` TABLE not existing on the production DB. That table was added to the app AFTER the initial schema, as migration 022 — an incrementally-grown prod DB that never ran it simply has no table, so every notifyEmployee() call logs an error server-side and returns, showing the user nothing.

ACTION on prod: 1. Open /run-migrations.php?token=… — it applies migration 022 (CREATE TABLE IF NOT EXISTS notifications) among others. This is almost certainly the live fix by itself; the mechanism is proven working once the table exists. 2. Upload this task's 3 changed controllers (TaskController, MaintenanceController, InstallationController) so maintenance/installation/self-assign also notify. 3. Confirm the notification feature's own files are present on live (they're from an earlier build): app/classes/Core/Notification.php, app/controllers/NotificationController.php, app/views/partials/header.php (the bell), app/views/notifications/*, and the /notifications routes in app/routes/web.php. If the bell already renders on live, these are present and the table (step 1) is the cause.

If it still shows nothing after step 1, grab one server error-log line from a task assignment — notifyEmployee logs the exact reason (“Notification::notifyEmployee failed: …”).

Full History

Date User Field Change
2026-07-29T07:34:32+01:00 Khaled Tarabay issue-new New Issue
2026-07-29T07:48:23+01:00 Claude Assigned To ⇒ Claudine
2026-07-29T07:48:25+01:00 Claude tag-added Tag Attached: done-by-claude
2026-07-29T07:48:27+01:00 Claude note-added Note Added: 0000096
2026-07-29T07:48:29+01:00 Claude Status new ⇒ resolved

Synced automatically from MantisBT issue #137.

wiki/manara/bugs/137.txt · Last modified: by mantisbot