mirror of
https://github.com/rzuasti/oott.git
synced 2026-07-08 19:21:54 +02:00
Report delivered device count from the test-notification endpoint
POST /api/notifications/test previously returned a blanket 200 even when there
were no registered devices, so a test that reached nobody looked like a success.
push::send now returns the number of devices the relay confirmed delivery to, and
the endpoint returns it as {"delivered": N}. Settings shows "sent to N device(s)"
on success and an explicit "No devices are registered..." warning when N is 0,
which is the case that previously masqueraded as success.
Backend, API and widget tests updated; clippy and dart analyze clean.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
0075072196
commit
475edcb2cf
@@ -15,9 +15,11 @@ extension NotificationApi on BackendAPI {
|
||||
}
|
||||
|
||||
/// Asks the backend to deliver a one-off test push to every registered device,
|
||||
/// used from Settings to verify end-to-end push delivery.
|
||||
Future<void> sendTestNotification() async {
|
||||
await _dio.post('/notifications/test');
|
||||
/// used from Settings to verify end-to-end push delivery. Returns the number of
|
||||
/// devices the relay confirmed delivery to (0 when none are registered).
|
||||
Future<int> sendTestNotification() async {
|
||||
final response = await _dio.post('/notifications/test');
|
||||
return (response.data as Map<String, dynamic>)['delivered'] as int;
|
||||
}
|
||||
|
||||
Future<({List<Notification> items, int totalCount})> listNotifications(
|
||||
|
||||
Reference in New Issue
Block a user