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