@@ -16,7 +16,6 @@ import (
16
16
17
17
"code.gitea.io/gitea/models"
18
18
"code.gitea.io/gitea/models/db"
19
- "code.gitea.io/gitea/models/unit"
20
19
unit_model "code.gitea.io/gitea/models/unit"
21
20
"code.gitea.io/gitea/modules/base"
22
21
"code.gitea.io/gitea/modules/context"
@@ -339,7 +338,7 @@ func SettingsPost(ctx *context.Context) {
339
338
case "advanced" :
340
339
var repoChanged bool
341
340
var units []models.RepoUnit
342
- var deleteUnitTypes []unit .Type
341
+ var deleteUnitTypes []unit_model .Type
343
342
344
343
// This section doesn't require repo_name/RepoName to be set in the form, don't show it
345
344
// as an error on the UI for this action
@@ -350,7 +349,7 @@ func SettingsPost(ctx *context.Context) {
350
349
repoChanged = true
351
350
}
352
351
353
- if form .EnableUncyclo && form .EnableExternalUncyclo && ! unit .TypeExternalUncyclo .UnitGlobalDisabled () {
352
+ if form .EnableUncyclo && form .EnableExternalUncyclo && ! unit_model .TypeExternalUncyclo .UnitGlobalDisabled () {
354
353
if ! validation .IsValidExternalURL (form .ExternalUncycloURL ) {
355
354
ctx .Flash .Error (ctx .Tr ("repo.settings.external_wiki_url_error" ))
356
355
ctx .Redirect (repo .Link () + "/settings" )
@@ -359,29 +358,29 @@ func SettingsPost(ctx *context.Context) {
359
358
360
359
units = append (units , models.RepoUnit {
361
360
RepoID : repo .ID ,
362
- Type : unit .TypeExternalUncyclo ,
361
+ Type : unit_model .TypeExternalUncyclo ,
363
362
Config : & models.ExternalUncycloConfig {
364
363
ExternalUncycloURL : form .ExternalUncycloURL ,
365
364
},
366
365
})
367
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeUncyclo )
368
- } else if form .EnableUncyclo && ! form .EnableExternalUncyclo && ! unit .TypeUncyclo .UnitGlobalDisabled () {
366
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeUncyclo )
367
+ } else if form .EnableUncyclo && ! form .EnableExternalUncyclo && ! unit_model .TypeUncyclo .UnitGlobalDisabled () {
369
368
units = append (units , models.RepoUnit {
370
369
RepoID : repo .ID ,
371
- Type : unit .TypeUncyclo ,
370
+ Type : unit_model .TypeUncyclo ,
372
371
Config : new (models.UnitConfig ),
373
372
})
374
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeExternalUncyclo )
373
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeExternalUncyclo )
375
374
} else {
376
- if ! unit .TypeExternalUncyclo .UnitGlobalDisabled () {
377
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeExternalUncyclo )
375
+ if ! unit_model .TypeExternalUncyclo .UnitGlobalDisabled () {
376
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeExternalUncyclo )
378
377
}
379
- if ! unit .TypeUncyclo .UnitGlobalDisabled () {
380
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeUncyclo )
378
+ if ! unit_model .TypeUncyclo .UnitGlobalDisabled () {
379
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeUncyclo )
381
380
}
382
381
}
383
382
384
- if form .EnableIssues && form .EnableExternalTracker && ! unit .TypeExternalTracker .UnitGlobalDisabled () {
383
+ if form .EnableIssues && form .EnableExternalTracker && ! unit_model .TypeExternalTracker .UnitGlobalDisabled () {
385
384
if ! validation .IsValidExternalURL (form .ExternalTrackerURL ) {
386
385
ctx .Flash .Error (ctx .Tr ("repo.settings.external_tracker_url_error" ))
387
386
ctx .Redirect (repo .Link () + "/settings" )
@@ -394,47 +393,47 @@ func SettingsPost(ctx *context.Context) {
394
393
}
395
394
units = append (units , models.RepoUnit {
396
395
RepoID : repo .ID ,
397
- Type : unit .TypeExternalTracker ,
396
+ Type : unit_model .TypeExternalTracker ,
398
397
Config : & models.ExternalTrackerConfig {
399
398
ExternalTrackerURL : form .ExternalTrackerURL ,
400
399
ExternalTrackerFormat : form .TrackerURLFormat ,
401
400
ExternalTrackerStyle : form .TrackerIssueStyle ,
402
401
},
403
402
})
404
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeIssues )
405
- } else if form .EnableIssues && ! form .EnableExternalTracker && ! unit .TypeIssues .UnitGlobalDisabled () {
403
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeIssues )
404
+ } else if form .EnableIssues && ! form .EnableExternalTracker && ! unit_model .TypeIssues .UnitGlobalDisabled () {
406
405
units = append (units , models.RepoUnit {
407
406
RepoID : repo .ID ,
408
- Type : unit .TypeIssues ,
407
+ Type : unit_model .TypeIssues ,
409
408
Config : & models.IssuesConfig {
410
409
EnableTimetracker : form .EnableTimetracker ,
411
410
AllowOnlyContributorsToTrackTime : form .AllowOnlyContributorsToTrackTime ,
412
411
EnableDependencies : form .EnableIssueDependencies ,
413
412
},
414
413
})
415
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeExternalTracker )
414
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeExternalTracker )
416
415
} else {
417
- if ! unit .TypeExternalTracker .UnitGlobalDisabled () {
418
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeExternalTracker )
416
+ if ! unit_model .TypeExternalTracker .UnitGlobalDisabled () {
417
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeExternalTracker )
419
418
}
420
- if ! unit .TypeIssues .UnitGlobalDisabled () {
421
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeIssues )
419
+ if ! unit_model .TypeIssues .UnitGlobalDisabled () {
420
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeIssues )
422
421
}
423
422
}
424
423
425
- if form .EnableProjects && ! unit .TypeProjects .UnitGlobalDisabled () {
424
+ if form .EnableProjects && ! unit_model .TypeProjects .UnitGlobalDisabled () {
426
425
units = append (units , models.RepoUnit {
427
426
RepoID : repo .ID ,
428
- Type : unit .TypeProjects ,
427
+ Type : unit_model .TypeProjects ,
429
428
})
430
- } else if ! unit .TypeProjects .UnitGlobalDisabled () {
431
- deleteUnitTypes = append (deleteUnitTypes , unit .TypeProjects )
429
+ } else if ! unit_model .TypeProjects .UnitGlobalDisabled () {
430
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypeProjects )
432
431
}
433
432
434
- if form .EnablePulls && ! unit .TypePullRequests .UnitGlobalDisabled () {
433
+ if form .EnablePulls && ! unit_model .TypePullRequests .UnitGlobalDisabled () {
435
434
units = append (units , models.RepoUnit {
436
435
RepoID : repo .ID ,
437
- Type : unit .TypePullRequests ,
436
+ Type : unit_model .TypePullRequests ,
438
437
Config : & models.PullRequestsConfig {
439
438
IgnoreWhitespaceConflicts : form .PullsIgnoreWhitespace ,
440
439
AllowMerge : form .PullsAllowMerge ,
@@ -447,8 +446,8 @@ func SettingsPost(ctx *context.Context) {
447
446
DefaultMergeStyle : models .MergeStyle (form .PullsDefaultMergeStyle ),
448
447
},
449
448
})
450
- } else if ! unit .TypePullRequests .UnitGlobalDisabled () {
451
- deleteUnitTypes = append (deleteUnitTypes , unit .TypePullRequests )
449
+ } else if ! unit_model .TypePullRequests .UnitGlobalDisabled () {
450
+ deleteUnitTypes = append (deleteUnitTypes , unit_model .TypePullRequests )
452
451
}
453
452
454
453
if err := models .UpdateRepositoryUnits (repo , units , deleteUnitTypes ); err != nil {
0 commit comments