Skip to content

Commit

Permalink
Moving reaction check to appropriate place
Browse files Browse the repository at this point in the history
  • Loading branch information
vishalnarkhede committed Mar 27, 2020
1 parent cd3edae commit c5413c0
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/channel_state.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,6 @@ export class ChannelState {
}

addReaction(reaction, message) {
// Don't do anything if reaction already exist.
if (this.hasReaction(reaction, message)) {
return;
}

const { messages } = this;
if (!message) return;
const { parent_id, show_in_channel } = message;
Expand Down Expand Up @@ -162,6 +157,11 @@ export class ChannelState {
return false;
}

// Don't do anything if reaction already exist.
if (this.hasReaction(reaction, message)) {
return;
}

message = this._removeReactionFromMessage(message, reaction);
if (this._channel.getClient().userID === reaction.user.id) {
message = message.update('own_reactions', (old = []) =>
Expand Down

0 comments on commit c5413c0

Please sign in to comment.