Remove unused Mention::to_activity()

This commit is contained in:
Kitaiti Makoto 2022-05-02 23:45:06 +09:00
parent 5d08ff6c3b
commit 4ef9350ce7

View File

@ -69,16 +69,6 @@ impl Mention {
Ok(mention)
}
pub fn to_activity(&self, conn: &Connection) -> Result<link::Mention> {
let user = self.get_mentioned(conn)?;
let mut mention = link::Mention::default();
mention.link_props.set_href_string(user.ap_url.clone())?;
mention
.link_props
.set_name_string(format!("@{}", user.fqn))?;
Ok(mention)
}
pub fn to_activity07(&self, conn: &Connection) -> Result<link07::Mention> {
let user = self.get_mentioned(conn)?;
let mut mention = link07::Mention::new();
@ -231,35 +221,6 @@ mod tests {
});
}
#[test]
fn to_activity() {
let conn = db();
conn.test_transaction::<_, Error, _>(|| {
let (posts, users, _blogs) = fill_database(&conn);
let post = &posts[0];
let user = &users[0];
let mention = Mention::insert(
&conn,
NewMention {
mentioned_id: user.id,
post_id: Some(post.id),
comment_id: None,
},
)?;
let act = mention.to_activity(&conn)?;
let expected = json!({
"href": "https://plu.me/@/admin/",
"name": "@admin",
"type": "Mention",
});
assert_json_eq!(to_value(act)?, expected);
Ok(())
});
}
#[test]
fn to_activity07() {
let conn = db();