feat(ap): @mention notification from inbound remote Notes

This commit is contained in:
2026-05-15 05:44:10 +02:00
parent ca1ebc4b68
commit 6c83c193ed
6 changed files with 138 additions and 1 deletions

View File

@@ -81,6 +81,11 @@ pub enum EventPayload {
connection_type: String,
page: u32,
},
MentionReceived {
thought_id: String,
mentioned_user_id: String,
author_user_id: String,
},
}
impl EventPayload {
@@ -104,6 +109,7 @@ impl EventPayload {
Self::ProfileUpdated { .. } => "users.profile_updated",
Self::FetchRemoteActorPosts { .. } => "federation.fetch_outbox",
Self::FetchActorConnections { .. } => "federation.fetch_connections",
Self::MentionReceived { .. } => "mentions.received",
}
}
}
@@ -234,6 +240,15 @@ impl From<&DomainEvent> for EventPayload {
connection_type: connection_type.clone(),
page: *page,
},
DomainEvent::MentionReceived {
thought_id,
mentioned_user_id,
author_user_id,
} => Self::MentionReceived {
thought_id: thought_id.to_string(),
mentioned_user_id: mentioned_user_id.to_string(),
author_user_id: author_user_id.to_string(),
},
}
}
}
@@ -373,6 +388,18 @@ impl TryFrom<EventPayload> for DomainEvent {
connection_type,
page,
},
EventPayload::MentionReceived {
thought_id,
mentioned_user_id,
author_user_id,
} => DomainEvent::MentionReceived {
thought_id: ThoughtId::from_uuid(parse_uuid(&thought_id, "thought_id")?),
mentioned_user_id: UserId::from_uuid(parse_uuid(
&mentioned_user_id,
"mentioned_user_id",
)?),
author_user_id: UserId::from_uuid(parse_uuid(&author_user_id, "author_user_id")?),
},
})
}
}