feat: send notification to all users when app version is updated

This commit is contained in:
2026-06-13 17:12:54 -04:00
parent eda923dc44
commit 4fa57e8688

View File

@@ -228,6 +228,25 @@ class AdminController
}
}
$this->auditService->log('app_version_updated', 'config', null, ['details' => 'App version config updated']);
$version = $_POST['app_version'] ?? '';
$notes = $_POST['release_notes'] ?? '';
if (!empty($version)) {
$notificationModel = new Notification();
$noteId = $notificationModel->create([
'user_id' => null,
'title' => "Version {$version} is now available",
'message' => "New version {$version} has been released.\n\n" . strip_tags($notes),
'type' => 'info',
]);
$fcm = new FCMService();
if ($fcm->isConfigured()) {
$fcm->sendToAll("Version {$version} is now available", strip_tags($notes), 'info', $noteId);
}
}
Session::setFlash('success', 'App version updated successfully.');
$this->view->redirect('/admin/app-version');
return;