fix: iter after flat and unpack node
flat iter gives us only objects, but we want links...
This commit is contained in:
parent
b801c1143e
commit
b3184e7ae2
1 changed files with 31 additions and 28 deletions
|
@ -124,13 +124,15 @@ impl Normalizer for crate::Context {
|
|||
.await?;
|
||||
}
|
||||
|
||||
for tag in object.tag() {
|
||||
match tag.link_type() {
|
||||
for tag in object.tag().flat() {
|
||||
match tag {
|
||||
Node::Empty | Node::Object(_) | Node::Array(_) => {},
|
||||
Node::Link(l) => match l.link_type() {
|
||||
Ok(apb::LinkType::Mention) => {
|
||||
let model = crate::model::mention::ActiveModel {
|
||||
internal: NotSet,
|
||||
object: Set(object_model.internal),
|
||||
actor: Set(tag.href().to_string()),
|
||||
actor: Set(l.href().to_string()),
|
||||
published: Set(now),
|
||||
};
|
||||
crate::model::mention::Entity::insert(model)
|
||||
|
@ -138,8 +140,8 @@ impl Normalizer for crate::Context {
|
|||
.await?;
|
||||
},
|
||||
Ok(apb::LinkType::Hashtag) => {
|
||||
let hashtag = tag.name()
|
||||
.unwrap_or_else(|_| tag.href().split('/').last().unwrap_or_default())
|
||||
let hashtag = l.name()
|
||||
.unwrap_or_else(|_| l.href().split('/').last().unwrap_or_default())
|
||||
.replace('#', "");
|
||||
let model = crate::model::hashtag::ActiveModel {
|
||||
internal: NotSet,
|
||||
|
@ -154,6 +156,7 @@ impl Normalizer for crate::Context {
|
|||
_ => {},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Ok(object_model)
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue