From 47be1541a7001521b5aa318637954b0170327f1a Mon Sep 17 00:00:00 2001 From: Bat Date: Fri, 7 Sep 2018 21:38:22 +0100 Subject: [PATCH] Fix tag and mentions federation Vec::append is not returning a value, but modifying the Vec --- plume-models/src/posts.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index 4367fee7..f32c7702 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -233,6 +233,7 @@ impl Post { let mut mentions_json = Mention::list_for_post(conn, self.id).into_iter().map(|m| json!(m.to_activity(conn))).collect::>(); let mut tags_json = Tag::for_post(conn, self.id).into_iter().map(|t| json!(t.into_activity(conn))).collect::>(); + mentions_json.append(&mut tags_json); let mut article = Article::default(); article.object_props.set_name_string(self.title.clone()).expect("Post::into_activity: name error"); @@ -248,7 +249,7 @@ impl Post { }).expect("Post::into_activity: source error"); article.object_props.set_published_utctime(Utc.from_utc_datetime(&self.creation_date)).expect("Post::into_activity: published error"); article.object_props.set_summary_string(self.subtitle.clone()).expect("Post::into_activity: summary error"); - article.object_props.tag = Some(json!(mentions_json.append(&mut tags_json))); + article.object_props.tag = Some(json!(mentions_json)); article.object_props.set_url_string(self.ap_url.clone()).expect("Post::into_activity: url error"); article.object_props.set_to_link_vec::(to.into_iter().map(Id::new).collect()).expect("Post::into_activity: to error"); article.object_props.set_cc_link_vec::(vec![]).expect("Post::into_activity: cc error"); @@ -258,7 +259,7 @@ impl Post { pub fn create_activity(&self, conn: &PgConnection) -> Create { let article = self.into_activity(conn); let mut act = Create::default(); - act.object_props.set_id_string(format!("{}/activity", self.ap_url)).expect("Post::create_activity: id error"); + act.object_props.set_id_string(format!("{}activity", self.ap_url)).expect("Post::create_activity: id error"); act.object_props.set_to_link_vec::(article.object_props.to_link_vec().expect("Post::create_activity: Couldn't copy 'to'")) .expect("Post::create_activity: to error"); act.object_props.set_cc_link_vec::(article.object_props.cc_link_vec().expect("Post::create_activity: Couldn't copy 'cc'"))