Skip to content

Commit 2e141d8

Browse files
committed
fix
1 parent 349c594 commit 2e141d8

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

routers/api/v1/repo/repo.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -856,10 +856,13 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
856856
Config: config,
857857
})
858858
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalWiki)
859-
} else if !*opts.HasWiki && !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
860-
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalWiki)
861-
} else if !*opts.HasWiki && !unit_model.TypeWiki.UnitGlobalDisabled() {
862-
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeWiki)
859+
} else if !*opts.HasWiki {
860+
if !unit_model.TypeExternalWiki.UnitGlobalDisabled() {
861+
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeExternalWiki)
862+
}
863+
if !unit_model.TypeWiki.UnitGlobalDisabled() {
864+
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypeWiki)
865+
}
863866
}
864867
}
865868

tests/integration/api_repo_edit_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,8 @@ func getRepoEditOptionFromRepo(repo *repo_model.Repository) *api.EditRepoOption
5353
hasWiki = true
5454
} else if unit, err := repo.GetUnit(db.DefaultContext, unit_model.TypeExternalWiki); err == nil {
5555
hasWiki = true
56-
config := unit.ExternalWikiConfig()
5756
externalWiki = &api.ExternalWiki{
58-
ExternalWikiURL: config.ExternalWikiURL,
57+
ExternalWikiURL: unit.ExternalWikiConfig().ExternalWikiURL,
5958
}
6059
}
6160
defaultBranch := repo.DefaultBranch

0 commit comments

Comments
 (0)