Skip to content

Commit ad05b1a

Browse files
authored
Merge branch 'release/v1.23' into lunny/changelog_1.23.2
2 parents 33f7d5a + 92436b8 commit ad05b1a

File tree

19 files changed

+138
-17
lines changed

19 files changed

+138
-17
lines changed

main_timezones.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Copyright 2025 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
//go:build windows
5+
6+
package main
7+
8+
// Golang has the ability to load OS's timezone data from most UNIX systems (https://github.com/golang/go/blob/master/src/time/zoneinfo_unix.go)
9+
// Even if the timezone data is missing, users could install the related packages to get it.
10+
// But on Windows, although `zoneinfo_windows.go` tries to load the timezone data from Windows registry,
11+
// some users still suffer from the issue that the timezone data is missing: https://github.com/go-gitea/gitea/issues/33235
12+
// So we import the tzdata package to make sure the timezone data is included in the binary.
13+
//
14+
// For non-Windows package builders, they could still use the "TAGS=timetzdata" to include the tzdata package in the binary.
15+
// If we decided to add the tzdata for other platforms, modify the "go:build" directive above.
16+
import _ "time/tzdata"

models/issues/issue_project.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,15 @@ func (issue *Issue) projectID(ctx context.Context) int64 {
3838
}
3939

4040
// ProjectColumnID return project column id if issue was assigned to one
41-
func (issue *Issue) ProjectColumnID(ctx context.Context) int64 {
41+
func (issue *Issue) ProjectColumnID(ctx context.Context) (int64, error) {
4242
var ip project_model.ProjectIssue
4343
has, err := db.GetEngine(ctx).Where("issue_id=?", issue.ID).Get(&ip)
44-
if err != nil || !has {
45-
return 0
44+
if err != nil {
45+
return 0, err
46+
} else if !has {
47+
return 0, nil
4648
}
47-
return ip.ProjectColumnID
49+
return ip.ProjectColumnID, nil
4850
}
4951

5052
// LoadIssuesFromColumn load issues assigned to this column

modules/indexer/issues/util.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,11 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
9292
projectID = issue.Project.ID
9393
}
9494

95+
projectColumnID, err := issue.ProjectColumnID(ctx)
96+
if err != nil {
97+
return nil, false, err
98+
}
99+
95100
return &internal.IndexerData{
96101
ID: issue.ID,
97102
RepoID: issue.RepoID,
@@ -106,7 +111,7 @@ func getIssueIndexerData(ctx context.Context, issueID int64) (*internal.IndexerD
106111
NoLabel: len(labels) == 0,
107112
MilestoneID: issue.MilestoneID,
108113
ProjectID: projectID,
109-
ProjectColumnID: issue.ProjectColumnID(ctx),
114+
ProjectColumnID: projectColumnID,
110115
PosterID: issue.PosterID,
111116
AssigneeID: issue.AssigneeID,
112117
MentionIDs: mentionIDs,

options/locale/locale_en-US.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2325,6 +2325,8 @@ settings.event_fork = Fork
23252325
settings.event_fork_desc = Repository forked.
23262326
settings.event_wiki = Wiki
23272327
settings.event_wiki_desc = Wiki page created, renamed, edited or deleted.
2328+
settings.event_statuses = Statuses
2329+
settings.event_statuses_desc = Commit Status updated from the API.
23282330
settings.event_release = Release
23292331
settings.event_release_desc = Release published, updated or deleted in a repository.
23302332
settings.event_push = Push

routers/web/repo/setting/webhook.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,7 @@ func ParseHookEvent(form forms.WebhookForm) *webhook_module.HookEvent {
184184
Wiki: form.Wiki,
185185
Repository: form.Repository,
186186
Package: form.Package,
187+
Status: form.Status,
187188
},
188189
BranchFilter: form.BranchFilter,
189190
}

services/forms/repo_form.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,7 @@ type WebhookForm struct {
263263
Wiki bool
264264
Repository bool
265265
Package bool
266+
Status bool
266267
Active bool
267268
BranchFilter string `binding:"GlobPattern"`
268269
AuthorizationHeader string

services/projects/issue.go

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,29 @@ func MoveIssuesOnProjectColumn(ctx context.Context, doer *user_model.User, colum
5555
continue
5656
}
5757

58-
_, err = db.Exec(ctx, "UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID)
58+
projectColumnID, err := curIssue.ProjectColumnID(ctx)
5959
if err != nil {
6060
return err
6161
}
6262

63-
// add timeline to issue
64-
if _, err := issues_model.CreateComment(ctx, &issues_model.CreateCommentOptions{
65-
Type: issues_model.CommentTypeProjectColumn,
66-
Doer: doer,
67-
Repo: curIssue.Repo,
68-
Issue: curIssue,
69-
ProjectID: column.ProjectID,
70-
ProjectTitle: project.Title,
71-
ProjectColumnID: column.ID,
72-
ProjectColumnTitle: column.Title,
73-
}); err != nil {
63+
if projectColumnID != column.ID {
64+
// add timeline to issue
65+
if _, err := issues_model.CreateComment(ctx, &issues_model.CreateCommentOptions{
66+
Type: issues_model.CommentTypeProjectColumn,
67+
Doer: doer,
68+
Repo: curIssue.Repo,
69+
Issue: curIssue,
70+
ProjectID: column.ProjectID,
71+
ProjectTitle: project.Title,
72+
ProjectColumnID: column.ID,
73+
ProjectColumnTitle: column.Title,
74+
}); err != nil {
75+
return err
76+
}
77+
}
78+
79+
_, err = db.Exec(ctx, "UPDATE `project_issue` SET project_board_id=?, sorting=? WHERE issue_id=?", column.ID, sorting, issueID)
80+
if err != nil {
7481
return err
7582
}
7683
}

services/webhook/dingtalk.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,12 @@ func (dc dingtalkConvertor) Package(p *api.PackagePayload) (DingtalkPayload, err
170170
return createDingtalkPayload(text, text, "view package", p.Package.HTMLURL), nil
171171
}
172172

173+
func (dc dingtalkConvertor) Status(p *api.CommitStatusPayload) (DingtalkPayload, error) {
174+
text, _ := getStatusPayloadInfo(p, noneLinkFormatter, true)
175+
176+
return createDingtalkPayload(text, text, "Status Changed", p.TargetURL), nil
177+
}
178+
173179
func createDingtalkPayload(title, text, singleTitle, singleURL string) DingtalkPayload {
174180
return DingtalkPayload{
175181
MsgType: "actionCard",

services/webhook/discord.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,12 @@ func (d discordConvertor) Package(p *api.PackagePayload) (DiscordPayload, error)
265265
return d.createPayload(p.Sender, text, "", p.Package.HTMLURL, color), nil
266266
}
267267

268+
func (d discordConvertor) Status(p *api.CommitStatusPayload) (DiscordPayload, error) {
269+
text, color := getStatusPayloadInfo(p, noneLinkFormatter, false)
270+
271+
return d.createPayload(p.Sender, text, "", p.TargetURL, color), nil
272+
}
273+
268274
func newDiscordRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) {
269275
meta := &DiscordMeta{}
270276
if err := json.Unmarshal([]byte(w.Meta), meta); err != nil {

services/webhook/feishu.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,12 @@ func (fc feishuConvertor) Package(p *api.PackagePayload) (FeishuPayload, error)
166166
return newFeishuTextPayload(text), nil
167167
}
168168

169+
func (fc feishuConvertor) Status(p *api.CommitStatusPayload) (FeishuPayload, error) {
170+
text, _ := getStatusPayloadInfo(p, noneLinkFormatter, true)
171+
172+
return newFeishuTextPayload(text), nil
173+
}
174+
169175
func newFeishuRequest(_ context.Context, w *webhook_model.Webhook, t *webhook_model.HookTask) (*http.Request, []byte, error) {
170176
var pc payloadConvertor[FeishuPayload] = feishuConvertor{}
171177
return newJSONRequest(pc, w, t, true)

0 commit comments

Comments
 (0)