Skip to content

Commit

Permalink
Simplify Reaction::delete()
Browse files Browse the repository at this point in the history
  • Loading branch information
Austin Hellyer committed Jan 9, 2017
1 parent 9a80be0 commit 1594961
Showing 1 changed file with 9 additions and 10 deletions.
19 changes: 9 additions & 10 deletions src/model/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1212,7 +1212,7 @@ impl Reaction {
/// [permissions]: permissions
#[cfg(feature="methods")]
pub fn delete(&self) -> Result<()> {
feature_cache! {{
let user_id = feature_cache! {{
let user = if self.user_id == CACHE.read().unwrap().user.id {
None
} else {
Expand All @@ -1233,16 +1233,15 @@ impl Reaction {
}
}

rest::delete_reaction(self.channel_id.0,
self.message_id.0,
user,
self.emoji.clone())
user
} else {
rest::delete_reaction(self.channel_id.0,
self.message_id.0,
Some(self.user_id.0),
self.emoji.clone())
}}
Some(self.user_id.0)
}};

rest::delete_reaction(self.channel_id.0,
self.message_id.0,
user_id,
self.emoji.clone())
}

/// Retrieves the list of [`User`]s who have reacted to a [`Message`] with a
Expand Down

0 comments on commit 1594961

Please sign in to comment.