MCPcopy Create free account
hub / github.com/dfinity/orbit / created_request_hook

Method created_request_hook

core/station/impl/src/services/request.rs:392–418  ·  view source on GitHub ↗

Handles post processing logic like sending notifications.

(&self, request: &Request)

Source from the content-addressed store, hash-verified

390
391 /// Handles post processing logic like sending notifications.
392 async fn created_request_hook(&self, request: &Request) {
393 let mut possible_approvers = match request.find_all_possible_approvers().await {
394 Ok(approvers) => approvers,
395 Err(_) => {
396 print(format!(
397 "Failed to find all possible approvers for request {}",
398 Uuid::from_bytes(request.id).hyphenated()
399 ));
400 return;
401 }
402 };
403
404 possible_approvers.remove(&request.requested_by);
405
406 for approver in possible_approvers {
407 self.notification_service
408 .send_notification(
409 approver,
410 NotificationType::RequestCreated(RequestCreatedNotification {
411 request_id: request.id,
412 }),
413 request.title.to_owned(),
414 request.summary.to_owned(),
415 )
416 .await;
417 }
418 }
419
420 /// Cancels a request if the request is in the created status and the caller is the requester.
421 pub fn cancel_request(

Callers 1

create_requestMethod · 0.80

Calls 4

printFunction · 0.85
send_notificationMethod · 0.80
removeMethod · 0.45

Tested by

no test coverage detected