Skip to content

Commit 2ee9ac8

Browse files
committed
Merge branch 'main' into api-file-hist
2 parents a27b524 + 5723240 commit 2ee9ac8

File tree

470 files changed

+6786
-5757
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

470 files changed

+6786
-5757
lines changed

.drone.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -537,7 +537,7 @@ steps:
537537

538538
- name: static
539539
pull: always
540-
image: techknowlogick/xgo:go-1.16.x
540+
image: techknowlogick/xgo:go-1.17.x
541541
commands:
542542
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
543543
- export PATH=$PATH:$GOPATH/bin
@@ -633,7 +633,7 @@ steps:
633633

634634
- name: static
635635
pull: always
636-
image: techknowlogick/xgo:go-1.16.x
636+
image: techknowlogick/xgo:go-1.17.x
637637
commands:
638638
- curl -sL https://deb.nodesource.com/setup_16.x | bash - && apt-get install -y nodejs
639639
- export PATH=$PATH:$GOPATH/bin

cmd/admin.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"text/tabwriter"
1515

1616
"code.gitea.io/gitea/models"
17+
asymkey_model "code.gitea.io/gitea/models/asymkey"
1718
"code.gitea.io/gitea/models/db"
1819
"code.gitea.io/gitea/models/login"
1920
user_model "code.gitea.io/gitea/models/user"
@@ -625,7 +626,7 @@ func runRegenerateKeys(_ *cli.Context) error {
625626
if err := initDB(ctx); err != nil {
626627
return err
627628
}
628-
return models.RewriteAllPublicKeys()
629+
return asymkey_model.RewriteAllPublicKeys()
629630
}
630631

631632
func parseOAuth2Config(c *cli.Context) *oauth2.Source {

cmd/migrate_storage.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ func migrateAvatars(dstStorage storage.ObjectStorage) error {
102102
}
103103

104104
func migrateRepoAvatars(dstStorage storage.ObjectStorage) error {
105-
return models.IterateRepository(func(repo *models.Repository) error {
105+
return repo_model.IterateRepository(func(repo *repo_model.Repository) error {
106106
_, err := storage.Copy(dstStorage, repo.CustomAvatarRelativePath(), storage.RepoAvatars, repo.CustomAvatarRelativePath())
107107
return err
108108
})

cmd/serv.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import (
1717
"time"
1818

1919
"code.gitea.io/gitea/models"
20+
asymkey_model "code.gitea.io/gitea/models/asymkey"
2021
"code.gitea.io/gitea/models/perm"
2122
"code.gitea.io/gitea/modules/git"
2223
"code.gitea.io/gitea/modules/json"
@@ -129,9 +130,9 @@ func runServ(c *cli.Context) error {
129130
return fail("Internal error", "Failed to check provided key: %v", err)
130131
}
131132
switch key.Type {
132-
case models.KeyTypeDeploy:
133+
case asymkey_model.KeyTypeDeploy:
133134
println("Hi there! You've successfully authenticated with the deploy key named " + key.Name + ", but Gitea does not provide shell access.")
134-
case models.KeyTypePrincipal:
135+
case asymkey_model.KeyTypePrincipal:
135136
println("Hi there! You've successfully authenticated with the principal " + key.Content + ", but Gitea does not provide shell access.")
136137
default:
137138
println("Hi there, " + user.Name + "! You've successfully authenticated with the key named " + key.Name + ", but Gitea does not provide shell access.")

cmd/web.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,7 @@ func setPort(port string) error {
180180
setting.HTTPPort = port
181181

182182
switch setting.Protocol {
183-
case setting.UnixSocket:
183+
case setting.HTTPUnix:
184184
case setting.FCGI:
185185
case setting.FCGIUnix:
186186
default:
@@ -202,7 +202,7 @@ func setPort(port string) error {
202202

203203
func listen(m http.Handler, handleRedirector bool) error {
204204
listenAddr := setting.HTTPAddr
205-
if setting.Protocol != setting.UnixSocket && setting.Protocol != setting.FCGIUnix {
205+
if setting.Protocol != setting.HTTPUnix && setting.Protocol != setting.FCGIUnix {
206206
listenAddr = net.JoinHostPort(listenAddr, setting.HTTPPort)
207207
}
208208
log.Info("Listen: %v://%s%s", setting.Protocol, listenAddr, setting.AppSubURL)
@@ -240,7 +240,7 @@ func listen(m http.Handler, handleRedirector bool) error {
240240
NoHTTPRedirector()
241241
}
242242
err = runFCGI("tcp", listenAddr, "FCGI Web", m)
243-
case setting.UnixSocket:
243+
case setting.HTTPUnix:
244244
if handleRedirector {
245245
NoHTTPRedirector()
246246
}

docs/content/doc/advanced/config-cheat-sheet.en-us.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
233233

234234
## Server (`server`)
235235

236-
- `PROTOCOL`: **http**: \[http, https, fcgi, unix, fcgi+unix\]
236+
- `PROTOCOL`: **http**: \[http, https, fcgi, http+unix, fcgi+unix\]
237237
- `DOMAIN`: **localhost**: Domain name of this server.
238238
- `ROOT_URL`: **%(PROTOCOL)s://%(DOMAIN)s:%(HTTP\_PORT)s/**:
239239
Overwrite the automatically generated public URL.
@@ -248,7 +248,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
248248
- `HTTP_ADDR`: **0.0.0.0**: HTTP listen address.
249249
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
250250
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
251-
- If `PROTOCOL` is set to `unix` or `fcgi+unix`, this should be the name of the Unix socket file to use. Relative paths will be made absolute against the AppWorkPath.
251+
- If `PROTOCOL` is set to `http+unix` or `fcgi+unix`, this should be the name of the Unix socket file to use. Relative paths will be made absolute against the AppWorkPath.
252252
- `HTTP_PORT`: **3000**: HTTP listen port.
253253
- If `PROTOCOL` is set to `fcgi`, Gitea will listen for FastCGI requests on TCP socket
254254
defined by `HTTP_ADDR` and `HTTP_PORT` configuration settings.
@@ -257,7 +257,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
257257
(DMZ) URL for Gitea workers (such as SSH update) accessing web service. In
258258
most cases you do not need to change the default value. Alter it only if
259259
your SSH server node is not the same as HTTP node. Do not set this variable
260-
if `PROTOCOL` is set to `unix`.
260+
if `PROTOCOL` is set to `http+unix`.
261261
- `PER_WRITE_TIMEOUT`: **30s**: Timeout for any write to the connection. (Set to 0 to
262262
disable all timeouts.)
263263
- `PER_WRITE_PER_KB_TIMEOUT`: **10s**: Timeout per Kb written to connections.
@@ -277,7 +277,7 @@ The following configuration set `Content-Type: application/vnd.android.package-a
277277
- `SSH_AUTHORIZED_PRINCIPALS_ALLOW`: **off** or **username, email**: \[off, username, email, anything\]: Specify the principals values that users are allowed to use as principal. When set to `anything` no checks are done on the principal string. When set to `off` authorized principal are not allowed to be set.
278278
- `SSH_CREATE_AUTHORIZED_PRINCIPALS_FILE`: **false/true**: Gitea will create a authorized_principals file by default when it is not using the internal ssh server and `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
279279
- `SSH_AUTHORIZED_PRINCIPALS_BACKUP`: **false/true**: Enable SSH Authorized Principals Backup when rewriting all keys, default is true if `SSH_AUTHORIZED_PRINCIPALS_ALLOW` is not `off`.
280-
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models.PublicKey` and the others are strings which are shellquoted.
280+
- `SSH_AUTHORIZED_KEYS_COMMAND_TEMPLATE`: **{{.AppPath}} --config={{.CustomConf}} serv key-{{.Key.ID}}**: Set the template for the command to passed on authorized keys. Possible keys are: AppPath, AppWorkPath, CustomConf, CustomPath, Key - where Key is a `models/asymkey.PublicKey` and the others are strings which are shellquoted.
281281
- `SSH_SERVER_CIPHERS`: **aes128-ctr, aes192-ctr, aes256-ctr, [email protected], arcfour256, arcfour128**: For the built-in SSH server, choose the ciphers to support for SSH connections, for system SSH this setting has no effect.
282282
- `SSH_SERVER_KEY_EXCHANGES`: **diffie-hellman-group1-sha1, diffie-hellman-group14-sha1, ecdh-sha2-nistp256, ecdh-sha2-nistp384, ecdh-sha2-nistp521, [email protected]**: For the built-in SSH server, choose the key exchange algorithms to support for SSH connections, for system SSH this setting has no effect.
283283
- `SSH_SERVER_MACS`: **[email protected], hmac-sha2-256, hmac-sha1, hmac-sha1-96**: For the built-in SSH server, choose the MACs to support for SSH connections, for system SSH this setting has no effect

docs/content/doc/advanced/config-cheat-sheet.zh-cn.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,14 +84,14 @@ menu:
8484

8585
## Database (`database`)
8686

87-
- `DB_TYPE`: 数据库类型,可选 `mysql`, `postgres`, `mssql`, `tidb``sqlite3`
87+
- `DB_TYPE`: 数据库类型,可选 `mysql`, `postgres`, `mssql``sqlite3`
8888
- `HOST`: 数据库服务器地址和端口。
8989
- `NAME`: 数据库名称。
9090
- `USER`: 数据库用户名。
9191
- `PASSWD`: 数据库用户密码。
9292
- `SSL_MODE`: MySQL 或 PostgreSQL数据库是否启用SSL模式。
9393
- `CHARSET`: **utf8mb4**: 仅当数据库为 MySQL 时有效, 可以为 "utf8" 或 "utf8mb4"。注意:如果使用 "utf8mb4",你的 MySQL InnoDB 版本必须在 5.6 以上。
94-
- `PATH`: Tidb 或者 SQLite3 数据文件存放路径。
94+
- `PATH`: SQLite3 数据文件存放路径。
9595
- `LOG_SQL`: **true**: 显示生成的SQL,默认为真。
9696
- `MAX_IDLE_CONNS` **0**: 最大空闲数据库连接
9797
- `CONN_MAX_LIFETIME` **3s**: 数据库连接最大存活时间

docs/content/page/index.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ Windows, on architectures like amd64, i386, ARM, PowerPC, and others.
7373
- PostgreSQL (>=10)
7474
- SQLite3
7575
- MSSQL (>=2008R2 SP3)
76-
- TiDB (experimental, not recommended)
76+
- TiDB (MySQL protocol)
7777
- Configuration file
7878
- [app.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini)
7979
- Admin panel

docs/content/page/index.fr-fr.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ Le but de ce projet est de fournir de la manière la plus simple, la plus rapide
6868
- PostgreSQL
6969
- SQLite3
7070
- MSSQL
71-
- [TiDB](https://github.com/pingcap/tidb) (expérimental)
71+
- [TiDB](https://github.com/pingcap/tidb) (MySQL protocol)
7272
- Fichier de configuration
7373
- Voir [ici](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini)
7474
- Panel d'administration

docs/content/page/index.zh-cn.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Gitea的首要目标是创建一个极易安装,运行非常快速,安装和
3232
- 支持自定义源的 Gravatar 和 Federated Avatar
3333
- 支持邮件服务
3434
- 支持后台管理面板
35-
- 支持 MySQL、PostgreSQL、SQLite3, MSSQL 和 TiDB(实验性支持) 数据库
35+
- 支持 MySQL、PostgreSQL、SQLite3MSSQL 和 TiDB(MySQL) 数据库
3636
- 支持多语言本地化(21 种语言)
3737

3838
## 系统要求

docs/content/page/index.zh-tw.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ Gitea 是從 [Gogs](http://gogs.io) Fork 出來的,請閱讀部落格文章 [G
6969
- PostgreSQL
7070
- SQLite3
7171
- MSSQL
72-
- TiDB(實驗中, 不建議使用
72+
- TiDB(MySQL 協議
7373
- 設定檔
7474
- [app.ini](https://github.com/go-gitea/gitea/blob/master/custom/conf/app.example.ini)
7575
- 管理員面板

integrations/api_admin_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"net/http"
1010
"testing"
1111

12-
"code.gitea.io/gitea/models"
12+
asymkey_model "code.gitea.io/gitea/models/asymkey"
1313
"code.gitea.io/gitea/models/unittest"
1414
user_model "code.gitea.io/gitea/models/user"
1515
"code.gitea.io/gitea/modules/json"
@@ -34,7 +34,7 @@ func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
3434

3535
var newPublicKey api.PublicKey
3636
DecodeJSON(t, resp, &newPublicKey)
37-
unittest.AssertExistsAndLoadBean(t, &models.PublicKey{
37+
unittest.AssertExistsAndLoadBean(t, &asymkey_model.PublicKey{
3838
ID: newPublicKey.ID,
3939
Name: newPublicKey.Title,
4040
Content: newPublicKey.Key,
@@ -45,7 +45,7 @@ func TestAPIAdminCreateAndDeleteSSHKey(t *testing.T) {
4545
req = NewRequestf(t, "DELETE", "/api/v1/admin/users/%s/keys/%d?token=%s",
4646
keyOwner.Name, newPublicKey.ID, token)
4747
session.MakeRequest(t, req, http.StatusNoContent)
48-
unittest.AssertNotExistsBean(t, &models.PublicKey{ID: newPublicKey.ID})
48+
unittest.AssertNotExistsBean(t, &asymkey_model.PublicKey{ID: newPublicKey.ID})
4949
}
5050

5151
func TestAPIAdminDeleteMissingSSHKey(t *testing.T) {

integrations/api_comment_test.go

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models"
14+
repo_model "code.gitea.io/gitea/models/repo"
1415
"code.gitea.io/gitea/models/unittest"
1516
user_model "code.gitea.io/gitea/models/user"
1617
"code.gitea.io/gitea/modules/convert"
@@ -25,7 +26,7 @@ func TestAPIListRepoComments(t *testing.T) {
2526
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
2627
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
2728
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
28-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
29+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
2930
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
3031

3132
session := loginUser(t, repoOwner.Name)
@@ -71,7 +72,7 @@ func TestAPIListIssueComments(t *testing.T) {
7172
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
7273
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
7374
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
74-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
75+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
7576
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
7677

7778
session := loginUser(t, repoOwner.Name)
@@ -91,7 +92,7 @@ func TestAPICreateComment(t *testing.T) {
9192
const commentBody = "Comment body"
9293

9394
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{}).(*models.Issue)
94-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
95+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
9596
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
9697

9798
session := loginUser(t, repoOwner.Name)
@@ -114,7 +115,7 @@ func TestAPIGetComment(t *testing.T) {
114115

115116
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{ID: 2}).(*models.Comment)
116117
assert.NoError(t, comment.LoadIssue())
117-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: comment.Issue.RepoID}).(*models.Repository)
118+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: comment.Issue.RepoID}).(*repo_model.Repository)
118119
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
119120

120121
session := loginUser(t, repoOwner.Name)
@@ -143,7 +144,7 @@ func TestAPIEditComment(t *testing.T) {
143144
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
144145
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
145146
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
146-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
147+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
147148
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
148149

149150
session := loginUser(t, repoOwner.Name)
@@ -168,7 +169,7 @@ func TestAPIDeleteComment(t *testing.T) {
168169
comment := unittest.AssertExistsAndLoadBean(t, &models.Comment{},
169170
unittest.Cond("type = ?", models.CommentTypeComment)).(*models.Comment)
170171
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{ID: comment.IssueID}).(*models.Issue)
171-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: issue.RepoID}).(*models.Repository)
172+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: issue.RepoID}).(*repo_model.Repository)
172173
repoOwner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
173174

174175
session := loginUser(t, repoOwner.Name)

integrations/api_helper_for_declarative_test.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,8 @@ import (
1313
"testing"
1414
"time"
1515

16-
"code.gitea.io/gitea/models"
1716
"code.gitea.io/gitea/models/perm"
17+
repo_model "code.gitea.io/gitea/models/repo"
1818
"code.gitea.io/gitea/modules/json"
1919
"code.gitea.io/gitea/modules/queue"
2020
api "code.gitea.io/gitea/modules/structs"
@@ -264,7 +264,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
264264
owner, repo, index, ctx.Token)
265265
req := NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
266266
MergeMessageField: "doAPIMergePullRequest Merge",
267-
Do: string(models.MergeStyleMerge),
267+
Do: string(repo_model.MergeStyleMerge),
268268
})
269269

270270
resp := ctx.Session.MakeRequest(t, req, NoExpectedStatus)
@@ -276,7 +276,7 @@ func doAPIMergePullRequest(ctx APITestContext, owner, repo string, index int64)
276276
queue.GetManager().FlushAll(context.Background(), 5*time.Second)
277277
req = NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
278278
MergeMessageField: "doAPIMergePullRequest Merge",
279-
Do: string(models.MergeStyleMerge),
279+
Do: string(repo_model.MergeStyleMerge),
280280
})
281281
resp = ctx.Session.MakeRequest(t, req, NoExpectedStatus)
282282
}
@@ -298,7 +298,7 @@ func doAPIManuallyMergePullRequest(ctx APITestContext, owner, repo, commitID str
298298
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/pulls/%d/merge?token=%s",
299299
owner, repo, index, ctx.Token)
300300
req := NewRequestWithJSON(t, http.MethodPost, urlStr, &forms.MergePullRequestForm{
301-
Do: string(models.MergeStyleManuallyMerged),
301+
Do: string(repo_model.MergeStyleManuallyMerged),
302302
MergeCommitID: commitID,
303303
})
304304

integrations/api_issue_label_test.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import (
1111
"testing"
1212

1313
"code.gitea.io/gitea/models"
14+
repo_model "code.gitea.io/gitea/models/repo"
1415
"code.gitea.io/gitea/models/unittest"
1516
user_model "code.gitea.io/gitea/models/user"
1617
api "code.gitea.io/gitea/modules/structs"
@@ -21,7 +22,7 @@ import (
2122
func TestAPIModifyLabels(t *testing.T) {
2223
assert.NoError(t, unittest.LoadFixtures())
2324

24-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 2}).(*models.Repository)
25+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 2}).(*repo_model.Repository)
2526
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2627
session := loginUser(t, owner.Name)
2728
token := getTokenForLoggedInUser(t, session)
@@ -91,7 +92,7 @@ func TestAPIModifyLabels(t *testing.T) {
9192
func TestAPIAddIssueLabels(t *testing.T) {
9293
assert.NoError(t, unittest.LoadFixtures())
9394

94-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
95+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
9596
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
9697
_ = unittest.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID, ID: 2}).(*models.Label)
9798
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
@@ -114,7 +115,7 @@ func TestAPIAddIssueLabels(t *testing.T) {
114115
func TestAPIReplaceIssueLabels(t *testing.T) {
115116
assert.NoError(t, unittest.LoadFixtures())
116117

117-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
118+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 1}).(*repo_model.Repository)
118119
issue := unittest.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
119120
label := unittest.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID}).(*models.Label)
120121
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
@@ -140,7 +141,7 @@ func TestAPIReplaceIssueLabels(t *testing.T) {
140141
func TestAPIModifyOrgLabels(t *testing.T) {
141142
assert.NoError(t, unittest.LoadFixtures())
142143

143-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: 3}).(*models.Repository)
144+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 3}).(*repo_model.Repository)
144145
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
145146
user := "user1"
146147
session := loginUser(t, user)

integrations/api_issue_milestone_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import (
1010
"testing"
1111

1212
"code.gitea.io/gitea/models"
13+
repo_model "code.gitea.io/gitea/models/repo"
1314
"code.gitea.io/gitea/models/unittest"
1415
user_model "code.gitea.io/gitea/models/user"
1516
"code.gitea.io/gitea/modules/structs"
@@ -21,7 +22,7 @@ func TestAPIIssuesMilestone(t *testing.T) {
2122
defer prepareTestEnv(t)()
2223

2324
milestone := unittest.AssertExistsAndLoadBean(t, &models.Milestone{ID: 1}).(*models.Milestone)
24-
repo := unittest.AssertExistsAndLoadBean(t, &models.Repository{ID: milestone.RepoID}).(*models.Repository)
25+
repo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: milestone.RepoID}).(*repo_model.Repository)
2526
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: repo.OwnerID}).(*user_model.User)
2627
assert.Equal(t, int64(1), int64(milestone.NumIssues))
2728
assert.Equal(t, structs.StateOpen, milestone.State())

0 commit comments

Comments
 (0)