Skip to content

Commit

Permalink
fix(invite): validation added to the correct user
Browse files Browse the repository at this point in the history
  • Loading branch information
jdomingu98 committed May 7, 2024
1 parent 9996456 commit 882cd52
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/commands/InviteCommand.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,9 @@ void InviteCommand::execute(int clientFd) {
throw NotOnChannelException(_channelName);

Channel *channel = server.getChannelByName(_channelName);
const User *invited = server.getUserByNickname(_nickname);

if (me->isOnChannel(_channelName))
if (invited->isOnChannel(_channelName))
throw UserOnChannelException(_nickname, _channelName);

if (channel->isInviteOnly() && !channel->isOper(me->getNickname()))
Expand Down

0 comments on commit 882cd52

Please sign in to comment.