feat: notify all users on app version update #79

Merged
rafaga21 merged 1 commits from feat/version-update-notification into master 2026-06-13 17:13:36 -04:00
Showing only changes of commit 4fa57e8688 - Show all commits

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;