cache local instance (#572)

* cache local instance

fix #564

* don't use local instance cache for plm

* use instance cache for plm, but initialize it

* cargo fmt
This commit is contained in:
fdb-hiroshima
2019-05-10 22:59:34 +02:00
committed by Baptiste Gelez
parent 5b50f90d2b
commit 773fbfe7c8
20 changed files with 123 additions and 88 deletions
+2 -2
View File
@@ -114,7 +114,7 @@ pub fn create(
NaiveDateTime::parse_from_str(format!("{} 00:00:00", d).as_ref(), "%Y-%m-%d %H:%M:%S").ok()
});
let domain = &Instance::get_local(conn)?.public_domain;
let domain = &Instance::get_local()?.public_domain;
let (content, mentions, hashtags) = md_to_html(
&payload.source,
Some(domain),
@@ -144,7 +144,7 @@ pub fn create(
content: SafeString::new(content.as_ref()),
published: payload.published.unwrap_or(true),
license: payload.license.clone().unwrap_or_else(|| {
Instance::get_local(conn)
Instance::get_local()
.map(|i| i.default_license)
.unwrap_or_else(|_| String::from("CC-BY-SA"))
}),