Started working on contact resolution
This commit is contained in:
@@ -13,6 +13,7 @@ pub enum Participant {
|
||||
Remote {
|
||||
id: Option<i32>,
|
||||
display_name: String,
|
||||
contact_id: Option<String>,
|
||||
},
|
||||
}
|
||||
|
||||
@@ -21,6 +22,7 @@ impl From<String> for Participant {
|
||||
Participant::Remote {
|
||||
id: None,
|
||||
display_name,
|
||||
contact_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -30,6 +32,7 @@ impl From<&str> for Participant {
|
||||
Participant::Remote {
|
||||
id: None,
|
||||
display_name: display_name.to_string(),
|
||||
contact_id: None,
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,8 +41,8 @@ impl From<kordophone_db::models::Participant> for Participant {
|
||||
fn from(participant: kordophone_db::models::Participant) -> Self {
|
||||
match participant {
|
||||
kordophone_db::models::Participant::Me => Participant::Me,
|
||||
kordophone_db::models::Participant::Remote { id, display_name } => {
|
||||
Participant::Remote { id, display_name }
|
||||
kordophone_db::models::Participant::Remote { id, display_name, contact_id } => {
|
||||
Participant::Remote { id, display_name, contact_id }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -107,8 +110,8 @@ impl From<Message> for kordophone_db::models::Message {
|
||||
id: message.id,
|
||||
sender: match message.sender {
|
||||
Participant::Me => kordophone_db::models::Participant::Me,
|
||||
Participant::Remote { id, display_name } => {
|
||||
kordophone_db::models::Participant::Remote { id, display_name }
|
||||
Participant::Remote { id, display_name, contact_id } => {
|
||||
kordophone_db::models::Participant::Remote { id, display_name, contact_id }
|
||||
}
|
||||
},
|
||||
text: message.text,
|
||||
@@ -145,6 +148,7 @@ impl From<kordophone::model::Message> for Message {
|
||||
Some(sender) => Participant::Remote {
|
||||
id: None,
|
||||
display_name: sender,
|
||||
contact_id: None,
|
||||
},
|
||||
None => Participant::Me,
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user