From 749802c9223b787c2681faac6e1f8798df219d50 Mon Sep 17 00:00:00 2001 From: 6543 Date: Mon, 19 Jun 2023 18:40:06 +0200 Subject: [PATCH 01/18] Refactor: TotalTimest return seconds (#25370) so template/browser can deal with string format --- *Sponsored by Kithara Software GmbH* --- models/issues/tracked_time.go | 8 ++++---- models/issues/tracked_time_test.go | 12 ++++++------ templates/repo/issue/view_content/sidebar.tmpl | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/models/issues/tracked_time.go b/models/issues/tracked_time.go index ac65d654f20a3..698014afeba54 100644 --- a/models/issues/tracked_time.go +++ b/models/issues/tracked_time.go @@ -199,8 +199,8 @@ func addTime(ctx context.Context, user *user_model.User, issue *Issue, amount in return tt, db.Insert(ctx, tt) } -// TotalTimes returns the spent time for each user by an issue -func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, error) { +// TotalTimes returns the spent time in seconds for each user by an issue +func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]int64, error) { trackedTimes, err := GetTrackedTimes(db.DefaultContext, options) if err != nil { return nil, err @@ -211,7 +211,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, totalTimesByUser[t.UserID] += t.Time } - totalTimes := make(map[*user_model.User]string) + totalTimes := make(map[*user_model.User]int64) // Fetching User and making time human readable for userID, total := range totalTimesByUser { user, err := user_model.GetUserByID(db.DefaultContext, userID) @@ -221,7 +221,7 @@ func TotalTimes(options *FindTrackedTimesOptions) (map[*user_model.User]string, } return nil, err } - totalTimes[user] = util.SecToTime(total) + totalTimes[user] = total } return totalTimes, nil } diff --git a/models/issues/tracked_time_test.go b/models/issues/tracked_time_test.go index 99b977cca5264..baa170b201265 100644 --- a/models/issues/tracked_time_test.go +++ b/models/issues/tracked_time_test.go @@ -86,8 +86,8 @@ func TestTotalTimes(t *testing.T) { assert.NoError(t, err) assert.Len(t, total, 1) for user, time := range total { - assert.Equal(t, int64(1), user.ID) - assert.Equal(t, "6 minutes 40 seconds", time) + assert.EqualValues(t, 1, user.ID) + assert.EqualValues(t, 400, time) } total, err = issues_model.TotalTimes(&issues_model.FindTrackedTimesOptions{IssueID: 2}) @@ -95,9 +95,9 @@ func TestTotalTimes(t *testing.T) { assert.Len(t, total, 2) for user, time := range total { if user.ID == 2 { - assert.Equal(t, "1 hour 1 minute", time) + assert.EqualValues(t, 3662, time) } else if user.ID == 1 { - assert.Equal(t, "20 seconds", time) + assert.EqualValues(t, 20, time) } else { assert.Error(t, assert.AnError) } @@ -107,8 +107,8 @@ func TestTotalTimes(t *testing.T) { assert.NoError(t, err) assert.Len(t, total, 1) for user, time := range total { - assert.Equal(t, int64(2), user.ID) - assert.Equal(t, "1 second", time) + assert.EqualValues(t, 2, user.ID) + assert.EqualValues(t, 1, time) } total, err = issues_model.TotalTimes(&issues_model.FindTrackedTimesOptions{IssueID: 4}) diff --git a/templates/repo/issue/view_content/sidebar.tmpl b/templates/repo/issue/view_content/sidebar.tmpl index c0f5a8d3d7780..f429655541e7b 100644 --- a/templates/repo/issue/view_content/sidebar.tmpl +++ b/templates/repo/issue/view_content/sidebar.tmpl @@ -340,7 +340,7 @@
{{template "shared/user/authorlink" $user}}
- {{$trackedtime}} + {{$trackedtime|Sec2Time}}
From 7f38cf71fe0dce89b3d7c8749046c43c2b84efe1 Mon Sep 17 00:00:00 2001 From: Denys Konovalov Date: Mon, 19 Jun 2023 19:12:15 +0200 Subject: [PATCH 02/18] Fix issue filters on mobile view (#25368) Fix #24846 applying the solution proposed by @silverwind
Screenshots ![Bildschirmfoto vom 2023-06-19 12-20-54](https://github.com/go-gitea/gitea/assets/47871822/3f4e4536-38c4-451b-bfc0-a7c39acd37f0) ![Bildschirmfoto vom 2023-06-19 12-21-02](https://github.com/go-gitea/gitea/assets/47871822/3403ecc2-4d7f-4acd-b0c0-1b7a10228ff7) ![Bildschirmfoto vom 2023-06-19 12-21-16](https://github.com/go-gitea/gitea/assets/47871822/ef28a2bf-b7cc-4aec-b54b-99d2cc46a1f6) ![Bildschirmfoto vom 2023-06-19 12-21-21](https://github.com/go-gitea/gitea/assets/47871822/f8cd72a5-379e-410b-b0ef-d58895719370) ![Bildschirmfoto vom 2023-06-19 12-21-28](https://github.com/go-gitea/gitea/assets/47871822/34c78301-820c-4106-a086-ae81dc97eb91) ![Bildschirmfoto vom 2023-06-19 12-21-48](https://github.com/go-gitea/gitea/assets/47871822/b677adf1-3a48-42c8-befe-fa9d2679f0a3)
Replaces #25335 --- templates/repo/issue/list.tmpl | 4 ++-- web_src/css/repo/issue-list.css | 13 ++++++++----- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/templates/repo/issue/list.tmpl b/templates/repo/issue/list.tmpl index 12eb31acdc614..3574719eae97d 100644 --- a/templates/repo/issue/list.tmpl +++ b/templates/repo/issue/list.tmpl @@ -89,7 +89,7 @@ {{template "repo/issue/openclose" .}}
-