Skip to content

Commit

Permalink
fix: bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
abdulrahman1s committed Jun 27, 2022
1 parent b6af0ff commit fcffc19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/gateway/events/authenticate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ pub async fn run(client: &mut Client, payload: Payload) {
let servers = user.fetch_servers().await;
let server_ids: Vec<u64> = servers.iter().map(|x| x.id).collect();

channels.append(&mut Channel::find(|q| q.r#in("server_id", &server_ids)).await);
if !server_ids.is_empty() {
channels.append(&mut Channel::find(|q| q.r#in("server_id", &server_ids)).await);
}

for server in &servers {
subscriptions.push(server.id);
Expand Down
6 changes: 5 additions & 1 deletion src/structures/member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,11 @@ impl Member {
}

pub async fn fetch_roles(&self) -> Vec<Role> {
Role::find(|q| q.r#in("id", &self.roles)).await
if self.roles.is_empty() {
return vec![];
}

Role::find(|q| q.eq("server_id", &self.server_id).r#in("id", &self.roles)).await
}

#[cfg(test)]
Expand Down

0 comments on commit fcffc19

Please sign in to comment.