fix: remove duplicate old() function causing 500 on create page #58

Merged
rafaga21 merged 2 commits from feat/dashboard-aggregated-chart into master 2026-06-13 11:54:19 -04:00
Owner
  • Removed the local old() function definition from views/servers/create.php
    which conflicted with the global old() in src/Helpers/functions.php:37
  • Replaced all old() calls with direct htmlspecialchars([...]) lookups

Latest addition: Notification read receipts

New files

  • database/migrations/008_notification_reads.sql — notification_reads table (unique on notification_id + user_id)
  • Migrates existing read notifications into the new table

Modified files

  • src/Models/Notification.php — markAsRead inserts into notification_reads; getForUser JOINs to show per-user read status; getUnreadCount checks NOT EXISTS; getAll() includes read_count subquery
  • src/Controllers/AdminController.php — passes totalActiveUsers to view
  • views/admin/notifications.php — replaced 'Status' column with 'Read by' column showing X/Y readers for broadcast, Read/Unread for targeted
  • public/assets/css/style.css — added .badge-secondary style

Behavior

Notification type Admin view shows
All Users (broadcast) 3 / 15 (read count / total active users)
Specific user Read or Unread badge

Latest addition: Android Foreground Service for real-time notifications

New files

  • android/.../service/NotificationForegroundService.kt — persistent foreground service polling every 30s, START_STICKY for auto-restart

Modified files

  • AndroidManifest.xml — added FOREGROUND_SERVICE + FOREGROUND_SERVICE_DATA_SYNC permissions, service declaration
  • NotificationHelper.kt — added silent channel for persistent service notification
  • ServerManagerApp.kt — starts foreground service on create
  • MainActivity.kt — removed redundant Worker check (service handles background)
  • build.gradle.kts — bumped to v1.8.0 (versionCode 12)
  • public/sysadmin.apk — rebuilt APK

Behavior

State Mechanism Interval
Foreground NotificationPoller (in-app) 30s
Background NotificationForegroundService 30s
Process killed START_STICKY re-creates service Auto
Boot Foreground service started by App class Auto

The persistent notification (low priority, silent) shows "Monitoring for notifications" — required by Android 12+ for foreground services.

- Removed the local old() function definition from views/servers/create.php which conflicted with the global old() in src/Helpers/functions.php:37 - Replaced all old() calls with direct htmlspecialchars([...]) lookups --- ## Latest addition: Notification read receipts ### New files - `database/migrations/008_notification_reads.sql` — notification_reads table (unique on notification_id + user_id) - Migrates existing read notifications into the new table ### Modified files - `src/Models/Notification.php` — markAsRead inserts into notification_reads; getForUser JOINs to show per-user read status; getUnreadCount checks NOT EXISTS; getAll() includes read_count subquery - `src/Controllers/AdminController.php` — passes totalActiveUsers to view - `views/admin/notifications.php` — replaced 'Status' column with 'Read by' column showing X/Y readers for broadcast, Read/Unread for targeted - `public/assets/css/style.css` — added .badge-secondary style ### Behavior | Notification type | Admin view shows | |-------------------|-----------------| | All Users (broadcast) | `3 / 15` (read count / total active users) | | Specific user | `Read` or `Unread` badge | --- ## Latest addition: Android Foreground Service for real-time notifications ### New files - `android/.../service/NotificationForegroundService.kt` — persistent foreground service polling every 30s, START_STICKY for auto-restart ### Modified files - `AndroidManifest.xml` — added FOREGROUND_SERVICE + FOREGROUND_SERVICE_DATA_SYNC permissions, service declaration - `NotificationHelper.kt` — added silent channel for persistent service notification - `ServerManagerApp.kt` — starts foreground service on create - `MainActivity.kt` — removed redundant Worker check (service handles background) - `build.gradle.kts` — bumped to v1.8.0 (versionCode 12) - `public/sysadmin.apk` — rebuilt APK ### Behavior | State | Mechanism | Interval | |-------|-----------|----------| | Foreground | NotificationPoller (in-app) | 30s | | Background | NotificationForegroundService | 30s | | Process killed | START_STICKY re-creates service | Auto | | Boot | Foreground service started by App class | Auto | The persistent notification (low priority, silent) shows "Monitoring for notifications" — required by Android 12+ for foreground services.
rafaga21 added 1 commit 2026-06-13 11:44:07 -04:00
- Removed the local old() function definition from views/servers/create.php
  which conflicted with the global old() in src/Helpers/functions.php:37
- Replaced all old() calls with direct htmlspecialchars([...]) lookups
agent added 1 commit 2026-06-13 11:48:11 -04:00
- New notification_reads table (migration 008) with unique (notification_id, user_id)
- Notification model: markAsRead inserts into notification_reads; getForUser JOINs
  to show per-user read status; getUnreadCount checks NOT EXISTS in reads table
- getAll() includes read_count subquery for admin view
- Admin view shows 'X / Y' read count for broadcast notifications,
  'Read'/'Unread' badge for user-targeted ones
- Migrates existing read notifications into notification_reads
- AGENTS.md updated with new conventions
rafaga21 merged commit 839d5a190f into master 2026-06-13 11:54:19 -04:00
rafaga21 deleted branch feat/dashboard-aggregated-chart 2026-06-13 11:54:20 -04:00
Sign in to join this conversation.
No Reviewers
No Label
2 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: devlab/server-manager#58