mirror of
https://codeberg.org/davrot/forgejo.git
synced 2025-05-20 05:00:01 +02:00
Use a standalone struct name for Organization (#17632)
* Use a standalone struct name for Organization * recover unnecessary change * make the code readable * Fix template failure * Fix template failure * Move HasMemberWithUserID to org * Fix test * Remove unnecessary user type check * Fix test Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:
parent
a09b40de8d
commit
7a03473159
43 changed files with 335 additions and 259 deletions
|
@ -36,7 +36,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
|
|||
assert.NoError(t, err, "GetUserByID")
|
||||
|
||||
// Create org.
|
||||
org := &models.User{
|
||||
org := &models.Organization{
|
||||
Name: "All_repo",
|
||||
IsActive: true,
|
||||
Type: models.UserTypeOrganization,
|
||||
|
@ -52,7 +52,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
|
|||
// Create repos.
|
||||
repoIds := make([]int64, 0)
|
||||
for i := 0; i < 3; i++ {
|
||||
r, err := CreateRepository(user, org, models.CreateRepoOptions{Name: fmt.Sprintf("repo-%d", i)})
|
||||
r, err := CreateRepository(user, org.AsUser(), models.CreateRepoOptions{Name: fmt.Sprintf("repo-%d", i)})
|
||||
assert.NoError(t, err, "CreateRepository %d", i)
|
||||
if r != nil {
|
||||
repoIds = append(repoIds, r.ID)
|
||||
|
@ -114,8 +114,7 @@ func TestIncludesAllRepositoriesTeams(t *testing.T) {
|
|||
}
|
||||
|
||||
// Create repo and check teams repositories.
|
||||
org.Teams = nil // Reset teams to allow their reloading.
|
||||
r, err := CreateRepository(user, org, models.CreateRepoOptions{Name: "repo-last"})
|
||||
r, err := CreateRepository(user, org.AsUser(), models.CreateRepoOptions{Name: "repo-last"})
|
||||
assert.NoError(t, err, "CreateRepository last")
|
||||
if r != nil {
|
||||
repoIds = append(repoIds, r.ID)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue