diff --git a/plume-models/src/mentions.rs b/plume-models/src/mentions.rs index 0d2fd415..7a3d0a87 100644 --- a/plume-models/src/mentions.rs +++ b/plume-models/src/mentions.rs @@ -61,14 +61,6 @@ impl Mention { } } - pub fn build_activity(conn: &DbConn, ment: &str) -> Result { - let user = User::find_by_fqn(conn, ment)?; - let mut mention = link::Mention::default(); - mention.link_props.set_href_string(user.ap_url)?; - mention.link_props.set_name_string(format!("@{}", ment))?; - Ok(mention) - } - pub fn build_activity07(conn: &DbConn, ment: &str) -> Result { let user = User::find_by_fqn(conn, ment)?; let mut mention = link07::Mention::new(); @@ -218,27 +210,6 @@ mod tests { use diesel::Connection; use serde_json::{json, to_value}; - #[test] - fn build_activity() { - let conn = db(); - conn.test_transaction::<_, Error, _>(|| { - let (_posts, users, _blogs) = fill_database(&conn); - let user = &users[0]; - let name = &user.username; - let act = Mention::build_activity(&conn, name)?; - - let expected = json!({ - "href": "https://plu.me/@/admin/", - "name": "@admin", - "type": "Mention", - }); - - assert_json_eq!(to_value(act)?, expected); - - Ok(()) - }); - } - #[test] fn build_activity07() { let conn = db(); diff --git a/src/api/posts.rs b/src/api/posts.rs index a1dcb639..ca76e611 100644 --- a/src/api/posts.rs +++ b/src/api/posts.rs @@ -191,9 +191,9 @@ pub fn create( if post.published { for m in mentions.into_iter() { - Mention::from_activity( + Mention::from_activity07( &conn, - &Mention::build_activity(&conn, &m)?, + &Mention::build_activity07(&conn, &m)?, post.id, true, true, diff --git a/src/routes/comments.rs b/src/routes/comments.rs index e5d571f8..f7018139 100644 --- a/src/routes/comments.rs +++ b/src/routes/comments.rs @@ -71,9 +71,9 @@ pub fn create( // save mentions for ment in mentions { - Mention::from_activity( + Mention::from_activity07( &conn, - &Mention::build_activity(&conn, &ment) + &Mention::build_activity07(&conn, &ment) .expect("comments::create: build mention error"), comm.id, false, diff --git a/src/routes/posts.rs b/src/routes/posts.rs index ef76f1cf..61c3594c 100644 --- a/src/routes/posts.rs +++ b/src/routes/posts.rs @@ -530,9 +530,10 @@ pub fn create( if post.published { for m in mentions { - Mention::from_activity( + Mention::from_activity07( &conn, - &Mention::build_activity(&conn, &m).expect("post::create: mention build error"), + &Mention::build_activity07(&conn, &m) + .expect("post::create: mention build error"), post.id, true, true,