File tree Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Expand file tree Collapse file tree 2 files changed +23
-4
lines changed Original file line number Diff line number Diff line change @@ -34,7 +34,7 @@ pub struct Message {
3434#[ derive( Serialize , Deserialize , Debug , Clone ) ]
3535pub struct Request {
3636 pub user_id : String ,
37- pub user_id_num : u32 ,
37+ pub principal_name : String ,
3838 #[ serde( skip_serializing_if = "Option::is_none" ) ]
3939 pub envelope : Option < Envelope > ,
4040 #[ serde( skip_serializing_if = "Option::is_none" ) ]
@@ -79,10 +79,10 @@ pub enum Modification {
7979}
8080
8181impl Request {
82- pub fn new ( user_id : String , user_id_num : u32 ) -> Self {
82+ pub fn new ( user_id : String , principal_name : String ) -> Self {
8383 Self {
8484 user_id,
85- user_id_num ,
85+ principal_name ,
8686 envelope : None ,
8787 message : None ,
8888 }
Original file line number Diff line number Diff line change @@ -68,9 +68,28 @@ pub async fn try_delivery_hook(
6868 } )
6969 . collect ( ) ;
7070
71+ let principal = match server
72+ . directory ( )
73+ . query ( directory:: QueryParams :: id ( user_id) )
74+ . await
75+ {
76+ Ok ( principal) => match principal {
77+ Some ( principal) => principal,
78+ None => {
79+ return Err (
80+ trc:: EventType :: MessageIngest ( trc:: MessageIngestEvent :: Error ) . ctx (
81+ trc:: Key :: Reason ,
82+ "User principal not found for delivery hook" ,
83+ ) ,
84+ ) ;
85+ }
86+ } ,
87+ Err ( err) => return Err ( err) ,
88+ } ;
89+
7190 let request = hooks:: Request :: new (
7291 jmap_proto:: types:: id:: Id :: from ( user_id) . as_string ( ) ,
73- user_id ,
92+ principal . name ,
7493 )
7594 . with_envelope ( envelope)
7695 . with_message ( hooks:: Message {
You can’t perform that action at this time.
0 commit comments