-
-
- {{template "repo/migrate/helper" .}} - diff --git a/tests/e2e/repo-migrate.test.e2e.ts b/tests/e2e/repo-migrate.test.e2e.ts index b6541179f0..f0be73e777 100644 --- a/tests/e2e/repo-migrate.test.e2e.ts +++ b/tests/e2e/repo-migrate.test.e2e.ts @@ -7,6 +7,24 @@ import {test, save_visual, test_context, dynamic_id} from './utils_e2e.ts'; test.use({user: 'user2'}); +test('Migration type seleciton screen', async ({page}) => { + await page.goto('/repo/migrate'); + + // For branding purposes, it is desired that `gitea-` prefixes in SVGs are + // replaced with something like `productlogo-`. + await expect(page.locator('svg.gitea-git')).toBeVisible(); + await expect(page.locator('svg.octicon-mark-github')).toBeVisible(); + await expect(page.locator('svg.gitea-gitlab')).toBeVisible(); + await expect(page.locator('svg.gitea-forgejo')).toBeVisible(); + await expect(page.locator('svg.gitea-gitea')).toBeVisible(); + await expect(page.locator('svg.gitea-gogs')).toBeVisible(); + await expect(page.locator('svg.gitea-onedev')).toBeVisible(); + await expect(page.locator('svg.gitea-gitbucket')).toBeVisible(); + await expect(page.locator('svg.gitea-codebase')).toBeVisible(); + + await save_visual(page); +}); + test('Migration Repo Name detection', async ({page}, workerInfo) => { test.skip(workerInfo.project.name === 'Mobile Safari', 'Flaky actionability checks on Mobile Safari'); diff --git a/web_src/css/base.css b/web_src/css/base.css index bfe8cd54ae..dcc33c37ff 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -18,6 +18,7 @@ /* other variables */ --border-radius: 4px; --border-radius-medium: 6px; + --border-radius-large: 25px; --border-radius-full: 99999px; /* TODO: use calc(infinity * 1px) */ --opacity-disabled: 0.55; --height-loading: 16rem; @@ -1282,10 +1283,6 @@ svg.text.purple, width: 100%; } -.migrate .svg.gitea-git { - color: var(--color-git); -} - .color-icon { display: inline-block; border-radius: var(--border-radius-full); diff --git a/web_src/css/index.css b/web_src/css/index.css index eec17eab13..0a5a0180aa 100644 --- a/web_src/css/index.css +++ b/web_src/css/index.css @@ -75,6 +75,7 @@ @import "./explore.css"; @import "./review.css"; @import "./actions.css"; +@import "./migrate.css"; @tailwind utilities; @import "./helpers.css"; diff --git a/web_src/css/migrate.css b/web_src/css/migrate.css new file mode 100644 index 0000000000..d5e909b42d --- /dev/null +++ b/web_src/css/migrate.css @@ -0,0 +1,68 @@ +.migrate .svg.gitea-git { + --git-logo-color: #f05133; + color: var(--git-logo-color); +} + +.migrate-entries { + display: grid; + /* Limited to 4 cols by 1280px container */ + grid-template-columns: repeat(auto-fit, minmax(20rem, 1fr)); + gap: 1.5rem; +} + +.migrate-entry svg { + padding: 1.5rem; +} + +.migrate-entry { + display: flex; + flex-direction: column; + color: var(--color-text); + background: var(--color-card); + border: 1px solid var(--fancy-card-border); + border-radius: var(--border-radius-large); + transition: all 0.1s ease-in-out; +} + +.migrate-entry:hover { + transform: scale(105%); + box-shadow: 0 0.5rem 1rem var(--color-shadow); + color: var(--color-text); +} + +.migrate-entry .content { + width: 100%; + margin-top: .5rem; + padding: 1rem; + flex: 1; +} + +.migrate-entry .description { + margin-top: .5rem; + text-wrap: balance; +} + +/* Desktop layout features */ +@media (min-width: 599.98px) { + .migrate-entry .content { + text-align: center; + border-top: 1px solid var(--fancy-card-border); + border-radius: 0 0 var(--border-radius-large) var(--border-radius-large); + background: var(--fancy-card-bg); + } +} + +/* Mobile layout features */ +@media (max-width: 600px) { + .migrate-entries { + grid-template-columns: repeat(1, 1fr); + } + .migrate-entry { + flex-direction: row; + } + .migrate-entry svg { + height: 100%; + width: 100%; + max-width: 128px; + } +} diff --git a/web_src/css/repo.css b/web_src/css/repo.css index f498a992ed..80fd2be00d 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -2764,37 +2764,6 @@ tbody.commit-list { border-left: 1px solid var(--color-secondary); } -.migrate-entries { - display: grid !important; - grid-template-columns: repeat(3, 1fr); - gap: 25px; - margin: 0 !important; -} - -@media (max-width: 767.98px) { - .migrate-entries { - grid-template-columns: repeat(1, 1fr); - } -} - -.migrate-entry { - transition: all 0.1s ease-in-out; - box-shadow: none !important; - border: 1px solid var(--color-secondary); - color: var(--color-text) !important; - width: auto !important; - margin: 0 !important; -} - -.migrate-entry:hover { - transform: scale(105%); - box-shadow: 0 0.5rem 1rem var(--color-shadow) !important; -} - -.migrate-entry .description { - text-wrap: balance; -} - .commits-table .commits-table-right form { display: flex; align-items: center; diff --git a/web_src/css/themes/theme-forgejo-dark.css b/web_src/css/themes/theme-forgejo-dark.css index c9c538502d..b1b80510d4 100644 --- a/web_src/css/themes/theme-forgejo-dark.css +++ b/web_src/css/themes/theme-forgejo-dark.css @@ -196,7 +196,6 @@ --color-orange-badge: #ea580c; --color-orange-badge-bg: #ea580c22; --color-orange-badge-hover-bg: #ea580c44; - --color-git: #f05133; /* Icon colors (PR/Issue/...) */ --color-icon-green: #3fb950; --color-icon-red: #f85149; @@ -228,6 +227,8 @@ --color-active: var(--steel-650); --color-menu: var(--steel-700); --color-card: var(--steel-700); + --fancy-card-bg: var(--steel-650); + --fancy-card-border: var(--steel-600); --color-markup-table-row: #ffffff06; --color-markup-code-block: var(--steel-800); --color-markup-code-inline: var(--steel-850); diff --git a/web_src/css/themes/theme-forgejo-light.css b/web_src/css/themes/theme-forgejo-light.css index a5e4ffe050..277b52165f 100644 --- a/web_src/css/themes/theme-forgejo-light.css +++ b/web_src/css/themes/theme-forgejo-light.css @@ -212,7 +212,6 @@ --color-orange-badge: #ea580c; --color-orange-badge-bg: #ea580c22; --color-orange-badge-hover-bg: #ea580c44; - --color-git: #f05133; /* Icon colors (PR/Issue/...) */ --color-icon-green: var(--color-green-light); --color-icon-red: var(--color-red-light); @@ -244,6 +243,8 @@ --color-active: #d4d4d8aa; --color-menu: var(--zinc-100); --color-card: var(--zinc-50); + --fancy-card-bg: var(--zinc-100); + --fancy-card-border: var(--zinc-200); --color-markup-table-row: #ffffff06; --color-markup-code-block: var(--zinc-150); --color-markup-code-inline: var(--zinc-200); diff --git a/web_src/css/themes/theme-gitea-dark.css b/web_src/css/themes/theme-gitea-dark.css index 6ad6efe748..7ba428f0b7 100644 --- a/web_src/css/themes/theme-gitea-dark.css +++ b/web_src/css/themes/theme-gitea-dark.css @@ -179,7 +179,6 @@ --color-orange-badge: #f2711c; --color-orange-badge-bg: #f2711c1a; --color-orange-badge-hover-bg: #f2711c4d; - --color-git: #f05133; /* Icon colors (PR/Issue/...) */ --color-icon-green: var(--color-green); --color-icon-red: var(--color-red); @@ -209,6 +208,8 @@ --color-active: #e8e8ff24; --color-menu: #151a1e; --color-card: #151a1e; + --fancy-card-bg: #14171a; + --fancy-card-border: #3b444a; --color-markup-table-row: #e8e8ff0f; --color-markup-code-block: #e8e8ff12; --color-markup-code-inline: #e8e8ff28; diff --git a/web_src/css/themes/theme-gitea-light.css b/web_src/css/themes/theme-gitea-light.css index 830b96febe..8ad89f44a4 100644 --- a/web_src/css/themes/theme-gitea-light.css +++ b/web_src/css/themes/theme-gitea-light.css @@ -179,7 +179,6 @@ --color-orange-badge: #f2711c; --color-orange-badge-bg: #f2711c1a; --color-orange-badge-hover-bg: #f2711c4d; - --color-git: #f05133; /* Icon colors (PR/Issue/...) */ --color-icon-green: var(--color-green); --color-icon-red: var(--color-red); @@ -209,6 +208,8 @@ --color-active: #00001714; --color-menu: #f8f9fb; --color-card: #f8f9fb; + --fancy-card-bg: #ffffff; + --fancy-card-border: #d0d7de; --color-markup-table-row: #0030600a; --color-markup-code-block: #00306010; --color-markup-code-inline: #00306012; diff --git a/web_src/svg/gitea-forgejo.svg b/web_src/svg/gitea-forgejo.svg index e00e5963cf..9daa1ff8f3 100644 --- a/web_src/svg/gitea-forgejo.svg +++ b/web_src/svg/gitea-forgejo.svg @@ -1,5 +1,5 @@ -
- {{svg "octicon-tag"}} + {{svg "octicon-eye"}} {{template "shared/user/avatarlink" dict "user" .Poster}} {{if and (eq (len .RemovedRequestReview) 1) (eq (len .AddedRequestReview) 0) (eq ((index .RemovedRequestReview 0).ID) .PosterID) (eq ((index .RemovedRequestReview 0).Type) "user")}} @@ -724,7 +724,7 @@ {{if or .AddedRequestReview .RemovedRequestReview}}
  • - {{svg "octicon-tag" 20}} + {{svg "octicon-eye" 20}} {{if and (eq (len .RemovedRequestReview) 1) (eq (len .AddedRequestReview) 0) (eq ((index .RemovedRequestReview 0).ID) .PosterID) (eq ((index .RemovedRequestReview 0).Type) "user")}} From 507280b073665f9ca28e4b113712e6294950d485 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Mon, 21 Apr 2025 04:25:08 +0000 Subject: [PATCH 70/75] fix(ui): use gap in switch items (#7581) Followup to PRs where the old switches were converted to this one. The main change here is to the switch with counter. It was missing a gap. Additionally, it removes tailwind helpers the other switches retained from before switch refactors, because they are now using gap. Preview: https://codeberg.org/attachments/6191f55e-0b61-49fa-ba8f-cd9c93ca7bd4 https://codeberg.org/attachments/a03fb681-45b7-40f5-929e-55154abeb20d No visual change to the ones with icons. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7581 Reviewed-by: Gusted --- templates/projects/list.tmpl | 4 ++-- templates/repo/graph.tmpl | 4 ++-- templates/repo/issue/openclose.tmpl | 10 +++++----- templates/user/dashboard/issues.tmpl | 4 ++-- templates/user/dashboard/milestones.tmpl | 4 ++-- web_src/css/modules/switch.css | 1 + 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/templates/projects/list.tmpl b/templates/projects/list.tmpl index 5a9ba004eb..8c9b7c6e6f 100644 --- a/templates/projects/list.tmpl +++ b/templates/projects/list.tmpl @@ -2,11 +2,11 @@
    diff --git a/templates/repo/issue/openclose.tmpl b/templates/repo/issue/openclose.tmpl index 25f73a857d..5d5cf4140e 100644 --- a/templates/repo/issue/openclose.tmpl +++ b/templates/repo/issue/openclose.tmpl @@ -1,21 +1,21 @@
    {{if .PageIsMilestones}} - {{svg "octicon-milestone" 16 "tw-mr-2"}} + {{svg "octicon-milestone" 16}} {{else if .PageIsPullList}} - {{svg "octicon-git-pull-request" 16 "tw-mr-2"}} + {{svg "octicon-git-pull-request" 16}} {{else}} - {{svg "octicon-issue-opened" 16 "tw-mr-2"}} + {{svg "octicon-issue-opened" 16}} {{end}} {{ctx.Locale.PrettyNumber .OpenCount}} {{ctx.Locale.Tr "repo.issues.open_title"}} - {{svg "octicon-issue-closed" 16 "tw-mr-2"}} + {{svg "octicon-issue-closed" 16}} {{ctx.Locale.PrettyNumber .ClosedCount}} {{ctx.Locale.Tr "repo.issues.closed_title"}} {{if not .PageIsMilestones}} - {{svg "octicon-eye" 16 "tw-mr-2"}} + {{svg "octicon-eye" 16}} {{ctx.Locale.PrettyNumber (.AllCount)}} {{ctx.Locale.Tr "repo.issues.all_title"}} {{end}} diff --git a/templates/user/dashboard/issues.tmpl b/templates/user/dashboard/issues.tmpl index e25a9d8219..c76a61c393 100644 --- a/templates/user/dashboard/issues.tmpl +++ b/templates/user/dashboard/issues.tmpl @@ -6,11 +6,11 @@
    diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 01dcbec1c9..267d5e3534 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -37,11 +37,11 @@
    diff --git a/web_src/css/modules/switch.css b/web_src/css/modules/switch.css index a9499a84aa..7780155787 100644 --- a/web_src/css/modules/switch.css +++ b/web_src/css/modules/switch.css @@ -11,6 +11,7 @@ .switch .item { display: flex; + gap: 0.5rem; align-items: center; padding: .5em 1.125em; color: var(--color-text); From 424606c8a4d56bf99a360077d6e546f112911845 Mon Sep 17 00:00:00 2001 From: Renovate Bot Date: Mon, 21 Apr 2025 06:39:22 +0000 Subject: [PATCH 71/75] Update renovate to v39.252.0 (forgejo) (#7587) Co-authored-by: Renovate Bot Co-committed-by: Renovate Bot --- .forgejo/workflows/renovate.yml | 2 +- Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.forgejo/workflows/renovate.yml b/.forgejo/workflows/renovate.yml index c3c732e992..82c318d834 100644 --- a/.forgejo/workflows/renovate.yml +++ b/.forgejo/workflows/renovate.yml @@ -28,7 +28,7 @@ jobs: runs-on: docker container: - image: data.forgejo.org/renovate/renovate:39.240.1 + image: data.forgejo.org/renovate/renovate:39.252.0 steps: - name: Load renovate repo cache diff --git a/Makefile b/Makefile index 0abdfea0eb..22194ff0c7 100644 --- a/Makefile +++ b/Makefile @@ -49,7 +49,7 @@ GOVULNCHECK_PACKAGE ?= golang.org/x/vuln/cmd/govulncheck@v1 # renovate: datasour DEADCODE_PACKAGE ?= golang.org/x/tools/cmd/deadcode@v0.32.0 # renovate: datasource=go GOMOCK_PACKAGE ?= go.uber.org/mock/mockgen@v0.5.1 # renovate: datasource=go GOPLS_PACKAGE ?= golang.org/x/tools/gopls@v0.18.1 # renovate: datasource=go -RENOVATE_NPM_PACKAGE ?= renovate@39.240.1 # renovate: datasource=docker packageName=data.forgejo.org/renovate/renovate +RENOVATE_NPM_PACKAGE ?= renovate@39.252.0 # renovate: datasource=docker packageName=data.forgejo.org/renovate/renovate # https://github.com/disposable-email-domains/disposable-email-domains/commits/main/ DISPOSABLE_EMAILS_SHA ?= 0c27e671231d27cf66370034d7f6818037416989 # renovate: ... From 8e0b86a5dc0adc61df1cc54103748f94f8d7e326 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Mon, 21 Apr 2025 07:25:17 +0000 Subject: [PATCH 72/75] fix(ui): overflow tabular menu CSS fixes (#7578) Change 1 Followup to https://codeberg.org/forgejo/forgejo/pulls/7314 and https://codeberg.org/forgejo/forgejo/pulls/7356 Replace baseline with center, because baseline alignment is broken with Asian scripts. Preview: https://codeberg.org/attachments/f612ca9b-5033-44f1-8bea-b71170c1f595 - bug https://codeberg.org/attachments/69e021eb-96dc-40b1-8c65-9fb4a378e051 - with fix applied Change 2 Followup to https://codeberg.org/forgejo/forgejo/pulls/7108 and https://codeberg.org/forgejo/forgejo/issues/4169 Rescope `.ui.tabular.menu .item { height: 100%;}` to overflow menu, because it was only meant for overflow menu based on PR context, but started to negatively impact the other "bookmark" style menus: they've got an extra bottom line under active tabs. Preview: https://codeberg.org/attachments/b535e437-16fd-4af2-ae8c-221618ec6b8c - bug https://codeberg.org/attachments/10a3086d-8fe7-4317-bd66-71e8139b2cc7 - bug in another area https://codeberg.org/attachments/6a6b8994-c982-48d0-98fe-68e70ba709c2 - with fix applied https://codeberg.org/attachments/8fd8a332-a9ec-4b28-948e-a4e986e301da - intended fix still applies Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7578 Reviewed-by: Michael Kriese Reviewed-by: Gusted --- web_src/css/base.css | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/web_src/css/base.css b/web_src/css/base.css index dcc33c37ff..559a035c2c 100644 --- a/web_src/css/base.css +++ b/web_src/css/base.css @@ -1054,10 +1054,11 @@ overflow-menu .overflow-menu-items { overflow-menu .overflow-menu-items .item { margin-bottom: 0 !important; /* reset fomantic's margin, because the active menu has special bottom border */ + height: 100%; } overflow-menu .overflow-menu-items .item > .svg { - align-self: baseline; + align-self: center; } overflow-menu .ui.label { @@ -1360,10 +1361,6 @@ table th[data-sortt-desc] .svg { border-color: var(--color-secondary); } -.ui.tabular.menu .item { - height: 100%; -} - .ui.tabular.menu .item, .ui.secondary.pointing.menu .item { padding: 11px 12px !important; From 603d655ec44a2f55830f2726c6ad4c428c654f68 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Tue, 22 Apr 2025 03:49:37 +0000 Subject: [PATCH 73/75] fix(i18n): prevent incorrect logging on strings missing in JSON locales (#7594) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fixes https://codeberg.org/forgejo/forgejo/issues/7591 Followup to https://codeberg.org/forgejo/forgejo/pulls/6203 When the test runs without an actual fix included, an error message appears in the logs: [E] Missing translation "incorrect_root_url" With it, it does not. Reported-by: Paweł Bogusławski Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7594 Reviewed-by: Gusted --- modules/translation/i18n/localestore.go | 2 ++ ...nslations_test.go => translations_test.go} | 33 ++++++++++++++++--- 2 files changed, 30 insertions(+), 5 deletions(-) rename tests/integration/{size_translations_test.go => translations_test.go} (77%) diff --git a/modules/translation/i18n/localestore.go b/modules/translation/i18n/localestore.go index bf98b7b5da..8484a10386 100644 --- a/modules/translation/i18n/localestore.go +++ b/modules/translation/i18n/localestore.go @@ -1,4 +1,5 @@ // Copyright 2022 The Gitea Authors. All rights reserved. +// Copyright 2024 The Forgejo Authors. All rights reserved. // SPDX-License-Identifier: MIT package i18n @@ -205,6 +206,7 @@ func (l *locale) TrString(trKey string, trArgs ...any) string { if defaultLang, ok := l.store.localeMap[l.store.defaultLang]; ok { if msg := defaultLang.LookupNewStyleMessage(trKey); msg != "" { format = msg + found = true } else if foundIndex { // Third fallback: old-style default language if msg, ok := defaultLang.idxToMsgMap[idx]; ok { diff --git a/tests/integration/size_translations_test.go b/tests/integration/translations_test.go similarity index 77% rename from tests/integration/size_translations_test.go rename to tests/integration/translations_test.go index d34cd0b490..9cfa3423b7 100644 --- a/tests/integration/size_translations_test.go +++ b/tests/integration/translations_test.go @@ -1,6 +1,5 @@ // Copyright 2024 The Forgejo Authors. All rights reserved. -// SPDX-License-Identifier: MIT - +// SPDX-License-Identifier: GPL-3.0-or-later package integration import ( @@ -13,6 +12,7 @@ import ( "forgejo.org/models/unittest" user_model "forgejo.org/models/user" + "forgejo.org/modules/translation/i18n" files_service "forgejo.org/services/repository/files" "forgejo.org/tests" @@ -20,6 +20,29 @@ import ( "github.com/stretchr/testify/assert" ) +func TestMissingTranslationHandling(t *testing.T) { + // Currently new languages can only be added to localestore via AddLocaleByIni + // so this line is here to make the other one work. When INI locales are removed, + // it will not be needed by this test. + i18n.DefaultLocales.AddLocaleByIni("fun", "Funlang", nil, []byte(""), nil) + + // Add a testing locale to the store + i18n.DefaultLocales.AddToLocaleFromJSON("fun", []byte(`{ + "meta.last_line": "This language only has one line that is never used by the UI. It will never have a translation for incorrect_root_url" + }`)) + + // Get "fun" locale, make sure it's available + funLocale, found := i18n.DefaultLocales.Locale("fun") + assert.True(t, found) + + // Get translation for a string that this locale doesn't have + s := funLocale.TrString("incorrect_root_url") + + // Verify fallback to English + assert.True(t, strings.HasPrefix(s, "This Forgejo instance")) +} + +// TestDataSizeTranslation is a test for usage of TrSize in file size display func TestDataSizeTranslation(t *testing.T) { onGiteaRun(t, func(t *testing.T, giteaURL *url.URL) { testUser := "user2" @@ -103,14 +126,14 @@ func testFileSizeTranslated(t *testing.T, session *TestSession, filePath, correc resp := session.MakeRequest(t, req, http.StatusOK) // Check if file size is translated - sizeCorrent := false + sizeCorrect := false fileInfo := NewHTMLParser(t, resp.Body).Find(".file-info .file-info-entry") fileInfo.Each(func(i int, info *goquery.Selection) { infoText := strings.TrimSpace(info.Text()) if infoText == correctSize { - sizeCorrent = true + sizeCorrect = true } }) - assert.True(t, sizeCorrent) + assert.True(t, sizeCorrect) } From 358863999efd628eea83e76e1c41b3e6c27c4b80 Mon Sep 17 00:00:00 2001 From: Gusted Date: Tue, 22 Apr 2025 08:14:41 +0000 Subject: [PATCH 74/75] fix: delay-write trace.dat for forgejo diagnosis (#7597) - Delay the writing of `trace.dat` to the forgejo diagnosis zip file. It's not possible to write `cpu-profile.dat` and `trace.dat` at the same time. This caused the implemention to prematurely close `cpu-profile.dat` and leave it as an empty file. - Regression of forgejo/forgejo#6470 ## Testing 1. Go to `/admin/monitor` 2. Click on "Download diagnosis report" 3. Open the zip file and check that all files are non-empty. Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7597 Reviewed-by: Earl Warren Co-authored-by: Gusted Co-committed-by: Gusted --- routers/web/admin/diagnosis.go | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/routers/web/admin/diagnosis.go b/routers/web/admin/diagnosis.go index e436dca663..8b0ec45214 100644 --- a/routers/web/admin/diagnosis.go +++ b/routers/web/admin/diagnosis.go @@ -5,7 +5,9 @@ package admin import ( "archive/zip" + "bytes" "fmt" + "io" "runtime" "runtime/pprof" "runtime/trace" @@ -45,14 +47,9 @@ func MonitorDiagnosis(ctx *context.Context) { _, _ = f.Write([]byte(err.Error())) } - f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "trace.dat", Method: zip.Deflate, Modified: time.Now()}) - if err != nil { - ctx.ServerError("Failed to create zip file", err) - return - } - - if err := trace.Start(f); err != nil { - _, _ = f.Write([]byte(err.Error())) + traceBuf := &bytes.Buffer{} + if err := trace.Start(traceBuf); err != nil { + _, _ = traceBuf.Write([]byte(err.Error())) } select { @@ -62,6 +59,17 @@ func MonitorDiagnosis(ctx *context.Context) { pprof.StopCPUProfile() trace.Stop() + f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "trace.dat", Method: zip.Deflate, Modified: time.Now()}) + if err != nil { + ctx.ServerError("Failed to create zip file", err) + return + } + + if _, err := io.Copy(f, traceBuf); err != nil { + ctx.ServerError("Failed to create zip file", err) + return + } + f, err = zipWriter.CreateHeader(&zip.FileHeader{Name: "goroutine-after.txt", Method: zip.Deflate, Modified: time.Now()}) if err != nil { ctx.ServerError("Failed to create zip file", err) From bbb7f6ec6f15ea1c4ccd7d51da6028a2b2fe6882 Mon Sep 17 00:00:00 2001 From: 0ko <0ko@noreply.codeberg.org> Date: Tue, 22 Apr 2025 14:58:32 +0000 Subject: [PATCH 75/75] feat(ui): enlarge metadata line gaps in issue list and refactor (#7580) The metadata line can contain many things and can get very busy. The main change this PR does is addition of `gap:0.5rem` to it's items, so they're better separated. And there are some harmless refactors, too. Preview: https://codeberg.org/attachments/5854ee85-79b3-448a-aafd-4120f34e84e1 - before https://codeberg.org/attachments/b546efe4-06b7-4cd5-84bf-0afb9e84b9d6 - after Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/7580 Reviewed-by: Gusted --- templates/shared/issuelist.tmpl | 34 +++++++++++++++++---------------- web_src/css/repo/issue-list.css | 14 +++++++------- 2 files changed, 25 insertions(+), 23 deletions(-) diff --git a/templates/shared/issuelist.tmpl b/templates/shared/issuelist.tmpl index 53575d82b2..6c0950caff 100644 --- a/templates/shared/issuelist.tmpl +++ b/templates/shared/issuelist.tmpl @@ -52,25 +52,27 @@
    {{end}}
    -
    - - {{if eq $.listType "dashboard"}} - {{.Repo.FullName}}#{{.Index}} +
    + + + {{if eq $.listType "dashboard"}} + {{.Repo.FullName}}#{{.Index}} + {{else}} + #{{.Index}} + {{end}} + + {{$timeStr := DateUtils.TimeSince .GetLastEventTimestamp}} + {{if .OriginalAuthor}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} + {{else if gt .Poster.ID 0}} + {{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}} {{else}} - #{{.Index}} + {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}} {{end}} - - {{$timeStr := DateUtils.TimeSince .GetLastEventTimestamp}} - {{if .OriginalAuthor}} - {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .OriginalAuthor}} - {{else if gt .Poster.ID 0}} - {{ctx.Locale.Tr .GetLastEventLabel $timeStr .Poster.HomeLink .Poster.GetDisplayName}} - {{else}} - {{ctx.Locale.Tr .GetLastEventLabelFake $timeStr .Poster.GetDisplayName}} - {{end}} + {{if .IsPull}} -