Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(chatForm): Fix issue with mixing friend and group id
Browse files Browse the repository at this point in the history
Fix #4828
  • Loading branch information
Diadlo committed Nov 23, 2017
1 parent c274cec commit 5bc8ef4
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/widget/widget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
#include "src/model/friend.h"
#include "src/friendlist.h"
#include "src/model/group.h"
#include "src/model/profile/profileinfo.h"
#include "src/grouplist.h"
#include "src/net/autoupdate.h"
#include "src/nexus.h"
Expand All @@ -73,8 +74,6 @@
#include "src/widget/translator.h"
#include "tool/removefrienddialog.h"

#include <src/model/profile/profileinfo.h>

bool toxActivateEventHandler(const QByteArray&)
{
Widget* widget = Nexus::getDesktopGUI();
Expand Down Expand Up @@ -1132,16 +1131,23 @@ void Widget::openDialog(GenericChatroomWidget* widget, bool newWindow)
GenericChatForm* form;
const Friend* frnd = widget->getFriend();
if (frnd) {
form = chatForms[frnd->getId()];
id = frnd->getId();
form = chatForms[id];
} else {
Group* g = widget->getGroup();
form = g->getChatForm();
id = g->getId();
}

ContentDialog::focusFriend(id);
bool chatFormIsSet = ContentDialog::friendWidgetExists(id);
bool chatFormIsSet;
if (frnd) {
ContentDialog::focusFriend(id);
chatFormIsSet = ContentDialog::friendWidgetExists(id);
} else {
ContentDialog::focusGroup(id);
chatFormIsSet = ContentDialog::groupWidgetExists(id);
}

if ((chatFormIsSet || form->isVisible()) && !newWindow) {
return;
}
Expand Down

0 comments on commit 5bc8ef4

Please sign in to comment.