@ -1,7 +1,7 @@
use crate ::{
ap_url , blogs ::Blog , instance ::Instance , medias ::Media , mentions ::Mention , post_authors ::* ,
safe_string ::SafeString , schema ::posts , search ::Searcher , tags::* , timeline ::* , users ::User ,
Connection, Error , PlumeRocket , Result , CONFIG ,
safe_string ::SafeString , schema ::posts , search ::Searcher , search::UpdateDocument , tags ::* ,
timeline::* , users ::User , Connection, Error , PlumeRocket , Result , CONFIG ,
} ;
use activitypub ::{
activity ::{ Create , Delete , Update } ,
@ -19,6 +19,8 @@ use plume_common::{
} ,
utils ::md_to_html ,
} ;
use riker ::actors ::* ;
use serde_json ;
use std ::collections ::HashSet ;
@ -82,10 +84,9 @@ impl 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 ) ? ;
let post = Self ::get ( conn , self . id ) ? ;
searcher . update_document ( & post ) ? ;
Ok ( post )
}
@ -728,7 +729,7 @@ impl AsObject<User, Update, &PlumeRocket> for PostUpdate {
fn activity ( self , c : & PlumeRocket , actor : User , _id : & str ) -> Result < ( ) > {
let conn = & * c . conn ;
let searcher = & c . searcher;
let searcher _actor = & c . actors. select ( " searcher-actor") . unwrap ( ) ;
let mut post = Post ::from_id ( c , & self . ap_url , None ) . map_err ( | ( _ , e ) | e ) ? ;
if ! post . is_author ( conn , actor . id ) ? {
@ -791,7 +792,8 @@ impl AsObject<User, Update, &PlumeRocket> for PostUpdate {
post . update_hashtags ( conn , hashtags ) ? ;
}
post . update ( conn , searcher ) ? ;
post . update ( conn ) ? ;
searcher_actor . try_tell ( UpdateDocument ( post . clone ( ) ) , None ) ;
Ok ( ( ) )
}
}