Skip to content

Commit 15bb6b7

Browse files
jergerlunnyNorthRealmTheFox0x7endo0911engineer
authored andcommitted
[gitea] week 2025-22 cherry pick (gitea/main -> forgejo) (#8198)
## Checklist - [x] go to the last cherry-pick PR (forgejo/forgejo#8040) to figure out how far it went: [gitea@d5bbaee64e](go-gitea/gitea@d5bbaee) - [x] cherry-pick and open PR (forgejo/forgejo#8198) - [ ] have the PR pass the CI - end-to-end (specially important if there are actions related changes) - [ ] add `run-end-to-end` label - [ ] check the result - [ ] write release notes - [ ] assign reviewers - [ ] 48h later, last call - merge 1 hour after the last call ## Legend - ❓ - No decision about the commit has been made. - 🍒 - The commit has been cherry picked. - ⏩ - The commit has been skipped. - 💡 - The commit has been skipped, but should be ported to Forgejo. - ✍️ - The commit has been skipped, and a port to Forgejo already exists. ## Commits - 🍒 [`gitea`](go-gitea/gitea@17cfae8) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/6397da88d30de0a470dabadb8e27fbb202d75458) Hide href attribute of a tag if there is no target_url ([gitea#34556](go-gitea/gitea#34556)) - 🍒 [`gitea`](go-gitea/gitea@b408bf2) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/46bc899d57515fc5349e9113e92da2e4b0d93c75) Fix: skip paths check on tag push events in workflows ([gitea#34602](go-gitea/gitea#34602)) - 🍒 [`gitea`](go-gitea/gitea@9165ea8) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/04332f31bfd8a1c0e8676e4764d44e087f1ccc30) Only activity tab needs heatmap data loading ([gitea#34652](go-gitea/gitea#34652)) - 🍒 [`gitea`](go-gitea/gitea@3f7dbbd) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/2a9019fd0491684cdeab6d50a16e5cffaef5508b) Small fix in Pull Requests page ([gitea#34612](go-gitea/gitea#34612)) - 🍒 [`gitea`](go-gitea/gitea@497b83b) -> [`forgejo`](https://codeberg.org/forgejo/forgejo/commit/9a83cc7bad79fe79447bf6e3cb3144292f922ebb) Fix migration pull request title too long ([gitea#34577](go-gitea/gitea#34577)) ## TODO - 💡 [`gitea`](go-gitea/gitea@6b8b580) Refactor container and UI ([gitea#34736](go-gitea/gitea#34736)) Packages: Fix for container, needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@bbee652) Prevent duplicate form submissions when creating forks ([gitea#34714](go-gitea/gitea#34714)) Fork: Fix, needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@d21ce9f) Improve the performance when detecting the file editable ([gitea#34653](go-gitea/gitea#34653)) LFS: Performance improvement - needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@8fed27b) Fix various problems ([gitea#34708](go-gitea/gitea#34708)) Various: Fixes, tests missing. ------ - 💡 [`gitea`](go-gitea/gitea@c9505a2) Improve instance wide ssh commit signing ([gitea#34341](go-gitea/gitea#34341)) CodeSign: Nice feature - needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@fbc3796) Fix pull requests API convert panic when head repository is deleted. ([gitea#34685](go-gitea/gitea#34685)) Pull: Fix, needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@1610a63) Fix commit message rendering and some UI problems ([gitea#34680](go-gitea/gitea#34680)) Various Fixes - needs carefull merge. ------ - 💡 [`gitea`](go-gitea/gitea@0082cb5) Fix last admin check when syncing users ([gitea#34649](go-gitea/gitea#34649)) oidc: fix "first user is always admin". Needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@c6b2cbd) Fix footnote jump behavior on the issue page. ([gitea#34621](go-gitea/gitea#34621)) Issues: Fix Markdown rendering. Needs carefull merge ------ - 💡 [`gitea`](go-gitea/gitea@7a59f5a) Ignore "Close" error when uploading container blob ([gitea#34620](go-gitea/gitea#34620)) No issue, no test. ------ - 💡 [`gitea`](go-gitea/gitea@6d0b240) Keeping consistent between UI and API about combined commit status state and fix some bugs ([gitea#34562](go-gitea/gitea#34562)) Next PR in Commit-Status story. ------ - 💡 [`gitea`](go-gitea/gitea@f604144) Refactor FindOrgOptions to use enum instead of bool, fix membership visibility ([gitea#34629](go-gitea/gitea#34629)) Just for a common sense here: How should I consider refactorings? ------ - 💡 [`gitea`](go-gitea/gitea@cc942e2) Fix GetUsersByEmails ([gitea#34643](go-gitea/gitea#34643)) User: Seems to fix email validation - but seems not to be finished. ------ - 💡 [`gitea`](go-gitea/gitea@7fa5a88) Add `--color-logo` for text that should match logo color ([gitea#34639](go-gitea/gitea#34639)) UI: Nice idea - can we adapt this? ------ - 💡 [`gitea`](go-gitea/gitea@47d69b7) Validate hex colors when creating/editing labels ([gitea#34623](go-gitea/gitea#34623)) Label: Color validation but needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@108db0b) Fix possible pull request broken when leave the page immediately after clicking the update button ([gitea#34509](go-gitea/gitea#34509)) Nice fix for a bug hard to trace down. Needs careful merge & think about whether a test is possible. ------ - 💡 [`gitea`](go-gitea/gitea@79cc369) Fix issue label delete incorrect labels webhook payload ([gitea#34575](go-gitea/gitea#34575)) Small fix but would expect a test, showing what was fixed. ------ - 💡 [`gitea`](go-gitea/gitea@fe57ee3) fixed incorrect page navigation with up and down arrow on last item of dashboard repos ([gitea#34570](go-gitea/gitea#34570)) Small & simple - but tests are missing. ------ - 💡 [`gitea`](go-gitea/gitea@4e47148) Remove unnecessary duplicate code ([gitea#34552](go-gitea/gitea#34552)) Fix arround "Split GetLatestCommitStatus". ------ - 💡 [`gitea`](go-gitea/gitea@c5e78fc) Do not mutate incoming options to SearchRepositoryByName ([gitea#34553](go-gitea/gitea#34553)) Large refactoring to simplify options handling. But needs careful merge. ------ - 💡 [`gitea`](go-gitea/gitea@f48c013) Fix/improve avatar sync from LDAP ([gitea#34573](go-gitea/gitea#34573)) Nice fix but needs test. ------ - 💡 [`gitea`](go-gitea/gitea@e8d8984) Fix some trivial problems ([gitea#34579](go-gitea/gitea#34579)) Various fixes, tests missing. ------ ## Skipped - ⏩ [`gitea`](go-gitea/gitea@637070e) Fix container range bug ([gitea#34725](go-gitea/gitea#34725)) ------ - ⏩ [`gitea`](go-gitea/gitea@0d3e995) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@28debdb) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@dcc9206) Raise minimum Node.js version to 20, test on 24 ([gitea#34713](go-gitea/gitea#34713)) ------ - ⏩ [`gitea`](go-gitea/gitea@bc28654) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@65986f4) Refactor embedded assets and drop unnecessary dependencies ([gitea#34692](go-gitea/gitea#34692)) ------ - ⏩ [`gitea`](go-gitea/gitea@18bafcc) Bump minimum go version to 1.24.4 ([gitea#34699](go-gitea/gitea#34699)) ------ - ⏩ [`gitea`](go-gitea/gitea@8d135ef) Update JS deps ([gitea#34701](go-gitea/gitea#34701)) ------ - ⏩ [`gitea`](go-gitea/gitea@d5893ee) Fix markdown wrap ([gitea#34697](go-gitea/gitea#34697)) - gitea UI specific specific ------ - ⏩ [`gitea`](go-gitea/gitea@06ccb3a) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@94db956) frontport changelog ([gitea#34689](go-gitea/gitea#34689)) ------ - ⏩ [`gitea`](go-gitea/gitea@d5afdcc) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@e9f5105) Migrate to urfave v3 ([gitea#34510](go-gitea/gitea#34510)) already in Forgejo - see https://codeberg.org/forgejo/forgejo/pulls/8035 ------ - ⏩ [`gitea`](go-gitea/gitea@2c341b6) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@92e7e98) Update x/crypto package and make builtin SSH use default parameters ([gitea#34667](go-gitea/gitea#34667)) ------ - ⏩ [`gitea`](go-gitea/gitea@7b39c82) Fix "oras" OCI client compatibility ([gitea#34666](go-gitea/gitea#34666)) Already in forgejo - see https://codeberg.org/forgejo/forgejo/issues/8070 ------ - ⏩ [`gitea`](go-gitea/gitea@1fe652c) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@a9a705f) Fix missed merge commit sha and time when migrating from codecommit ([gitea#34645](go-gitea/gitea#34645)) Migration: Seems to be an important fix, but no tests. As I know @earl-warren worked hard on migration, is this still relevant to us? ------ - ⏩ [`gitea`](go-gitea/gitea@1e0758a) [skip ci] Updated translations via Crowdin ------ - ⏩ [`gitea`](go-gitea/gitea@f6f6aed) Update JS deps, regenerate SVGs ([gitea#34640](go-gitea/gitea#34640)) ------ - ⏩ [`gitea`](go-gitea/gitea@aa2b3b2) Misc CSS fixes ([gitea#34638](go-gitea/gitea#34638)) - gitea UI specific specific ------ - ⏩ [`gitea`](go-gitea/gitea@b38f2d3) add codecommit to supported services in api docs ([gitea#34626](go-gitea/gitea#34626)) ------ - ⏩ [`gitea`](go-gitea/gitea@74a0178) add openssh-keygen to rootless image ([gitea#34625](go-gitea/gitea#34625)) already in Forgejo - see https://codeberg.org/forgejo/forgejo/issues/6896 ------ - ⏩ [`gitea`](go-gitea/gitea@5b22af4) bump to alpine 3.22 ([gitea#34613](go-gitea/gitea#34613)) ------ - ⏩ [`gitea`](go-gitea/gitea@9e0e107) Fix notification count positioning for variable-width elements ([gitea#34597](go-gitea/gitea#34597)) - gitea UI specific specific ------ - ⏩ [`gitea`](go-gitea/gitea@e5781ce) Fix margin issue in markup paragraph rendering ([gitea#34599](go-gitea/gitea#34599)) - gitea UI specific specific ------ - ⏩ [`gitea`](go-gitea/gitea@375dab1) Make pull request and issue history more compact ([gitea#34588](go-gitea/gitea#34588)) - gitea UI specific specific ------ - ⏩ [`gitea`](go-gitea/gitea@2a1585b) Refactor some tests ([gitea#34580](go-gitea/gitea#34580)) ------ <details> <summary><h2>Stats</h2></summary> <br> Between [`gitea@d5bbaee64e`](go-gitea/gitea@d5bbaee) and [`gitea@6b8b580218`](go-gitea/gitea@6b8b580), **55** commits have been reviewed. We picked **5**, skipped **28** (of which **3** were already in Forgejo!), and decided to port **22**. </details> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: NorthRealm <155140859+NorthRealm@users.noreply.github.com> Co-authored-by: TheFox0x7 <thefox0x7@gmail.com> Co-authored-by: endo0911engineer <161911062+endo0911engineer@users.noreply.github.com> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com> Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8198 Reviewed-by: Earl Warren <earl-warren@noreply.codeberg.org> Co-authored-by: Michael Jerger <michael.jerger@meissa-gmbh.de> Co-committed-by: Michael Jerger <michael.jerger@meissa-gmbh.de>
1 parent adc273e commit 15bb6b7

File tree

9 files changed

+65
-14
lines changed

9 files changed

+65
-14
lines changed

modules/actions/workflows.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -323,6 +323,10 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
323323
matchTimes++
324324
}
325325
case "paths":
326+
if refName.IsTag() {
327+
matchTimes++
328+
break
329+
}
326330
filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
327331
if err != nil {
328332
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)
@@ -336,6 +340,10 @@ func matchPushEvent(commit *git.Commit, pushPayload *api.PushPayload, evt *jobpa
336340
}
337341
}
338342
case "paths-ignore":
343+
if refName.IsTag() {
344+
matchTimes++
345+
break
346+
}
339347
filesChanged, err := commit.GetFilesChangedSinceCommit(pushPayload.Before)
340348
if err != nil {
341349
log.Error("GetFilesChangedSinceCommit [commit_sha1: %s]: %v", commit.ID.String(), err)

modules/actions/workflows_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,24 @@ func TestDetectMatched(t *testing.T) {
150150
yamlOn: "on: workflow_dispatch",
151151
expected: true,
152152
},
153+
{
154+
desc: "push to tag matches workflow with paths condition (should skip paths check)",
155+
triggeredEvent: webhook_module.HookEventPush,
156+
payload: &api.PushPayload{
157+
Ref: "refs/tags/v1.0.0",
158+
Before: "0000000",
159+
Commits: []*api.PayloadCommit{
160+
{
161+
ID: "abcdef123456",
162+
Added: []string{"src/main.go"},
163+
Message: "Release v1.0.0",
164+
},
165+
},
166+
},
167+
commit: nil,
168+
yamlOn: "on:\n push:\n paths:\n - src/**",
169+
expected: true,
170+
},
153171
}
154172

155173
for _, tc := range testCases {

modules/util/truncate.go

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,3 +54,12 @@ func SplitTrimSpace(input, sep string) []string {
5454

5555
return stringList
5656
}
57+
58+
// TruncateRunes returns a truncated string with given rune limit,
59+
// it returns input string if its rune length doesn't exceed the limit.
60+
func TruncateRunes(str string, limit int) string {
61+
if utf8.RuneCountInString(str) < limit {
62+
return str
63+
}
64+
return string([]rune(str)[:limit])
65+
}

modules/util/truncate_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,18 @@ func TestSplitString(t *testing.T) {
4444
}
4545
test(tc, SplitStringAtByteN)
4646
}
47+
48+
func TestTruncateRunes(t *testing.T) {
49+
assert.Empty(t, TruncateRunes("", 0))
50+
assert.Empty(t, TruncateRunes("", 1))
51+
52+
assert.Empty(t, TruncateRunes("ab", 0))
53+
assert.Equal(t, "a", TruncateRunes("ab", 1))
54+
assert.Equal(t, "ab", TruncateRunes("ab", 2))
55+
assert.Equal(t, "ab", TruncateRunes("ab", 3))
56+
57+
assert.Empty(t, TruncateRunes("测试", 0))
58+
assert.Equal(t, "测", TruncateRunes("测试", 1))
59+
assert.Equal(t, "测试", TruncateRunes("测试", 2))
60+
assert.Equal(t, "测试", TruncateRunes("测试", 3))
61+
}

options/locale/locale_en-US.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1628,6 +1628,7 @@ issues.filter_poster = Author
16281628
issues.filter_poster_no_select = All authors
16291629
issues.filter_type = Type
16301630
issues.filter_type.all_issues = All issues
1631+
issues.filter_type.all_pull_requests = All pull requests
16311632
issues.filter_type.assigned_to_you = Assigned to you
16321633
issues.filter_type.created_by_you = Created by you
16331634
issues.filter_type.mentioning_you = Mentioning you

routers/web/user/profile.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -70,17 +70,6 @@ func userProfile(ctx *context.Context) {
7070
ctx.Data["OpenGraphURL"] = ctx.ContextUser.HTMLURL()
7171
ctx.Data["OpenGraphDescription"] = ctx.ContextUser.Description
7272

73-
// prepare heatmap data
74-
if setting.Service.EnableUserHeatmap {
75-
data, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)
76-
if err != nil {
77-
ctx.ServerError("GetUserHeatmapDataByUser", err)
78-
return
79-
}
80-
ctx.Data["HeatmapData"] = data
81-
ctx.Data["HeatmapTotalContributions"] = activities_model.GetTotalContributionsInHeatmap(data)
82-
}
83-
8473
profileDbRepo, profileGitRepo, profileReadmeBlob, profileClose := shared_user.FindUserProfileReadme(ctx, ctx.Doer)
8574
defer profileClose()
8675

@@ -186,6 +175,17 @@ func prepareUserProfileTabData(ctx *context.Context, showPrivate bool, profileDb
186175
ctx.Data["CardsNoneMsg"] = ctx.Tr("followers.outgoing.list.none", ctx.ContextUser.Name)
187176
}
188177
case "activity":
178+
// prepare heatmap data
179+
if setting.Service.EnableUserHeatmap {
180+
data, err := activities_model.GetUserHeatmapDataByUser(ctx, ctx.ContextUser, ctx.Doer)
181+
if err != nil {
182+
ctx.ServerError("GetUserHeatmapDataByUser", err)
183+
return
184+
}
185+
ctx.Data["HeatmapData"] = data
186+
ctx.Data["HeatmapTotalContributions"] = activities_model.GetTotalContributionsInHeatmap(data)
187+
}
188+
189189
date := ctx.FormString("date")
190190
pagingNum = setting.UI.FeedPagingNum
191191
items, count, err := activities_model.GetFeeds(ctx, activities_model.GetFeedsOptions{

services/migrations/gitea_uploader.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -766,7 +766,7 @@ func (g *GiteaLocalUploader) newPullRequest(pr *base.PullRequest) (*issues_model
766766
issue := issues_model.Issue{
767767
RepoID: g.repo.ID,
768768
Repo: g.repo,
769-
Title: prTitle,
769+
Title: util.TruncateRunes(prTitle, 255),
770770
Index: pr.Number,
771771
Content: pr.Content,
772772
MilestoneID: milestoneID,

templates/repo/issue/filter_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@
127127
</span>
128128
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
129129
<div class="menu">
130-
<a rel="nofollow" class="{{if eq .ViewType "all"}}active {{end}}item" href="?q={{$.Keyword}}&type=all&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.all_issues"}}</a>
130+
<a rel="nofollow" class="{{if eq .ViewType "all"}}active {{end}}item" href="?q={{$.Keyword}}&type=all&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.all_pull_requests"}}</a>
131131
<a rel="nofollow" class="{{if eq .ViewType "assigned"}}active {{end}}item" href="?q={{$.Keyword}}&type=assigned&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.assigned_to_you"}}</a>
132132
<a rel="nofollow" class="{{if eq .ViewType "created_by"}}active {{end}}item" href="?q={{$.Keyword}}&type=created_by&sort={{$.SortType}}&state={{$.State}}&labels={{.SelectLabels}}&milestone={{$.MilestoneID}}&project={{$.ProjectID}}&assignee={{$.AssigneeID}}&poster={{$.PosterID}}{{if $.ShowArchivedLabels}}&archived=true{{end}}">{{ctx.Locale.Tr "repo.issues.filter_type.created_by_you"}}</a>
133133
{{if .PageIsPullList}}

web_src/js/components/DashboardRepoList.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -411,7 +411,7 @@ export default sfc; // activate the IDE's Vue plugin
411411
<svg-icon name="octicon-archive" :size="16"/>
412412
</div>
413413
</a>
414-
<a class="tw-flex tw-items-center" v-if="repo.latest_commit_status" :href="repo.latest_commit_status.TargetURL" :data-tooltip-content="repo.locale_latest_commit_status">
414+
<a class="tw-flex tw-items-center" v-if="repo.latest_commit_status" :href="repo.latest_commit_status.TargetURL || null" :data-tooltip-content="repo.locale_latest_commit_status">
415415
<!-- the commit status icon logic is taken from templates/repo/commit_status.tmpl -->
416416
<svg-icon :name="statusIcon(repo.latest_commit_status.State)" :class="'tw-ml-2 commit-status icon text ' + statusColor(repo.latest_commit_status.State)" :size="16"/>
417417
</a>

0 commit comments

Comments
 (0)