use searcher_actor for posts update route (instead of post.update())

pull/813/head
Mina Galić hace 4 años
padre 94cf4dab98
commit 06e20299e0
Firmado por: igalic
ID de clave GPG: ACFEFF7F6A123A86

@ -33,7 +33,7 @@ pub struct Searcher {
pub struct AddDocument(Post);
#[derive(Clone, Debug)]
pub struct UpdateDocument(Post);
pub struct UpdateDocument(pub Post);
#[derive(Clone, Debug)]
pub struct DeleteDocument(Post);

@ -1,5 +1,6 @@
use chrono::Utc;
use heck::{CamelCase, KebabCase};
use riker::actors::*;
use rocket::request::LenientForm;
use rocket::response::{Flash, Redirect};
use rocket_i18n::I18n;
@ -26,6 +27,7 @@ use plume_models::{
post_authors::*,
posts::*,
safe_string::SafeString,
search::UpdateDocument,
tags::*,
timeline::*,
users::User,
@ -297,8 +299,6 @@ pub fn update(
post.source = form.content.clone();
post.license = form.license.clone();
post.cover_id = form.cover;
post.update(&*conn, &rockets.searcher)
.expect("post::update: update error");
if post.published {
post.update_mentions(
@ -351,6 +351,9 @@ pub fn update(
}
}
let searcher_actor = rockets.actors.select("searcher-actor").unwrap();
searcher_actor.try_tell(UpdateDocument(post.clone()), None);
Flash::success(
Redirect::to(uri!(details: blog = blog, slug = new_slug, responding_to = _)),
i18n!(intl, "Your article has been updated."),

Cargando…
Cancelar
Guardar