diff --git a/tools/chatgui/src/joindialog.cpp b/tools/chatgui/src/joindialog.cpp index c5a0a31a..9b099895 100644 --- a/tools/chatgui/src/joindialog.cpp +++ b/tools/chatgui/src/joindialog.cpp @@ -152,6 +152,7 @@ void JoinDialog::onLinkTextChanged() { void JoinDialog::onConnectClicked() { if (m_connecting) return; + m_decodeTimer->stop(); // Явное действие пользователя заменяет отложенный предпросмотр, включая ошибки проверки ссылки. QString link = m_linkEdit->text().trimmed(); if (link.isEmpty()) { setStatus(QCoreApplication::translate("ChatGui", "Enter an invite link."), true); @@ -173,7 +174,6 @@ void JoinDialog::onConnectClicked() { return; } - m_decodeTimer->stop(); // Состояние запроса больше не должно заменяться отложенным предпросмотром ссылки. uint64_t nodeId = sc_derive_node_id_from_pubkey((const uint8_t*)d.pubkey.constData()); QString addrDbg; diff --git a/tools/chatgui/tests/test_join_dialogs.cpp b/tools/chatgui/tests/test_join_dialogs.cpp index 824067ba..f415f253 100644 --- a/tools/chatgui/tests/test_join_dialogs.cpp +++ b/tools/chatgui/tests/test_join_dialogs.cpp @@ -107,15 +107,23 @@ private slots: QCOMPARE(edit->text(), m_link); } + void errorSurvivesPendingPreview_data() { + QTest::addColumn("accepted"); + QTest::newRow("core-result") << true; + QTest::newRow("validation") << false; + } + void errorSurvivesPendingPreview() { + QFETCH(bool, accepted); JoinDialog dialog(nullptr, nullptr); auto* edit = dialog.findChild(); auto* action = dialog.findChild("joinConnect"); auto* status = dialog.findChild("joinStatus"); dialog.show(); QTRY_COMPARE(QApplication::activeModalWidget(), &dialog); - edit->setText(m_link); QTest::mouseClick(action, Qt::LeftButton); - result_callback(m_peer, 42, CHAT_CONNECT_ERROR, last_request); + edit->setText(accepted ? m_link : QStringLiteral("utun://invalid")); QTest::mouseClick(action, Qt::LeftButton); + if (accepted) result_callback(m_peer, 42, CHAT_CONNECT_ERROR, last_request); const QString error = status->text(); + QVERIFY(!error.isEmpty()); QTest::qWait(500); QCOMPARE(status->text(), error); }