Skip to content

Commit 3ce30cf

Browse files
committed
Merge remote-tracking branch 'main/release/v1.16' into codeberg-1.16
2 parents e768f12 + 9cc93c0 commit 3ce30cf

File tree

14 files changed

+57
-63
lines changed

14 files changed

+57
-63
lines changed

docs/content/doc/installation/with-docker.fr-fr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ Vous devriez avoir une instance fonctionnelle de Gitea. Pour accèder à l'inter
4343

4444
## Named Volumes
4545

46-
Ce guide aboutira à une installation avec les données Gita et PostgreSQL stockées dans des volumes nommés. Cela permet une sauvegarde, une restauration et des mises à niveau en toute simplicité.
46+
Ce guide aboutira à une installation avec les données Gitea et PostgreSQL stockées dans des volumes nommés. Cela permet une sauvegarde, une restauration et des mises à niveau en toute simplicité.
4747

4848
### The Database
4949

integrations/integration_test.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,13 @@ func TestMain(m *testing.M) {
112112
}
113113
}
114114

115+
os.Unsetenv("GIT_AUTHOR_NAME")
116+
os.Unsetenv("GIT_AUTHOR_EMAIL")
117+
os.Unsetenv("GIT_AUTHOR_DATE")
118+
os.Unsetenv("GIT_COMMITTER_NAME")
119+
os.Unsetenv("GIT_COMMITTER_EMAIL")
120+
os.Unsetenv("GIT_COMMITTER_DATE")
121+
115122
err := unittest.InitFixtures(
116123
unittest.FixturesOptions{
117124
Dir: filepath.Join(filepath.Dir(setting.AppPath), "models/fixtures/"),

models/issue.go

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1174,7 +1174,8 @@ func GetIssuesByIDs(issueIDs []int64) ([]*Issue, error) {
11741174
// IssuesOptions represents options of an issue.
11751175
type IssuesOptions struct {
11761176
db.ListOptions
1177-
RepoIDs []int64 // include all repos if empty
1177+
RepoID int64 // overwrites RepoCond if not 0
1178+
RepoCond builder.Cond
11781179
AssigneeID int64
11791180
PosterID int64
11801181
MentionedID int64
@@ -1265,15 +1266,15 @@ func (opts *IssuesOptions) setupSessionNoLimit(sess *xorm.Session) {
12651266
sess.In("issue.id", opts.IssueIDs)
12661267
}
12671268

1268-
if len(opts.RepoIDs) > 0 {
1269-
applyReposCondition(sess, opts.RepoIDs)
1269+
if opts.RepoID != 0 {
1270+
opts.RepoCond = builder.Eq{"issue.repo_id": opts.RepoID}
1271+
}
1272+
if opts.RepoCond != nil {
1273+
sess.And(opts.RepoCond)
12701274
}
12711275

1272-
switch opts.IsClosed {
1273-
case util.OptionalBoolTrue:
1274-
sess.And("issue.is_closed=?", true)
1275-
case util.OptionalBoolFalse:
1276-
sess.And("issue.is_closed=?", false)
1276+
if !opts.IsClosed.IsNone() {
1277+
sess.And("issue.is_closed=?", opts.IsClosed.IsTrue())
12771278
}
12781279

12791280
if opts.AssigneeID > 0 {
@@ -1392,10 +1393,6 @@ func issuePullAccessibleRepoCond(repoIDstr string, userID int64, org *Organizati
13921393
return cond
13931394
}
13941395

1395-
func applyReposCondition(sess *xorm.Session, repoIDs []int64) *xorm.Session {
1396-
return sess.In("issue.repo_id", repoIDs)
1397-
}
1398-
13991396
func applyAssigneeCondition(sess *xorm.Session, assigneeID int64) *xorm.Session {
14001397
return sess.Join("INNER", "issue_assignees", "issue.id = issue_assignees.issue_id").
14011398
And("issue_assignees.assignee_id = ?", assigneeID)

models/issue_label.go

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,12 +101,9 @@ func (label *Label) CalOpenIssues() {
101101

102102
// CalOpenOrgIssues calculates the open issues of a label for a specific repo
103103
func (label *Label) CalOpenOrgIssues(repoID, labelID int64) {
104-
repoIDs := []int64{repoID}
105-
labelIDs := []int64{labelID}
106-
107104
counts, _ := CountIssuesByRepo(&IssuesOptions{
108-
RepoIDs: repoIDs,
109-
LabelIDs: labelIDs,
105+
RepoID: repoID,
106+
LabelIDs: []int64{labelID},
110107
})
111108

112109
for _, count := range counts {

models/issue_test.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
user_model "code.gitea.io/gitea/models/user"
1818

1919
"github.com/stretchr/testify/assert"
20+
"xorm.io/builder"
2021
)
2122

2223
func TestIssue_ReplaceLabels(t *testing.T) {
@@ -153,7 +154,7 @@ func TestIssues(t *testing.T) {
153154
},
154155
{
155156
IssuesOptions{
156-
RepoIDs: []int64{1, 3},
157+
RepoCond: builder.In("repo_id", 1, 3),
157158
SortType: "oldest",
158159
ListOptions: db.ListOptions{
159160
Page: 1,
@@ -340,7 +341,7 @@ func TestGetRepoIDsForIssuesOptions(t *testing.T) {
340341
},
341342
{
342343
IssuesOptions{
343-
RepoIDs: []int64{1, 2},
344+
RepoCond: builder.In("repo_id", 1, 2),
344345
},
345346
[]int64{1, 2},
346347
},

models/migrations/migrations.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -453,7 +453,7 @@ Please try upgrading to a lower version first (suggested v1.6.4), then upgrade t
453453

454454
// Downgrading Gitea's database version not supported
455455
if int(v-minDBVersion) > len(migrations) {
456-
msg := fmt.Sprintf("Your database (migration version: %d) is for a newer Gita, you can not use the newer database for this old Gitea release (%d).", v, minDBVersion+len(migrations))
456+
msg := fmt.Sprintf("Your database (migration version: %d) is for a newer Gitea, you can not use the newer database for this old Gitea release (%d).", v, minDBVersion+len(migrations))
457457
msg += "\nGitea will exit to keep your database safe and unchanged. Please use the correct Gitea release, do not change the migration version manually (incorrect manual operation may lose data)."
458458
if !setting.IsProd {
459459
msg += fmt.Sprintf("\nIf you are in development and really know what you're doing, you can force changing the migration version by executing: UPDATE version SET version=%d WHERE id=1;", minDBVersion+len(migrations))

modules/doctor/authorizedkeys.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ func checkAuthorizedKeys(logger log.Logger, autofix bool) error {
7171
"authorized_keys file %q is out of date.\nRegenerate it with:\n\t\"%s\"\nor\n\t\"%s\"",
7272
fPath,
7373
"gitea admin regenerate keys",
74-
"gitea doctor --run authorized_keys --fix")
75-
return fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized_keys --fix"`)
74+
"gitea doctor --run authorized-keys --fix")
75+
return fmt.Errorf(`authorized_keys is out of date and should be regenerated with "gitea admin regenerate keys" or "gitea doctor --run authorized-keys --fix"`)
7676
}
7777
logger.Warn("authorized_keys is out of date. Attempting rewrite...")
7878
err = asymkey_model.RewriteAllPublicKeys()

modules/indexer/issues/indexer.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ func populateIssueIndexer(ctx context.Context) {
272272
// UpdateRepoIndexer add/update all issues of the repositories
273273
func UpdateRepoIndexer(repo *repo_model.Repository) {
274274
is, err := models.Issues(&models.IssuesOptions{
275-
RepoIDs: []int64{repo.ID},
275+
RepoID: repo.ID,
276276
IsClosed: util.OptionalBoolNone,
277277
IsPull: util.OptionalBoolNone,
278278
})

routers/api/v1/repo/issue.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,7 @@ func SearchIssues(ctx *context.APIContext) {
173173
opts.TeamID = team.ID
174174
}
175175

176+
repoCond := models.SearchRepositoryCondition(opts)
176177
repoIDs, _, err := models.SearchRepositoryIDs(opts)
177178
if err != nil {
178179
ctx.Error(http.StatusInternalServerError, "SearchRepositoryByName", err)
@@ -233,7 +234,7 @@ func SearchIssues(ctx *context.APIContext) {
233234
Page: ctx.FormInt("page"),
234235
PageSize: limit,
235236
},
236-
RepoIDs: repoIDs,
237+
RepoCond: repoCond,
237238
IsClosed: isClosed,
238239
IssueIDs: issueIDs,
239240
IncludedLabelNames: includedLabelNames,
@@ -460,7 +461,7 @@ func ListIssues(ctx *context.APIContext) {
460461
if len(keyword) == 0 || len(issueIDs) > 0 || len(labelIDs) > 0 {
461462
issuesOpt := &models.IssuesOptions{
462463
ListOptions: listOptions,
463-
RepoIDs: []int64{ctx.Repo.Repository.ID},
464+
RepoID: ctx.Repo.Repository.ID,
464465
IsClosed: isClosed,
465466
IssueIDs: issueIDs,
466467
LabelIDs: labelIDs,

routers/web/repo/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ func issues(ctx *context.Context, milestoneID, projectID int64, isPullOption uti
226226
Page: pager.Paginater.Current(),
227227
PageSize: setting.UI.IssuePagingNum,
228228
},
229-
RepoIDs: []int64{repo.ID},
229+
RepoID: repo.ID,
230230
AssigneeID: assigneeID,
231231
PosterID: posterID,
232232
MentionedID: mentionedID,

0 commit comments

Comments
 (0)