From 4543d7021666476ef2a809b306998b1439f024d7 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Mon, 11 Mar 2024 17:10:07 +0800 Subject: [PATCH 01/17] Fix inconsistent rendering of block mathematical expressions (#29677) (#29711) Backport #29677 by @yp05327 Fix #28735 GitHub render `\```math\``` ` as a block now. Add `display` class will render it as a block. After: ![image](https://github.com/go-gitea/gitea/assets/18380374/2a1c20c7-438e-4ab1-8c66-cf91c8343087) ![image](https://github.com/go-gitea/gitea/assets/18380374/b81b8a93-8bca-46a5-b7db-e0d2f53e1342) Co-authored-by: yp05327 <576951401@qq.com> Co-authored-by: wxiaoguang (cherry picked from commit 4bfc43ef8de7c5e42f9502aa23075ee5fe04b26b) --- modules/markup/markdown/markdown.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/markup/markdown/markdown.go b/modules/markup/markdown/markdown.go index 771162b9a3..8bf3ac1da2 100644 --- a/modules/markup/markdown/markdown.go +++ b/modules/markup/markdown/markdown.go @@ -103,7 +103,8 @@ func SpecializedMarkdown() goldmark.Markdown { } // include language-x class as part of commonmark spec - _, err = w.WriteString(``) + // the "display" class is used by "js/markup/math.js" to render the code element as a block + _, err = w.WriteString(``) if err != nil { return } From 02ac89c01d16c020e26270f7d7ea1d163f0574b0 Mon Sep 17 00:00:00 2001 From: Lunny Xiao Date: Wed, 13 Mar 2024 00:31:45 +0800 Subject: [PATCH 02/17] Use Get but not Post to get actions artifacts (#29734) (#29737) backport #29734 (cherry picked from commit 8c31456a879797e7247d2cbf65b53fd16939c91d) --- routers/web/web.go | 2 +- web_src/js/components/RepoActionView.vue | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/routers/web/web.go b/routers/web/web.go index 9499363fa9..db4b6b272e 100644 --- a/routers/web/web.go +++ b/routers/web/web.go @@ -1369,7 +1369,7 @@ func registerRoutes(m *web.Route) { }) m.Post("/cancel", reqRepoActionsWriter, actions.Cancel) m.Post("/approve", reqRepoActionsWriter, actions.Approve) - m.Post("/artifacts", actions.ArtifactsView) + m.Get("/artifacts", actions.ArtifactsView) m.Get("/artifacts/{artifact_name}", actions.ArtifactsDownloadView) m.Post("/rerun", reqRepoActionsWriter, actions.Rerun) }) diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 797869b78c..28f4d3af4c 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -5,7 +5,7 @@ import {createApp} from 'vue'; import {toggleElem} from '../utils/dom.js'; import {getCurrentLocale} from '../utils.js'; import {renderAnsi} from '../render/ansi.js'; -import {POST} from '../modules/fetch.js'; +import {GET, POST} from '../modules/fetch.js'; const sfc = { name: 'RepoActionView', @@ -196,7 +196,7 @@ const sfc = { }, async fetchArtifacts() { - const resp = await POST(`${this.actionsURL}/runs/${this.runIndex}/artifacts`); + const resp = await GET(`${this.actionsURL}/runs/${this.runIndex}/artifacts`); return await resp.json(); }, From fefe6062b08dcdce65048a8931d33c2917adadb7 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Wed, 13 Mar 2024 05:45:45 +0800 Subject: [PATCH 03/17] Improve CSV rendering (#29638) (#29744) Backport #29638 by @silverwind Before: Screenshot 2024-03-06 at 21 42 17 After: Screenshot 2024-03-06 at 21 41 58 Co-authored-by: silverwind (cherry picked from commit 12b429c0d151178f1dcdb349dc297fdc9b773364) --- web_src/css/repo.css | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/web_src/css/repo.css b/web_src/css/repo.css index abc866ee5f..2510689a24 100644 --- a/web_src/css/repo.css +++ b/web_src/css/repo.css @@ -1432,6 +1432,7 @@ .repository .data-table tr { border-top: 0; + background: none !important; } .repository .data-table td, @@ -1444,6 +1445,21 @@ border: 1px solid var(--color-secondary); } +/* the border css competes with .markup where all tables have outer border which would add a double + border here, remove only the outer borders from this table */ +.repository .data-table tr:first-child :is(td,th) { + border-top: none !important; +} +.repository .data-table tr:last-child :is(td,th) { + border-bottom: none !important; +} +.repository .data-table tr :is(td,th):first-child { + border-left: none !important; +} +.repository .data-table tr :is(td,th):last-child { + border-right: none !important; +} + .repository .data-table td { white-space: pre-line; } @@ -1481,7 +1497,7 @@ min-width: 50px; font-family: monospace; line-height: 20px; - color: var(--color-secondary-dark-2); + color: var(--color-text-light-1); white-space: nowrap; vertical-align: top; cursor: pointer; From 73498c16225f6b72dc21c2da8c7df833a1820edd Mon Sep 17 00:00:00 2001 From: Giteabot Date: Wed, 13 Mar 2024 16:02:00 +0800 Subject: [PATCH 04/17] Suppress error from monaco-editor (#29684) (#29758) Backport #29684 by @silverwind Fixes: https://github.com/go-gitea/gitea/issues/29414 I see no way for us to catch this error, so downgrade it until https://github.com/microsoft/monaco-editor/issues/4325 is fixed, which will likely take a few weeks to propagate up from vscode. The entries in `updates.config.js` will make [`updates`](https://github.com/silverwind/updates) not upgrade these anymore and I think it's good documentation as well to have the reasons why we don't upgrade these dependencies. Co-authored-by: silverwind (cherry picked from commit 462ae88fc2e6295a9376855627ad2a824a6c8f1d) --- web_src/js/bootstrap.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web_src/js/bootstrap.js b/web_src/js/bootstrap.js index c0047b0ac2..698d17fa36 100644 --- a/web_src/js/bootstrap.js +++ b/web_src/js/bootstrap.js @@ -6,10 +6,18 @@ // This file must be imported before any lazy-loading is being attempted. __webpack_public_path__ = `${window.config?.assetUrlPrefix ?? '/assets'}/`; +const filteredErrors = new Set([ + 'getModifierState is not a function', // https://github.com/microsoft/monaco-editor/issues/4325 +]); + export function showGlobalErrorMessage(msg) { const pageContent = document.querySelector('.page-content'); if (!pageContent) return; + for (const filteredError of filteredErrors) { + if (msg.includes(filteredError)) return; + } + // compact the message to a data attribute to avoid too many duplicated messages const msgCompact = msg.replace(/\W/g, '').trim(); let msgDiv = pageContent.querySelector(`.js-global-error[data-global-error-msg-compact="${msgCompact}"]`); From b68fa8ee09650468e074e4853c49284a3d67cfd1 Mon Sep 17 00:00:00 2001 From: wxiaoguang Date: Wed, 13 Mar 2024 19:43:31 +0800 Subject: [PATCH 05/17] Fix incorrect package link method calls in templates (#29580) (#29764) Backport #29580 Fix #29562 Fix #29762 Follow #29531 (cherry picked from commit bb2640c485071088dd91e47fb510c44e028624fa) --- templates/admin/packages/list.tmpl | 2 +- templates/package/settings.tmpl | 2 +- templates/package/shared/cleanup_rules/preview.tmpl | 2 +- templates/package/shared/list.tmpl | 2 +- templates/package/shared/versionlist.tmpl | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/templates/admin/packages/list.tmpl b/templates/admin/packages/list.tmpl index c67797d6b0..9271182fdc 100644 --- a/templates/admin/packages/list.tmpl +++ b/templates/admin/packages/list.tmpl @@ -63,7 +63,7 @@ {{.Package.Type.Name}} {{.Package.Name}} - {{.Version.Version}} + {{.Version.Version}} {{.Creator.Name}} {{if .Repository}} diff --git a/templates/package/settings.tmpl b/templates/package/settings.tmpl index 6ef62753e2..b5017bcfc4 100644 --- a/templates/package/settings.tmpl +++ b/templates/package/settings.tmpl @@ -4,7 +4,7 @@
{{template "user/overview/header" .}} {{template "base/alert" .}} -

{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}}) / {{ctx.Locale.Tr "repo.settings"}}

+

{{.PackageDescriptor.Package.Name}} ({{.PackageDescriptor.Version.Version}}) / {{ctx.Locale.Tr "repo.settings"}}

{{ctx.Locale.Tr "packages.settings.link"}}

diff --git a/templates/package/shared/cleanup_rules/preview.tmpl b/templates/package/shared/cleanup_rules/preview.tmpl index 7a50d5ccca..cff8e8249f 100644 --- a/templates/package/shared/cleanup_rules/preview.tmpl +++ b/templates/package/shared/cleanup_rules/preview.tmpl @@ -19,7 +19,7 @@ {{.Package.Type.Name}} {{.Package.Name}} - {{.Version.Version}} + {{.Version.Version}} {{.Creator.Name}} {{FileSize .CalculateBlobSize}} {{DateTime "short" .Version.CreatedUnix}} diff --git a/templates/package/shared/list.tmpl b/templates/package/shared/list.tmpl index 73fe031d31..48858f553c 100644 --- a/templates/package/shared/list.tmpl +++ b/templates/package/shared/list.tmpl @@ -20,7 +20,7 @@
- {{.Package.Name}} + {{.Package.Name}} {{svg .Package.Type.SVGName 16}} {{.Package.Type.Name}}
diff --git a/templates/package/shared/versionlist.tmpl b/templates/package/shared/versionlist.tmpl index 71a1557ffb..ee664cc48d 100644 --- a/templates/package/shared/versionlist.tmpl +++ b/templates/package/shared/versionlist.tmpl @@ -23,7 +23,7 @@
- {{.Version.LowerVersion}} + {{.Version.LowerVersion}}
{{ctx.Locale.Tr "packages.published_by" (TimeSinceUnix .Version.CreatedUnix ctx.Locale) .Creator.HomeLink (.Creator.GetDisplayName | Escape) | Safe}}
From 0dcc9b84660d77bfbbfeefe0917b1f8ef59d0b91 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Thu, 14 Mar 2024 16:21:04 +0800 Subject: [PATCH 06/17] Fix missing translation on milestons (#29785) (#29789) Backport #29785 by @lunny Caused by #26569 Fix #29778 Co-authored-by: Lunny Xiao (cherry picked from commit e03cf66e8b537430d24665b647b5af5716d182ee) --- templates/user/dashboard/milestones.tmpl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/templates/user/dashboard/milestones.tmpl b/templates/user/dashboard/milestones.tmpl index 90be082f0f..44a60e6a5c 100644 --- a/templates/user/dashboard/milestones.tmpl +++ b/templates/user/dashboard/milestones.tmpl @@ -62,8 +62,8 @@ {{svg "octicon-triangle-down" 14 "dropdown icon"}}
- +
{{template "repo/issue/label_precolors"}} From a876ac2c7934fa0f8a66424e178b501e4a341e0f Mon Sep 17 00:00:00 2001 From: 6543 Date: Sat, 16 Mar 2024 17:01:40 +0100 Subject: [PATCH 11/17] Make meilisearch do exact search for issues (#29740 & #29671) (#29846) Backport https://github.com/go-gitea/gitea/pull/29740 (based on #29671 ...) (cherry picked from commit 0cbbcf20e3f83413a88fe3d436451d707639fe55) --- .../indexer/issues/meilisearch/meilisearch.go | 20 ++++++++++++++++++- .../issues/meilisearch/meilisearch_test.go | 10 ++++++++++ 2 files changed, 29 insertions(+), 1 deletion(-) diff --git a/modules/indexer/issues/meilisearch/meilisearch.go b/modules/indexer/issues/meilisearch/meilisearch.go index ab8dcd0af4..060b5c5279 100644 --- a/modules/indexer/issues/meilisearch/meilisearch.go +++ b/modules/indexer/issues/meilisearch/meilisearch.go @@ -5,6 +5,7 @@ package meilisearch import ( "context" + "fmt" "strconv" "strings" @@ -210,7 +211,11 @@ func (b *Indexer) Search(ctx context.Context, options *internal.SearchOptions) ( skip, limit := indexer_internal.ParsePaginator(options.Paginator, maxTotalHits) - searchRes, err := b.inner.Client.Index(b.inner.VersionedIndexName()).Search(options.Keyword, &meilisearch.SearchRequest{ + // to make it non fuzzy ("typo tolerance" in meilisearch terms), we have to quote the keyword(s) + // https://www.meilisearch.com/docs/reference/api/search#phrase-search + keyword := doubleQuoteKeyword(options.Keyword) + + searchRes, err := b.inner.Client.Index(b.inner.VersionedIndexName()).Search(keyword, &meilisearch.SearchRequest{ Filter: query.Statement(), Limit: int64(limit), Offset: int64(skip), @@ -241,3 +246,16 @@ func parseSortBy(sortBy internal.SortBy) string { } return field + ":asc" } + +func doubleQuoteKeyword(k string) string { + kp := strings.Split(k, " ") + parts := 0 + for i := range kp { + part := strings.Trim(kp[i], "\"") + if part != "" { + kp[parts] = fmt.Sprintf(`"%s"`, part) + parts++ + } + } + return strings.Join(kp[:parts], " ") +} diff --git a/modules/indexer/issues/meilisearch/meilisearch_test.go b/modules/indexer/issues/meilisearch/meilisearch_test.go index 8a6b0a61d3..91e101f042 100644 --- a/modules/indexer/issues/meilisearch/meilisearch_test.go +++ b/modules/indexer/issues/meilisearch/meilisearch_test.go @@ -11,6 +11,8 @@ import ( "time" "code.gitea.io/gitea/modules/indexer/issues/internal/tests" + + "github.com/stretchr/testify/assert" ) func TestMeilisearchIndexer(t *testing.T) { @@ -49,3 +51,11 @@ func TestMeilisearchIndexer(t *testing.T) { tests.TestIndexer(t, indexer) } + +func TestDoubleQuoteKeyword(t *testing.T) { + assert.EqualValues(t, "", doubleQuoteKeyword("")) + assert.EqualValues(t, `"a" "b" "c"`, doubleQuoteKeyword("a b c")) + assert.EqualValues(t, `"a" "d" "g"`, doubleQuoteKeyword("a d g")) + assert.EqualValues(t, `"a" "d" "g"`, doubleQuoteKeyword("a d g")) + assert.EqualValues(t, `"a" "d" "g"`, doubleQuoteKeyword(`a "" "d" """g`)) +} From 07da773418c784461ce9e418da948511d65e4c99 Mon Sep 17 00:00:00 2001 From: Giteabot Date: Sun, 17 Mar 2024 01:16:45 +0800 Subject: [PATCH 12/17] fix double border and border-radius on empty action steps (#29845) (#29850) Backport #29845 by @silverwind Before, double border-bottom and incorrect border-radius: Screenshot 2024-03-16 at 14 46 31 After, both fixed: Screenshot 2024-03-16 at 14 45 59 Co-authored-by: silverwind (cherry picked from commit 8242c3c88c43bec4905bd689dbb05f7f64e2c3d7) --- web_src/js/components/RepoActionView.vue | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/web_src/js/components/RepoActionView.vue b/web_src/js/components/RepoActionView.vue index 28f4d3af4c..00e5261541 100644 --- a/web_src/js/components/RepoActionView.vue +++ b/web_src/js/components/RepoActionView.vue @@ -446,7 +446,7 @@ export function initRepositoryActionView() {
-
+