Make Create Note compliant to the spec

This commit is contained in:
Bat 2018-06-23 13:06:15 +01:00
parent 3ea4823060
commit f2795baab5

View File

@ -187,7 +187,7 @@ impl NewComment {
}))).expect("NewComment::create: note.in_reply_to error"); }))).expect("NewComment::create: note.in_reply_to error");
note.object_props.set_published_string(chrono::Utc::now().to_rfc3339()).expect("NewComment::create: note.published error"); note.object_props.set_published_string(chrono::Utc::now().to_rfc3339()).expect("NewComment::create: note.published error");
note.object_props.set_attributed_to_link(author.clone().into_id()).expect("NewComment::create: note.attributed_to error"); note.object_props.set_attributed_to_link(author.clone().into_id()).expect("NewComment::create: note.attributed_to error");
note.object_props.set_to_link_vec(to).expect("NewComment::create: note.to error"); note.object_props.set_to_link_vec(to.clone()).expect("NewComment::create: note.to error");
note.object_props.set_tag_link_vec(mentions.into_iter().map(|m| Mention::build_activity(conn, m)).collect::<Vec<link::Mention>>()) note.object_props.set_tag_link_vec(mentions.into_iter().map(|m| Mention::build_activity(conn, m)).collect::<Vec<link::Mention>>())
.expect("NewComment::create: note.tag error"); .expect("NewComment::create: note.tag error");
@ -195,6 +195,8 @@ impl NewComment {
act.create_props.set_actor_link(author.into_id()).expect("NewComment::create: actor error"); act.create_props.set_actor_link(author.into_id()).expect("NewComment::create: actor error");
act.create_props.set_object_object(note).expect("NewComment::create: object error"); act.create_props.set_object_object(note).expect("NewComment::create: object error");
act.object_props.set_id_string(format!("{}/activity", self.ap_url.clone().unwrap())).expect("NewComment::create: id error"); act.object_props.set_id_string(format!("{}/activity", self.ap_url.clone().unwrap())).expect("NewComment::create: id error");
act.object_props.set_to_link_vec(to).expect("NewComment::create: to error");
act.object_props.set_cc_link_vec::<Id>(vec![]).expect("NewComment::create: cc error");
(act, next_id) (act, next_id)
} }
} }