Remove searcher from arguments of Post::insert()

This commit is contained in:
Kitaiti Makoto 2021-01-07 22:20:55 +09:00
parent 6a2ba2260d
commit 6ad3359609
3 changed files with 1 additions and 7 deletions

View file

@ -63,7 +63,7 @@ impl Post {
find_by!(posts, find_by_ap_url, ap_url as &str); find_by!(posts, find_by_ap_url, ap_url as &str);
last!(posts); last!(posts);
pub fn insert(conn: &Connection, new: NewPost, _searcher: &Searcher) -> Result<Self> { pub fn insert(conn: &Connection, new: NewPost) -> Result<Self> {
diesel::insert_into(posts::table) diesel::insert_into(posts::table)
.values(new) .values(new)
.execute(conn)?; .execute(conn)?;
@ -571,7 +571,6 @@ impl FromId<PlumeRocket> for Post {
fn from_activity(c: &PlumeRocket, article: LicensedArticle) -> Result<Self> { fn from_activity(c: &PlumeRocket, article: LicensedArticle) -> Result<Self> {
let conn = &*c.conn; let conn = &*c.conn;
let searcher = &c.searcher;
let license = article.custom_props.license_string().unwrap_or_default(); let license = article.custom_props.license_string().unwrap_or_default();
let article = article.object; let article = article.object;
@ -619,7 +618,6 @@ impl FromId<PlumeRocket> for Post {
source: article.ap_object_props.source_object::<Source>()?.content, source: article.ap_object_props.source_object::<Source>()?.content,
cover_id: cover, cover_id: cover,
}, },
searcher,
)?; )?;
for author in authors { for author in authors {
@ -864,7 +862,6 @@ mod tests {
source: "Hello".into(), source: "Hello".into(),
cover_id: None, cover_id: None,
}, },
&r.searcher,
) )
.unwrap(); .unwrap();
PostAuthor::insert( PostAuthor::insert(

View file

@ -105,7 +105,6 @@ pub fn create(
rockets: PlumeRocket, rockets: PlumeRocket,
) -> Api<PostData> { ) -> Api<PostData> {
let conn = &*rockets.conn; let conn = &*rockets.conn;
let search = &rockets.searcher;
let worker = &rockets.worker; let worker = &rockets.worker;
let author = User::get(conn, auth.0.user_id)?; let author = User::get(conn, auth.0.user_id)?;
@ -155,7 +154,6 @@ pub fn create(
source: payload.source.clone(), source: payload.source.clone(),
cover_id: payload.cover_id, cover_id: payload.cover_id,
}, },
search,
)?; )?;
PostAuthor::insert( PostAuthor::insert(

View file

@ -481,7 +481,6 @@ pub fn create(
source: form.content.clone(), source: form.content.clone(),
cover_id: form.cover, cover_id: form.cover,
}, },
&rockets.searcher,
) )
.expect("post::create: post save error"); .expect("post::create: post save error");