Skip to content
Snippets Groups Projects

case insensitve channel search did not always work ... fixes #110

Merged Armin Felder requested to merge fixChannelSearch into master
1 file
+ 7
4
Compare changes
  • Side-by-side
  • Inline
@@ -531,16 +531,17 @@ void RocketChatChannelService::searchRoom( const QString &pTerm, const QString &
channelVector RocketChatChannelService::searchRoomLocal( const QString &pTerm, const QHash<QString, bool> &pFilter, const QString &pType, const QHash<QString, bool> &pNames )
{
channelVector list;
QString term = pTerm.toLower();
for ( auto channel : mChannels->getElements() ) {
QString id = channel->getRoomId();
QString type = channel->getType();
QString name = channel->getName();
QString username = channel->getUsername();
QString name = channel->getName().toLower();
QString username = channel->getUsername().toLower();
if ( !pFilter.contains( id ) && !pNames.contains( name ) && pNames.contains( username ) && ( pType.isEmpty() || pType == type ) ) {
if ( !pFilter.contains( id ) && !pNames.contains( name ) && !pNames.contains( username ) && ( pType.isEmpty() || pType == type ) ) {
if ( name.indexOf( pTerm, Qt::CaseInsensitive ) != -1 || username.indexOf( pTerm, Qt::CaseInsensitive ) != -1 ) {
if ( name.indexOf( term, Qt::CaseInsensitive ) != -1 || username.indexOf( term, Qt::CaseInsensitive ) != -1 ) {
list.append( channel );
}
}
@@ -568,6 +569,8 @@ void RocketChatChannelService::openPrivateChannelWith( QString pUsername )
//TODO: fix
if ( !mChannels->contains( rid ) ) {
DdpCallback success = [ = ]( QJsonObject pResponse, MeteorDDP * pDdp ) {
Q_UNUSED( pDdp )
if ( pResponse.contains( "result" ) ) {
QString name = pResponse["fname"].toString();
QString username = pResponse["name"].toString();
Loading