Fix creating broken direct chat for user with a direct chat already open
Just enter the existing room instead of trying to create a new one but
broken.
Fix !237
(cherry picked from commit 0dbb56ba1e)
This commit is contained in:
@@ -47,6 +47,7 @@
|
||||
#include "neochatuser.h"
|
||||
#include "settings.h"
|
||||
#include "utils.h"
|
||||
#include "roommanager.h"
|
||||
#include <KStandardShortcut>
|
||||
|
||||
#ifndef Q_OS_ANDROID
|
||||
@@ -592,6 +593,17 @@ void Controller::joinRoom(const QString &alias)
|
||||
});
|
||||
}
|
||||
|
||||
void Controller::openOrCreateDirectChat(NeoChatUser *user)
|
||||
{
|
||||
const auto existing = activeConnection()->directChats();
|
||||
|
||||
if (existing.contains(user)) {
|
||||
RoomManager::instance().enterRoom(static_cast<NeoChatRoom *>(activeConnection()->room(existing.value(user))));
|
||||
return;
|
||||
}
|
||||
activeConnection()->requestDirectChat(user);
|
||||
}
|
||||
|
||||
QString Controller::formatByteSize(double size, int precision) const
|
||||
{
|
||||
return KFormat().formatByteSize(size, precision);
|
||||
|
||||
Reference in New Issue
Block a user