Skip to content

Commit 8abecc5

Browse files
committed
* 'main' of https://github.com/go-gitea/gitea: [skip ci] Updated translations via Crowdin Improve the comment for 2FA filter in admin panel (go-gitea#18017) fix regression from go-gitea#16075 (go-gitea#18260) Prevent underline hover on cards (go-gitea#18259) Fix release link broken (go-gitea#18252) migrations: a deadline at January 1st, 1970 is valid (go-gitea#18237)
2 parents 5d238da + 8808293 commit 8abecc5

File tree

8 files changed

+52
-12
lines changed

8 files changed

+52
-12
lines changed

integrations/dump_restore_test.go

Lines changed: 37 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ import (
1515
repo_model "code.gitea.io/gitea/models/repo"
1616
"code.gitea.io/gitea/models/unittest"
1717
user_model "code.gitea.io/gitea/models/user"
18+
base "code.gitea.io/gitea/modules/migration"
1819
"code.gitea.io/gitea/modules/setting"
1920
"code.gitea.io/gitea/modules/structs"
2021
"code.gitea.io/gitea/modules/util"
2122
"code.gitea.io/gitea/services/migrations"
2223

2324
"github.com/stretchr/testify/assert"
25+
"gopkg.in/yaml.v2"
2426
)
2527

2628
func TestDumpRestore(t *testing.T) {
@@ -56,6 +58,8 @@ func TestDumpRestore(t *testing.T) {
5658
var opts = migrations.MigrateOptions{
5759
GitServiceType: structs.GiteaService,
5860
Issues: true,
61+
Labels: true,
62+
Milestones: true,
5963
Comments: true,
6064
AuthToken: token,
6165
CloneAddr: repo.CloneLink().HTTPS,
@@ -68,7 +72,7 @@ func TestDumpRestore(t *testing.T) {
6872
// Verify desired side effects of the dump
6973
//
7074
d := filepath.Join(basePath, repo.OwnerName, repo.Name)
71-
for _, f := range []string{"repo.yml", "topic.yml", "issue.yml"} {
75+
for _, f := range []string{"repo.yml", "topic.yml", "label.yml", "milestone.yml", "issue.yml"} {
7276
assert.FileExists(t, filepath.Join(d, f))
7377
}
7478

@@ -77,7 +81,7 @@ func TestDumpRestore(t *testing.T) {
7781
//
7882

7983
newreponame := "restoredrepo"
80-
err = migrations.RestoreRepository(ctx, d, repo.OwnerName, newreponame, []string{"issues", "comments"})
84+
err = migrations.RestoreRepository(ctx, d, repo.OwnerName, newreponame, []string{"labels", "milestones", "issues", "comments"})
8185
assert.NoError(t, err)
8286

8387
newrepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{Name: newreponame}).(*repo_model.Repository)
@@ -94,11 +98,38 @@ func TestDumpRestore(t *testing.T) {
9498
// Verify the dump of restoredrepo is the same as the dump of repo1
9599
//
96100
newd := filepath.Join(basePath, newrepo.OwnerName, newrepo.Name)
97-
beforeBytes, err := os.ReadFile(filepath.Join(d, "repo.yml"))
101+
for _, filename := range []string{"repo.yml", "label.yml", "milestone.yml"} {
102+
beforeBytes, err := os.ReadFile(filepath.Join(d, filename))
103+
assert.NoError(t, err)
104+
before := strings.ReplaceAll(string(beforeBytes), reponame, newreponame)
105+
after, err := os.ReadFile(filepath.Join(newd, filename))
106+
assert.NoError(t, err)
107+
assert.EqualValues(t, before, string(after))
108+
}
109+
110+
beforeBytes, err := os.ReadFile(filepath.Join(d, "issue.yml"))
98111
assert.NoError(t, err)
99-
before := strings.ReplaceAll(string(beforeBytes), reponame, newreponame)
100-
after, err := os.ReadFile(filepath.Join(newd, "repo.yml"))
112+
var before = make([]*base.Issue, 0, 10)
113+
assert.NoError(t, yaml.Unmarshal(beforeBytes, &before))
114+
afterBytes, err := os.ReadFile(filepath.Join(newd, "issue.yml"))
101115
assert.NoError(t, err)
102-
assert.EqualValues(t, before, string(after))
116+
var after = make([]*base.Issue, 0, 10)
117+
assert.NoError(t, yaml.Unmarshal(afterBytes, &after))
118+
119+
assert.EqualValues(t, len(before), len(after))
120+
if len(before) == len(after) {
121+
for i := 0; i < len(before); i++ {
122+
assert.EqualValues(t, before[i].Number, after[i].Number)
123+
assert.EqualValues(t, before[i].Title, after[i].Title)
124+
assert.EqualValues(t, before[i].Content, after[i].Content)
125+
assert.EqualValues(t, before[i].Ref, after[i].Ref)
126+
assert.EqualValues(t, before[i].Milestone, after[i].Milestone)
127+
assert.EqualValues(t, before[i].State, after[i].State)
128+
assert.EqualValues(t, before[i].IsLocked, after[i].IsLocked)
129+
assert.EqualValues(t, before[i].Created, after[i].Created)
130+
assert.EqualValues(t, before[i].Updated, after[i].Updated)
131+
assert.EqualValues(t, before[i].Labels, after[i].Labels)
132+
}
133+
}
103134
})
104135
}

models/fixtures/milestone.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
is_closed: false
77
num_issues: 1
88
num_closed_issues: 0
9+
deadline_unix: 253370764800
910

1011
-
1112
id: 2
@@ -15,6 +16,7 @@
1516
is_closed: false
1617
num_issues: 0
1718
num_closed_issues: 0
19+
deadline_unix: 253370764800
1820

1921
-
2022
id: 3
@@ -24,6 +26,7 @@
2426
is_closed: true
2527
num_issues: 1
2628
num_closed_issues: 0
29+
deadline_unix: 253370764800
2730

2831
-
2932
id: 4
@@ -33,6 +36,7 @@
3336
is_closed: false
3437
num_issues: 0
3538
num_closed_issues: 0
39+
deadline_unix: 253370764800
3640

3741
-
3842
id: 5
@@ -42,3 +46,4 @@
4246
is_closed: false
4347
num_issues: 0
4448
num_closed_issues: 0
49+
deadline_unix: 253370764800

models/issue_comment.go

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,13 +835,12 @@ func updateCommentInfos(ctx context.Context, opts *CreateCommentOptions, comment
835835
}
836836
}
837837
fallthrough
838-
case CommentTypeReview:
839-
fallthrough
840838
case CommentTypeComment:
841839
if _, err = e.Exec("UPDATE `issue` SET num_comments=num_comments+1 WHERE id=?", opts.Issue.ID); err != nil {
842840
return err
843841
}
844-
842+
fallthrough
843+
case CommentTypeReview:
845844
// Check attachments
846845
attachments, err := repo_model.GetAttachmentsByUUIDs(ctx, opts.Attachments)
847846
if err != nil {

models/user/search.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,9 @@ func (opts *SearchUserOptions) toSearchQueryBase() *xorm.Session {
107107
}
108108

109109
// 2fa filter uses LEFT JOIN to check whether a user has a 2fa record
110-
// TODO: bad performance here, maybe there will be a column "is_2fa_enabled" in the future
110+
// While using LEFT JOIN, sometimes the performance might not be good, but it won't be a problem now, such SQL is seldom executed.
111+
// There are some possible methods to refactor this SQL in future when we really need to optimize the performance (but not now):
112+
// (1) add a column in user table (2) add a setting value in user_setting table (3) use search engines (bleve/elasticsearch)
111113
if opts.IsTwoFactorEnabled.IsTrue() {
112114
cond = cond.And(builder.Expr("two_factor.uid IS NOT NULL"))
113115
} else {

options/locale/locale_fi-FI.ini

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,6 @@ AuthName=Luvan nimi
296296
AdminEmail=Ylläpito sähköposti
297297

298298
NewBranchName=Uuden haaran nimi
299-
CommitSummary=Commitin yhteenveto
300299
CommitMessage=Commitin viesti
301300
CommitChoice=Commitin valinta
302301
TreeName=Tiedostopolku

options/locale/locale_zh-TW.ini

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,9 @@ oauth_signup_submit=完成帳戶
317317
oauth_signin_tab=連結到現有帳戶
318318
oauth_signin_title=登入以授權連結帳戶
319319
oauth_signin_submit=連結帳戶
320+
oauth.signin.error=處理授權請求時發生錯誤。如果這個問題持續發生,請聯絡網站管理員。
321+
oauth.signin.error.access_denied=授權請求被拒絕。
322+
oauth.signin.error.temporarily_unavailable=授權失敗,因為認證伺服器暫時無法使用。請稍後再試。
320323
openid_connect_submit=連接
321324
openid_connect_title=連接到現有帳戶
322325
openid_connect_desc=所選的 OpenID URI 未知。在這裡連結一個新帳戶。

templates/repo/release/list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@
9999
<a href="{{.Publisher.HomeLink}}">{{.Publisher.Name}}</a>
100100
</span>
101101
{{ end }}
102-
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}...{{.Target | PathEscapeSegments}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
102+
<span class="ahead"><a href="{{$.RepoLink}}/compare/{{.TagName | PathEscapeSegments}}{{if .Target}}...{{.Target | PathEscapeSegments}}{{end}}">{{$.i18n.Tr "repo.release.ahead.commits" .NumCommitsBehind | Str2html}}</a> {{$.i18n.Tr "repo.release.ahead.target" $.DefaultBranch}}</span>
103103
</p>
104104
<div class="download">
105105
{{if $.Permission.CanRead $.UnitTypeCode}}

web_src/less/_base.less

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@ a.label,
248248
.repository-menu a,
249249
.ui.search .results a,
250250
.ui .menu a,
251+
.ui.cards a.card,
251252
.issue-keyword a {
252253
text-decoration: none !important;
253254
}

0 commit comments

Comments
 (0)