Fix dummy store tree retrieval
This commit is contained in:
parent
73582c3d1f
commit
b96ade872f
2 changed files with 6 additions and 5 deletions
|
|
@ -82,10 +82,10 @@ impl DummyStore {
|
|||
fn collect_tree(&self, id: usize, result: &mut Vec<DummyMsg>) {
|
||||
if let Some(msg) = self.msgs.get(&id) {
|
||||
result.push(msg.clone());
|
||||
if let Some(children) = self.children.get(&id) {
|
||||
for child in children {
|
||||
self.collect_tree(*child, result);
|
||||
}
|
||||
}
|
||||
if let Some(children) = self.children.get(&id) {
|
||||
for child in children {
|
||||
self.collect_tree(*child, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,7 +45,8 @@ impl Ui {
|
|||
// Prepare dummy message store and chat for testing
|
||||
let store = DummyStore::new()
|
||||
.msg(DummyMsg::new(1, "nick", "content"))
|
||||
.msg(DummyMsg::new(2, "Some1Else", "reply").parent(1));
|
||||
.msg(DummyMsg::new(2, "Some1Else", "reply").parent(1))
|
||||
.msg(DummyMsg::new(4, "nick", "reply to nothing").parent(3));
|
||||
let chat = Chat::new(store, "testroom".to_string());
|
||||
|
||||
// Run main UI.
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue