Deduplicate code

This commit is contained in:
Joscha 2023-02-17 15:56:09 +01:00
parent fb164eeaa9
commit d74282581c

View file

@ -235,7 +235,7 @@ impl Room {
d.from_nick, d.from_room d.from_nick, d.from_room
); );
} }
Data::SendEvent(SendEvent(msg)) => { Data::SendEvent(SendEvent(msg)) | Data::SendReply(SendReply(msg)) => {
let own_user_id = self.own_user_id(); let own_user_id = self.own_user_id();
if let Some(last_msg_id) = &mut self.last_msg_id { if let Some(last_msg_id) = &mut self.last_msg_id {
logging_unwrap!( logging_unwrap!(
@ -263,17 +263,6 @@ impl Room {
.await .await
); );
} }
Data::SendReply(SendReply(msg)) => {
let own_user_id = self.own_user_id();
if let Some(last_msg_id) = &mut self.last_msg_id {
logging_unwrap!(
self.vault
.add_msg(Box::new(msg.clone()), *last_msg_id, own_user_id)
.await
);
*last_msg_id = Some(msg.id);
}
}
_ => {} _ => {}
} }
} }