From 01a8c9e9d7985636dd7f941769d2c0bcd9e524b0 Mon Sep 17 00:00:00 2001 From: Jakub Date: Mon, 3 Aug 2020 12:48:44 +0200 Subject: [PATCH] Adding GUI troubleshoot popup GODT-554 GODT-583 --- Changelog.md | 15 ++------------- internal/events/events.go | 1 + internal/frontend/qml/Gui.qml | 8 ++++++++ internal/frontend/qml/tst_Gui.qml | 7 ++++++- internal/frontend/qt/frontend.go | 3 +++ internal/frontend/qt/ui.go | 1 + internal/imap/backend.go | 2 +- 7 files changed, 22 insertions(+), 15 deletions(-) diff --git a/Changelog.md b/Changelog.md index 40dd5bbb..82b0fe76 100644 --- a/Changelog.md +++ b/Changelog.md @@ -4,21 +4,10 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) ## Unreleased -### Added -* GODT-582 Detect "bad certificate" TLS error. - -### Changed -* GODT-409 Set flags have to replace all flags. -* GODT-531 Better way to add trusted certificate in macOS. -* Bumped golangci-lint to v1.29.0 - -### Fixed -* GODT-454 Fix send on closed channel when receiving unencrypted send confirmation from GUI. - - -## [v1.3.x] Emma (beta 2020-07-XXX) +## [v1.3.x] Emma (beta since 2020-08-05) ### Added +* GODT-554 Detect and notify about "bad certificate" IMAP TLS error. * IMAP mailbox info update when new mailbox is created. * GODT-72 Use ISO-8859-1 encoding if charset is not specified and it isn't UTF-8. diff --git a/internal/events/events.go b/internal/events/events.go index 773b61a6..f4c8411c 100644 --- a/internal/events/events.go +++ b/internal/events/events.go @@ -40,6 +40,7 @@ const ( NoActiveKeyForRecipientEvent = "noActiveKeyForRecipient" UpgradeApplicationEvent = "upgradeApplication" TLSCertIssue = "tlsCertPinningIssue" + IMAPTLSBadCert = "imapTLSBadCert" // LogoutEventTimeout is the minimum time to permit between logout events being sent. LogoutEventTimeout = 3 * time.Minute diff --git a/internal/frontend/qml/Gui.qml b/internal/frontend/qml/Gui.qml index 6e387ad3..82b2743e 100644 --- a/internal/frontend/qml/Gui.qml +++ b/internal/frontend/qml/Gui.qml @@ -237,6 +237,14 @@ Item { winMain.tlsBarState="notOK" } + onShowIMAPCertTroubleshoot : { + go.notifyBubble(1, qsTr( + "Bridge was unable to establish a connection with your Email client.
Learn more
", + "notification message" + )) + } + + } Timer { diff --git a/internal/frontend/qml/tst_Gui.qml b/internal/frontend/qml/tst_Gui.qml index 5b790aaf..464cad92 100644 --- a/internal/frontend/qml/tst_Gui.qml +++ b/internal/frontend/qml/tst_Gui.qml @@ -110,7 +110,7 @@ Window { ListElement { title: "Internet off" } ListElement { title: "NeedUpdate" } ListElement { title: "UpToDate" } - ListElement { title: "ForceUpdate" } + ListElement { title: "ForceUpdate" } ListElement { title: "Linux" } ListElement { title: "Windows" } ListElement { title: "Macos" } @@ -122,6 +122,7 @@ Window { ListElement { title: "Minimize this" } ListElement { title: "SendAlertPopup" } ListElement { title: "TLSCertError" } + ListElement { title: "IMAPCertError" } } ListView { @@ -208,6 +209,9 @@ Window { case "TLSCertError" : go.showCertIssue() break; + case "IMAPCertError" : + go.showIMAPCertTroubleshoot() + break; default : console.log("Not implemented " + data) } @@ -310,6 +314,7 @@ Window { signal failedAutostartCode(string code) signal showCertIssue() + signal showIMAPCertTroubleshoot() signal updateFinished(bool hasError) diff --git a/internal/frontend/qt/frontend.go b/internal/frontend/qt/frontend.go index 1fa9cede..58c35292 100644 --- a/internal/frontend/qt/frontend.go +++ b/internal/frontend/qt/frontend.go @@ -188,6 +188,7 @@ func (s *FrontendQt) watchEvents() { updateApplicationCh := s.getEventChannel(events.UpgradeApplicationEvent) newUserCh := s.getEventChannel(events.UserRefreshEvent) certIssue := s.getEventChannel(events.TLSCertIssue) + imapCertIssue := s.getEventChannel(events.IMAPTLSBadCert) for { select { case errorDetails := <-errorCh: @@ -227,6 +228,8 @@ func (s *FrontendQt) watchEvents() { s.Qml.LoadAccounts() case <-certIssue: s.Qml.ShowCertIssue() + case <-imapCertIssue: + s.Qml.ShowIMAPCertTroubleshoot() } } } diff --git a/internal/frontend/qt/ui.go b/internal/frontend/qt/ui.go index 124c1e9a..bd8a0b4e 100644 --- a/internal/frontend/qt/ui.go +++ b/internal/frontend/qt/ui.go @@ -135,6 +135,7 @@ type GoQMLInterface struct { _ func(x, y float32) `slot:"saveOutgoingNoEncPopupCoord"` _ func(recipient string) `signal:"showNoActiveKeyForRecipient"` _ func() `signal:"showCertIssue"` + _ func() `signal:"ShowIMAPCertTroubleshoot"` _ func() `slot:"startUpdate"` _ func(hasError bool) `signal:"updateFinished"` diff --git a/internal/imap/backend.go b/internal/imap/backend.go index 9fd56bae..0e300fdb 100644 --- a/internal/imap/backend.go +++ b/internal/imap/backend.go @@ -225,6 +225,6 @@ func (ib *imapBackend) upgradeError(err error) { logrus.WithError(err).Error("IMAP connection couldn't be upgraded to TLS during STARTTLS") if strings.Contains(err.Error(), "remote error: tls: bad certificate") { - logrus.Info("TODO: Show troubleshooting popup") + ib.eventListener.Emit(events.IMAPTLSBadCert, err.Error()) } }