Add test for Tag::from_activity07()

This commit is contained in:
Kitaiti Makoto 2022-03-06 21:19:56 +09:00
parent 2b1ddc71ac
commit 2316d36e03

View file

@ -66,6 +66,22 @@ impl Tag {
) )
} }
pub fn from_activity07(
conn: &Connection,
tag: &Hashtag07,
post: i32,
is_hashtag: bool,
) -> Result<Tag> {
Tag::insert(
conn,
NewTag {
tag: tag.name().ok_or(Error::MissingApProperty)?.as_str().into(),
is_hashtag,
post_id: post,
},
)
}
pub fn build_activity(tag: String) -> Result<Hashtag> { pub fn build_activity(tag: String) -> Result<Hashtag> {
let mut ht = Hashtag::default(); let mut ht = Hashtag::default();
ht.set_href_string(ap_url(&format!( ht.set_href_string(ap_url(&format!(