Save listeners in db
This commit is contained in:
		
							parent
							
								
									4c373e562b
								
							
						
					
					
						commit
						4fba2f317d
					
				
					 1 changed files with 11 additions and 9 deletions
				
			
		
							
								
								
									
										20
									
								
								src/inbox.rs
									
										
									
									
									
								
							
							
						
						
									
										20
									
								
								src/inbox.rs
									
										
									
									
									
								
							|  | @ -165,18 +165,20 @@ async fn handle_follow( | ||||||
|         return Err(MyError::WrongActor(input.object.id().to_string())); |         return Err(MyError::WrongActor(input.object.id().to_string())); | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if !is_listener && input.object.is(&my_id) { |     if !is_listener { | ||||||
|         let follow = generate_follow(state, &actor.id, &my_id)?; |  | ||||||
| 
 |  | ||||||
|         let inbox = actor.inbox().to_owned(); |         let inbox = actor.inbox().to_owned(); | ||||||
|         db.add_listener(inbox).await?; |         db.add_listener(inbox).await?; | ||||||
| 
 | 
 | ||||||
|         let client2 = client.clone(); |         // if following relay directly, not just following 'public', followback
 | ||||||
|         let inbox = actor.inbox().clone(); |         if input.object.is(&my_id) { | ||||||
|         let follow2 = follow.clone(); |             let follow = generate_follow(state, &actor.id, &my_id)?; | ||||||
|         actix::Arbiter::spawn(async move { |             let client2 = client.clone(); | ||||||
|             let _ = client2.deliver(inbox, &follow2).await; |             let inbox = actor.inbox().clone(); | ||||||
|         }); |             let follow2 = follow.clone(); | ||||||
|  |             actix::Arbiter::spawn(async move { | ||||||
|  |                 let _ = client2.deliver(inbox, &follow2).await; | ||||||
|  |             }); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     let accept = generate_accept_follow(state, &actor.id, &input.id, &my_id)?; |     let accept = generate_accept_follow(state, &actor.id, &input.id, &my_id)?; | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue