From 629d6c5e4d665d8e0aaa3ffc908dee77cf07b9c3 Mon Sep 17 00:00:00 2001 From: James Houlahan Date: Thu, 20 May 2021 14:38:20 +0200 Subject: [PATCH 1/2] GODT-1175: report bug --- pkg/pmapi/manager_report.go | 22 ++++++++++++++-------- pkg/pmapi/manager_report_test.go | 20 -------------------- 2 files changed, 14 insertions(+), 28 deletions(-) diff --git a/pkg/pmapi/manager_report.go b/pkg/pmapi/manager_report.go index 7981891..6d08f93 100644 --- a/pkg/pmapi/manager_report.go +++ b/pkg/pmapi/manager_report.go @@ -27,17 +27,23 @@ func (m *manager) ReportBug(ctx context.Context, rep ReportBugReq) error { rep.ClientType = EmailClientType } - r := m.r(ctx) - if len(rep.Attachments) == 0 { - r = r.SetBody(rep) - } else { - r = r.SetMultipartFormData(rep.GetMultipartFormData()) - for _, att := range rep.Attachments { - r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body) - } + if rep.Client == "" { + rep.Client = m.cfg.GetUserAgent() } + + if rep.ClientVersion == "" { + rep.ClientVersion = m.cfg.AppVersion + } + + r := m.r(ctx).SetMultipartFormData(rep.GetMultipartFormData()) + + for _, att := range rep.Attachments { + r = r.SetMultipartField(att.name, att.filename, "application/octet-stream", att.body) + } + if _, err := wrapNoConnection(r.Post("/reports/bug")); err != nil { return err } + return nil } diff --git a/pkg/pmapi/manager_report_test.go b/pkg/pmapi/manager_report_test.go index 53020e0..589a56b 100644 --- a/pkg/pmapi/manager_report_test.go +++ b/pkg/pmapi/manager_report_test.go @@ -19,7 +19,6 @@ package pmapi import ( "context" - "encoding/json" "fmt" "io/ioutil" "net/http" @@ -85,22 +84,3 @@ func TestClient_BugReportWithAttachment(t *testing.T) { err := cm.ReportBug(context.Background(), rep) r.NoError(t, err) } - -func TestClient_BugReport(t *testing.T) { - s := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, req *http.Request) { - r.NoError(t, checkMethodAndPath(req, "POST", "/reports/bug")) - - var bugsReportReq ReportBugReq - r.NoError(t, json.NewDecoder(req.Body).Decode(&bugsReportReq)) - r.Equal(t, testBugReportReq, bugsReportReq) - - w.Header().Set("Content-Type", "application/json") - fmt.Fprint(w, testBugsBody) - })) - defer s.Close() - - cm := newManager(newTestConfig(s.URL)) - - err := cm.ReportBug(context.Background(), testBugReportReq) - r.NoError(t, err) -} From 885fb95454784ca6e43f34c168231c372bfd3f39 Mon Sep 17 00:00:00 2001 From: Jakub Date: Fri, 21 May 2021 07:16:17 +0200 Subject: [PATCH 2/2] Other: Bridge James v1.8.2 --- Changelog.md | 6 ++++++ Makefile | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/Changelog.md b/Changelog.md index 4ac271b..f0479e8 100644 --- a/Changelog.md +++ b/Changelog.md @@ -2,6 +2,12 @@ Changelog [format](http://keepachangelog.com/en/1.0.0/) +## [Bridge 1.8.2] James + +### Fixed +* GODT-1175: Bug reporting. + + ## [Bridge 1.8.1] James ### Fixed diff --git a/Makefile b/Makefile index dd78382..d511739 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ TARGET_OS?=${GOOS} .PHONY: build build-ie build-nogui build-ie-nogui build-launcher build-launcher-ie versioner hasher # Keep version hardcoded so app build works also without Git repository. -BRIDGE_APP_VERSION?=1.8.1+git +BRIDGE_APP_VERSION?=1.8.2+git IE_APP_VERSION?=1.3.3+git APP_VERSION:=${BRIDGE_APP_VERSION} SRC_ICO:=logo.ico