* Fixing broken /channels/create due to updated channel structure

The badges_id field has proved to bubble up some issues with updating deep structures
Basically this just means that feature branches for deep features like this are a good idea

! Issue: RTC feature flag was working fine but without the feature flag `Row`'s had no pickup
This meant correct responses were slipping into previously unreachable sections of code
This commit is contained in:
shockrah
2021-05-26 12:14:43 -07:00
parent 990ad347f7
commit 0b34c25477
4 changed files with 11 additions and 6 deletions

View File

@@ -47,7 +47,6 @@ impl Channel {
let params = params!{"kind" => kind};
type Row = (u64, String, Option<String>, i32, String);
let channels = conn.exec_map(q, params, |(id, name, description, kind, badge_ids): Row| {
println!("{}", badge_ids);
let badge_ids: Vec<u32> = serde_json::from_str(&badge_ids).unwrap_or(Vec::new());
Channel {
id, name, description, kind, badge_ids
@@ -68,6 +67,8 @@ impl Channel {
// bounds are literally [1, 2]
if kind == TEXT_CHANNEL || kind == VOICE_CHANNEL {
let mut conn = p.get_conn().await?;
// Badge id's are not required here as they have a default server-side
// value of '[]'
let q = "INSERT INTO channels (id, name, description, kind) VALUES (:i, :n, :d, :k)";
let id = rand::rngs::OsRng.next_u64(); // generate id's randomly for channels
conn.exec_drop(q, params!{

View File

@@ -108,7 +108,7 @@ impl PublicMember {
return Ok(Response::RestrictedInput(format!("Invalid status value")));
} else {
let mut conn = p.get_conn().await?;
let q = "SELECT id, name, permissions badge_ids FROM members
let q = "SELECT id, name, permissions, badge_ids FROM members
WHERE status = :status LIMIT 1000";
let params = params!{"status" => status};