WIP: Send the channel name and the channel edges seperately, so we're not repeating them constantly

This commit is currently broken and includes debug data for a failed attempt at rewriting the insert_edge logic
This commit is contained in:
Mikayla 2023-09-15 17:57:23 -07:00
parent 363867c65b
commit 5f9c56c8b0
No known key found for this signature in database
13 changed files with 437 additions and 760 deletions

View file

@ -7,6 +7,7 @@ mod message_tests;
use super::*;
use gpui::executor::Background;
use parking_lot::Mutex;
use rpc::proto::ChannelEdge;
use sea_orm::ConnectionTrait;
use sqlx::migrate::MigrateDatabase;
use std::sync::Arc;
@ -144,3 +145,27 @@ impl Drop for TestDb {
}
}
}
/// The second tuples are (channel_id, parent)
fn graph(channels: &[(ChannelId, &'static str)], edges: &[(ChannelId, ChannelId)]) -> ChannelGraph {
let mut graph = ChannelGraph {
channels: vec![],
edges: vec![],
};
for (id, name) in channels {
graph.channels.push(Channel {
id: *id,
name: name.to_string(),
})
}
for (channel, parent) in edges {
graph.edges.push(ChannelEdge {
channel_id: channel.to_proto(),
parent_id: parent.to_proto(),
})
}
graph
}