diff --git a/src/app/conversationsadapter.cpp b/src/app/conversationsadapter.cpp index 8f7e035c..d928f817 100644 --- a/src/app/conversationsadapter.cpp +++ b/src/app/conversationsadapter.cpp @@ -655,15 +655,15 @@ ConversationsAdapter::connectConversationModel() updateConversationFilterData(); } -void +QString ConversationsAdapter::createSwarm(const QString& title, const QString& description, const QString& avatar, const VectorString& participants) { auto convModel = lrcInstance_->getCurrentConversationModel(); - convModel->createConversation(participants, - {{"title", title}, - {"description", description}, - {"avatar", avatar}}); + return convModel->createConversation(participants, + {{"title", title}, + {"description", description}, + {"avatar", avatar}}); } diff --git a/src/app/conversationsadapter.h b/src/app/conversationsadapter.h index f05e39fb..99863557 100644 --- a/src/app/conversationsadapter.h +++ b/src/app/conversationsadapter.h @@ -45,7 +45,7 @@ public: public: void connectConversationModel(); - Q_INVOKABLE void createSwarm(const QString& title, + Q_INVOKABLE QString createSwarm(const QString& title, const QString& description, const QString& avatar, const VectorString& participants); diff --git a/src/app/mainview/components/SidePanel.qml b/src/app/mainview/components/SidePanel.qml index dca69069..c296a818 100644 --- a/src/app/mainview/components/SidePanel.qml +++ b/src/app/mainview/components/SidePanel.qml @@ -81,8 +81,10 @@ BaseView { uris.push(uri) } } - ConversationsAdapter.createSwarm(title, description, avatar, uris) + let convuid = ConversationsAdapter.createSwarm(title, description, avatar, uris) viewCoordinator.dismiss("NewSwarmPage") + LRCInstance.selectConversation(convuid) + }) } else { viewCoordinator.dismiss("NewSwarmPage") diff --git a/src/libclient/api/conversationmodel.h b/src/libclient/api/conversationmodel.h index 9a60f39e..980c2367 100644 --- a/src/libclient/api/conversationmodel.h +++ b/src/libclient/api/conversationmodel.h @@ -374,8 +374,9 @@ public: * create a new swarm conversation * @param participants conversation's participants * @param infos conversation's infos + * @return new conversation id */ - void createConversation(const VectorString& participants, const MapStringString& infos = {}); + QString createConversation(const VectorString& participants, const MapStringString& infos = {}); /** * update conversation info * @param conversationId conversation's id diff --git a/src/libclient/conversationmodel.cpp b/src/libclient/conversationmodel.cpp index b9478a0e..bd5ae6d4 100644 --- a/src/libclient/conversationmodel.cpp +++ b/src/libclient/conversationmodel.cpp @@ -1023,7 +1023,7 @@ ConversationModel::getConversationPreferences(const QString& conversationId) return ret; } -void +QString ConversationModel::createConversation(const VectorString& participants, const MapStringString& infos) { auto convUid = ConfigurationManager::instance().startConversation(owner.id); @@ -1036,6 +1036,7 @@ ConversationModel::createConversation(const VectorString& participants, const Ma Q_EMIT newConversation(convUid); pimpl_->invalidateModel(); Q_EMIT modelChanged(); + return convUid; } void