Skip to content

Commit c782b08

Browse files
committed
Fix test
1 parent a092b47 commit c782b08

File tree

6 files changed

+18
-5
lines changed

6 files changed

+18
-5
lines changed

models/issue.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -628,7 +628,7 @@ func (issue *Issue) changeStatus(ctx context.Context, doer *user_model.User, isC
628628
func (issue *Issue) doChangeStatus(ctx context.Context, doer *user_model.User, isMergePull bool) (*Comment, error) {
629629
e := db.GetEngine(ctx)
630630
// Check for open dependencies
631-
if issue.IsClosed && issue.Repo.IsDependenciesEnabled(ctx) {
631+
if issue.IsClosed && issue.Repo.IsDependenciesEnabledCtx(ctx) {
632632
// only check if dependencies are enabled and we're about to close an issue, otherwise reopening an issue would fail when there are unsatisfied dependencies
633633
noDeps, err := issueNoDependenciesLeft(e, issue)
634634
if err != nil {

models/lfs_lock.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ func CreateLFSLock(repo *repo_model.Repository, lock *LFSLock) (*LFSLock, error)
4848
}
4949

5050
lock.Path = cleanPath(lock.Path)
51+
lock.RepoID = repo.ID
5152

5253
l, err := GetLFSLock(repo, lock.Path)
5354
if err == nil {

models/repo/issue.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ package repo
77
import (
88
"context"
99

10+
"code.gitea.io/gitea/models/db"
1011
"code.gitea.io/gitea/models/unit"
1112
"code.gitea.io/gitea/modules/log"
1213
"code.gitea.io/gitea/modules/setting"
@@ -50,7 +51,12 @@ func (repo *Repository) AllowOnlyContributorsToTrackTime() bool {
5051
}
5152

5253
// IsDependenciesEnabled returns if dependencies are enabled and returns the default setting if not set.
53-
func (repo *Repository) IsDependenciesEnabled(ctx context.Context) bool {
54+
func (repo *Repository) IsDependenciesEnabled() bool {
55+
return repo.IsDependenciesEnabledCtx(db.DefaultContext)
56+
}
57+
58+
// IsDependenciesEnabledCtx returns if dependencies are enabled and returns the default setting if not set.
59+
func (repo *Repository) IsDependenciesEnabledCtx(ctx context.Context) bool {
5460
var u *RepoUnit
5561
var err error
5662
if u, err = repo.getUnit(ctx, unit.TypeIssues); err != nil {

modules/context/repo.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ func (r *Repository) CanUseTimetracker(issue *models.Issue, user *user_model.Use
159159

160160
// CanCreateIssueDependencies returns whether or not a user can create dependencies.
161161
func (r *Repository) CanCreateIssueDependencies(user *user_model.User, isPull bool) bool {
162-
return r.Repository.IsDependenciesEnabled(db.DefaultContext) && r.Permission.CanWriteIssuesOrPulls(isPull)
162+
return r.Repository.IsDependenciesEnabled() && r.Permission.CanWriteIssuesOrPulls(isPull)
163163
}
164164

165165
// GetCommitsCount returns cached commit count for current view

routers/web/repo/setting.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,12 @@ func Settings(ctx *context.Context) {
6565
signing, _ := models.SigningKey(ctx.Repo.Repository.RepoPath())
6666
ctx.Data["SigningKeyAvailable"] = len(signing) > 0
6767
ctx.Data["SigningSettings"] = setting.Repository.Signing
68+
pushMirrors, err := repo_model.GetPushMirrorsByRepoID(ctx.Repo.Repository.ID)
69+
if err != nil {
70+
ctx.ServerError("GetPushMirrorsByRepoID", err)
71+
return
72+
}
73+
ctx.Data["PushMirrors"] = pushMirrors
6874

6975
ctx.HTML(http.StatusOK, tplSettingsOptions)
7076
}

templates/repo/settings/options.tmpl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@
7878
<div class="ui attached segment">
7979
{{$.i18n.Tr "repo.settings.mirror_settings.docs" | Safe}}
8080
<table class="ui table">
81-
{{if or .Repository.IsMirror .Repository.PushMirrors}}
81+
{{if or .Repository.IsMirror .PushMirrors}}
8282
<thead>
8383
<tr>
8484
<th style="width:40%">{{$.i18n.Tr "repo.settings.mirror_settings.mirrored_repository"}}</th>
@@ -166,7 +166,7 @@
166166
<thead><tr><th colspan="4"></th></tr></thead>
167167
{{end}}
168168
<tbody>
169-
{{range .Repository.PushMirrors}}
169+
{{range .PushMirrors}}
170170
<tr>
171171
{{$address := MirrorRemoteAddress .}}
172172
<td>{{$address.Address}}</td>

0 commit comments

Comments
 (0)