|
35 | 35 | ListTaskPushNotificationConfigRequest, |
36 | 36 | ListTaskPushNotificationConfigResponse, |
37 | 37 | Message, |
| 38 | + PushNotificationConfig, |
38 | 39 | SendMessageRequest, |
39 | 40 | SetTaskPushNotificationConfigRequest, |
40 | 41 | StreamResponse, |
@@ -514,23 +515,24 @@ async def on_get_task_push_notification_config( |
514 | 515 | raise ServerError(error=UnsupportedOperationError()) |
515 | 516 |
|
516 | 517 | task_id = _extract_task_id(params.name) |
| 518 | + config_id = _extract_config_id(params.name) |
517 | 519 | task: Task | None = await self.task_store.get(task_id, context) |
518 | 520 | if not task: |
519 | 521 | raise ServerError(error=TaskNotFoundError()) |
520 | 522 |
|
521 | | - push_notification_config = await self._push_config_store.get_info( |
522 | | - task_id |
| 523 | + push_notification_configs: list[PushNotificationConfig] = ( |
| 524 | + await self._push_config_store.get_info(task_id) or [] |
523 | 525 | ) |
524 | | - if not push_notification_config or not push_notification_config[0]: |
525 | | - raise ServerError( |
526 | | - error=InternalError( |
527 | | - message='Push notification config not found' |
| 526 | + |
| 527 | + for config in push_notification_configs: |
| 528 | + if config.id == config_id: |
| 529 | + return TaskPushNotificationConfig( |
| 530 | + name=params.name, |
| 531 | + push_notification_config=config, |
528 | 532 | ) |
529 | | - ) |
530 | 533 |
|
531 | | - return TaskPushNotificationConfig( |
532 | | - name=params.name, |
533 | | - push_notification_config=push_notification_config[0], |
| 534 | + raise ServerError( |
| 535 | + error=InternalError(message='Push notification config not found') |
534 | 536 | ) |
535 | 537 |
|
536 | 538 | async def on_subscribe_to_task( |
|
0 commit comments