diff --git a/rocketchatserver.cpp b/rocketchatserver.cpp index 237289e881132e2c174999fa46d73c4554e3186c..d42773d816cc051c29a8880962dff1219e54fcbc 100755 --- a/rocketchatserver.cpp +++ b/rocketchatserver.cpp @@ -367,10 +367,13 @@ void RocketChatServerData::blockUser( const QString &pChannelId ) if ( userId == pChannelId ) { QString possibleRoom1 = userId + mUserId; QString possibleRoom2 = mUserId + userId; + QSharedPointer<RocketChatBlockUserRequest> blockRequest1( new RocketChatBlockUserRequest( possibleRoom1, userId ) ); QSharedPointer<RocketChatBlockUserRequest> blockRequest2( new RocketChatBlockUserRequest( possibleRoom2, userId ) ); mDdpApi->sendRequest( blockRequest1 ); mDdpApi->sendRequest( blockRequest2 ); + + } else { QSharedPointer<RocketChatBlockUserRequest> blockRequest( new RocketChatBlockUserRequest( pChannelId, userId ) ); mDdpApi->sendRequest( blockRequest ); @@ -911,13 +914,14 @@ void RocketChatServerData::handleChannelMessage( const QJsonObject &pMessage ) blocked = data[QStringLiteral( "blocker" )].toBool(); //TODO: clean this up!, there should be a user service - QString otherUserId = rid.replace( mUserId, "" ); + QString otherUserId = rid; + otherUserId = otherUserId.replace( mUserId, "" ); if ( data.contains( "name" ) ) { QString otherUserName = data["name"].toString(); mStorage->addUserToBlockList( otherUserName, otherUserId ); mMessageService->addUserToBlockList( otherUserId ); - + leaveChannel( rid ); } }