use Fqn::make_local() instead of make_fqn()
This commit is contained in:
		
							parent
							
								
									5ee84427bf
								
							
						
					
					
						commit
						ba00e36884
					
				| @ -25,7 +25,7 @@ use plume_common::{ | ||||
|         sign, ActivityStream, ApSignature, CustomGroup, Id, IntoId, PublicKey, Source, | ||||
|         SourceProperty, ToAsString, ToAsUri, | ||||
|     }, | ||||
|     utils::{iri_percent_encode_seg, make_fqn}, | ||||
|     utils::iri_percent_encode_seg, | ||||
| }; | ||||
| use webfinger::*; | ||||
| 
 | ||||
| @ -89,11 +89,10 @@ impl Blog { | ||||
|         if inserted.fqn.to_string().is_empty() { | ||||
|             // This might not enough for some titles such as all-Japanese title,
 | ||||
|             // but better than doing nothing.
 | ||||
|             let username = make_fqn(&inserted.title); | ||||
|             if instance.local { | ||||
|                 inserted.fqn = Fqn::new_local(username)?; | ||||
|                 inserted.fqn = Fqn::make_local(&inserted.title)?; | ||||
|             } else { | ||||
|                 inserted.fqn = Fqn::new_remote(username, instance.public_domain)?; | ||||
|                 inserted.fqn = Fqn::make_remote(&inserted.title, instance.public_domain)?; | ||||
|             } | ||||
|         } | ||||
| 
 | ||||
| @ -555,7 +554,7 @@ impl NewBlog { | ||||
|         let (pub_key, priv_key) = sign::gen_keypair(); | ||||
|         Ok(NewBlog { | ||||
|             actor_id, | ||||
|             fqn: Fqn::new_local(make_fqn(&title))?, | ||||
|             fqn: Fqn::make_local(&title)?, | ||||
|             title, | ||||
|             summary, | ||||
|             instance_id, | ||||
|  | ||||
| @ -91,7 +91,7 @@ mod tests { | ||||
|         Connection as Conn, CONFIG, | ||||
|     }; | ||||
|     use diesel::r2d2::ConnectionManager; | ||||
|     use plume_common::utils::{make_fqn, random_hex}; | ||||
|     use plume_common::utils::random_hex; | ||||
|     use std::str::FromStr; | ||||
|     use std::sync::Arc; | ||||
|     use std::thread::sleep; | ||||
| @ -198,7 +198,7 @@ mod tests { | ||||
|                 ap_url: random_hex(), | ||||
|                 inbox_url: random_hex(), | ||||
|                 outbox_url: random_hex(), | ||||
|                 fqn: Fqn::new_local(make_fqn(&title)).unwrap(), | ||||
|                 fqn: Fqn::make_local(&title).unwrap(), | ||||
|                 title, | ||||
|                 summary: Default::default(), | ||||
|                 summary_html: Default::default(), | ||||
|  | ||||
| @ -387,7 +387,7 @@ mod tests { | ||||
|     use super::valid_slug; | ||||
|     use crate::init_rocket; | ||||
|     use diesel::Connection; | ||||
|     use plume_common::utils::{make_fqn, random_hex}; | ||||
|     use plume_common::utils::random_hex; | ||||
|     use plume_models::{ | ||||
|         blog_authors::{BlogAuthor, NewBlogAuthor}, | ||||
|         blogs::{Blog, NewBlog}, | ||||
| @ -527,7 +527,7 @@ mod tests { | ||||
|             let title = random_hex(); | ||||
|             let blog = NewBlog { | ||||
|                 instance_id: instance.id, | ||||
|                 fqn: Fqn::new_local(make_fqn(&title)).unwrap(), | ||||
|                 fqn: Fqn::make_local(&title).unwrap(), | ||||
|                 title, | ||||
|                 actor_id: random_hex(), | ||||
|                 ap_url: random_hex(), | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user