Skip to content

Commit

Permalink
Fix has_role returning an incorrect result if the member is not cac…
Browse files Browse the repository at this point in the history
…hed (#725)
  • Loading branch information
ikkerens authored and arqunis committed Sep 27, 2019
1 parent d427da4 commit 96b49f9
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/model/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -683,15 +683,13 @@ impl User {
#[cfg(feature = "cache")]
{
if let Some(cache) = cache_http.cache() {
has_role = Some(
cache.read()
has_role = cache.read()
.guilds
.get(&guild_id)
.map_or(false, |g| {
.and_then(|g| {
g.read().members.get(&self.id)
.map_or(false, |m| m.roles.contains(&role))
})
);
.and_then(|m| Some(m.roles.contains(&role)))
});
}
}

Expand Down

0 comments on commit 96b49f9

Please sign in to comment.