Remove searcher from arguments of Post::update()

This commit is contained in:
Kitaiti Makoto 2021-01-07 22:38:50 +09:00
parent aae2073146
commit 864379fb81
2 changed files with 3 additions and 5 deletions

View File

@ -85,7 +85,7 @@ impl Post {
Ok(post) Ok(post)
} }
pub fn update(&self, conn: &Connection, _searcher: &Searcher) -> Result<Self> { pub fn update(&self, conn: &Connection) -> Result<Self> {
diesel::update(self).set(self).execute(conn)?; diesel::update(self).set(self).execute(conn)?;
let post = Self::get(conn, self.id)?; let post = Self::get(conn, self.id)?;
// TODO: Call publish_published() when newly published // TODO: Call publish_published() when newly published
@ -750,7 +750,6 @@ impl AsObject<User, Update, &PlumeRocket> for PostUpdate {
fn activity(self, c: &PlumeRocket, actor: User, _id: &str) -> Result<()> { fn activity(self, c: &PlumeRocket, actor: User, _id: &str) -> Result<()> {
let conn = &*c.conn; let conn = &*c.conn;
let searcher = &c.searcher;
let mut post = Post::from_id(c, &self.ap_url, None, CONFIG.proxy()).map_err(|(_, e)| e)?; let mut post = Post::from_id(c, &self.ap_url, None, CONFIG.proxy()).map_err(|(_, e)| e)?;
if !post.is_author(conn, actor.id)? { if !post.is_author(conn, actor.id)? {
@ -812,7 +811,7 @@ impl AsObject<User, Update, &PlumeRocket> for PostUpdate {
post.update_hashtags(conn, hashtags)?; post.update_hashtags(conn, hashtags)?;
} }
post.update(conn, searcher)?; post.update(conn)?;
Ok(()) Ok(())
} }
} }

View File

@ -298,8 +298,7 @@ pub fn update(
post.source = form.content.clone(); post.source = form.content.clone();
post.license = form.license.clone(); post.license = form.license.clone();
post.cover_id = form.cover; post.cover_id = form.cover;
post.update(&*conn, &rockets.searcher) post.update(&*conn).expect("post::update: update error");
.expect("post::update: update error");
if post.published { if post.published {
post.update_mentions( post.update_mentions(