mirror of
https://github.com/mikedilger/gossip.git
synced 2024-09-29 16:31:18 +00:00
Relationship::Root treated like Relationship::Reply
This commit is contained in:
parent
7203efb02e
commit
6894524df2
@ -176,7 +176,7 @@ impl Globals {
|
||||
let mut output: Vec<Id> = Vec::new();
|
||||
if let Some(vec) = GLOBALS.relationships.blocking_read().get(&id) {
|
||||
for (id, relationship) in vec.iter() {
|
||||
if *relationship == Relationship::Reply {
|
||||
if *relationship == Relationship::Reply || *relationship == Relationship::Root {
|
||||
output.push(*id);
|
||||
}
|
||||
}
|
||||
|
@ -156,6 +156,22 @@ pub async fn process_new_event(
|
||||
Globals::add_relationship(id, event.id, Relationship::Reply).await;
|
||||
}
|
||||
|
||||
// replies to root
|
||||
if let Some((id, _)) = event.replies_to_root() {
|
||||
if from_relay {
|
||||
let db_event_relationship = DbEventRelationship {
|
||||
original: event.id.as_hex_string(),
|
||||
refers_to: id.as_hex_string(),
|
||||
relationship: "root".to_string(),
|
||||
content: None,
|
||||
};
|
||||
db_event_relationship.insert().await?;
|
||||
}
|
||||
|
||||
// Insert into relationships
|
||||
Globals::add_relationship(id, event.id, Relationship::Root).await;
|
||||
}
|
||||
|
||||
// mentions
|
||||
for (id, _) in event.mentions() {
|
||||
if from_relay {
|
||||
|
@ -1,6 +1,7 @@
|
||||
/// A relationship between events
|
||||
#[derive(Clone, Debug, PartialEq, Eq)]
|
||||
pub enum Relationship {
|
||||
Root,
|
||||
Reply,
|
||||
Mention,
|
||||
Reaction(String),
|
||||
|
Loading…
Reference in New Issue
Block a user