Merge pull request 'feat: notify all users on app version update' (#79) from feat/version-update-notification into master
Reviewed-on: #79 Reviewed-by: rafaga21 <rafaelminaya20@hotmail.com>
This commit was merged in pull request #79.
This commit is contained in:
@@ -228,6 +228,25 @@ class AdminController
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$this->auditService->log('app_version_updated', 'config', null, ['details' => 'App version config updated']);
|
$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.');
|
Session::setFlash('success', 'App version updated successfully.');
|
||||||
$this->view->redirect('/admin/app-version');
|
$this->view->redirect('/admin/app-version');
|
||||||
return;
|
return;
|
||||||
|
|||||||
Reference in New Issue
Block a user