Fix inbox resolution, fix notsubscribed message
This commit is contained in:
		
							parent
							
								
									729e425e32
								
							
						
					
					
						commit
						17886732dd
					
				
					 2 changed files with 10 additions and 3 deletions
				
			
		|  | @ -63,7 +63,7 @@ impl ActorCache { | |||
|         let input_host = id.as_url().host(); | ||||
|         let accepted_actor_id = accepted_actor.id().ok_or(MyError::MissingId)?; | ||||
|         let actor_host = accepted_actor_id.as_url().host(); | ||||
|         let inbox_host = accepted_actor.inbox().as_url().host(); | ||||
|         let inbox_host = get_inbox(&accepted_actor).as_url().host(); | ||||
| 
 | ||||
|         if input_host != actor_host { | ||||
|             let input_host = input_host.map(|h| h.to_string()).unwrap_or_default(); | ||||
|  | @ -79,7 +79,7 @@ impl ActorCache { | |||
|             return Err(MyError::HostMismatch(actor_host, inbox_host)); | ||||
|         } | ||||
| 
 | ||||
|         let inbox = accepted_actor.inbox().clone(); | ||||
|         let inbox = get_inbox(&accepted_actor).clone(); | ||||
| 
 | ||||
|         let actor = Actor { | ||||
|             id: accepted_actor_id.clone(), | ||||
|  | @ -335,6 +335,13 @@ impl ActorCache { | |||
|     } | ||||
| } | ||||
| 
 | ||||
| fn get_inbox(actor: &AcceptedActors) -> &XsdAnyUri { | ||||
|     actor | ||||
|         .endpoints() | ||||
|         .and_then(|e| e.shared_inbox.as_ref()) | ||||
|         .unwrap_or(actor.inbox()) | ||||
| } | ||||
| 
 | ||||
| #[derive(Clone, Debug, serde::Deserialize, serde::Serialize)] | ||||
| pub struct Actor { | ||||
|     pub id: XsdAnyUri, | ||||
|  |  | |||
|  | @ -166,7 +166,7 @@ async fn handle_undo( | |||
|             jobs.queue(Forward::new(input, actor))?; | ||||
|             return Ok(()); | ||||
|         } else { | ||||
|             return Err(MyError::NotSubscribed(id_string(input.id())?)); | ||||
|             return Err(MyError::NotSubscribed(actor.inbox.to_string())); | ||||
|         } | ||||
|     } | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		
		Reference in a new issue