Skip to content

Commit 93d6182

Browse files
committed
Update to latest Gitea 1.15
2 parents 0b07459 + b31307c commit 93d6182

File tree

143 files changed

+42912
-5406
lines changed

Some content is hidden

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

143 files changed

+42912
-5406
lines changed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ require (
7878
github.com/markbates/goth v1.68.0
7979
github.com/mattn/go-isatty v0.0.13
8080
github.com/mattn/go-runewidth v0.0.13 // indirect
81-
github.com/mattn/go-sqlite3 v1.14.7
81+
github.com/mattn/go-sqlite3 v1.14.8
8282
github.com/mholt/archiver/v3 v3.5.0
8383
github.com/microcosm-cc/bluemonday v1.0.15
8484
github.com/miekg/dns v1.1.43 // indirect
@@ -139,7 +139,7 @@ require (
139139
mvdan.cc/xurls/v2 v2.2.0
140140
strk.kbt.io/projects/go/libravatar v0.0.0-20191008002943-06d1c002b251
141141
xorm.io/builder v0.3.9
142-
xorm.io/xorm v1.1.2
142+
xorm.io/xorm v1.2.2
143143
)
144144

145145
replace github.com/hashicorp/go-version => github.com/6543/go-version v1.3.1

go.sum

Lines changed: 175 additions & 27 deletions
Large diffs are not rendered by default.

models/models.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type Engine interface {
3333
Table(tableNameOrBean interface{}) *xorm.Session
3434
Count(...interface{}) (int64, error)
3535
Decr(column string, arg ...interface{}) *xorm.Session
36-
Delete(interface{}) (int64, error)
36+
Delete(...interface{}) (int64, error)
3737
Exec(...interface{}) (sql.Result, error)
3838
Find(interface{}, ...interface{}) error
3939
Get(interface{}) (bool, error)

models/models_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,12 @@ import (
88
"io/ioutil"
99
"os"
1010
"path/filepath"
11+
"strings"
1112
"testing"
1213

14+
"code.gitea.io/gitea/modules/auth/oauth2"
1315
"code.gitea.io/gitea/modules/setting"
16+
"xorm.io/xorm/schemas"
1417

1518
"github.com/stretchr/testify/assert"
1619
)
@@ -32,3 +35,26 @@ func TestDumpDatabase(t *testing.T) {
3235
assert.NoError(t, DumpDatabase(filepath.Join(dir, dbType+".sql"), dbType))
3336
}
3437
}
38+
39+
func TestDumpLoginSource(t *testing.T) {
40+
assert.NoError(t, PrepareTestDatabase())
41+
42+
loginSourceSchema, err := x.TableInfo(new(LoginSource))
43+
assert.NoError(t, err)
44+
45+
CreateLoginSource(&LoginSource{
46+
Type: LoginOAuth2,
47+
Name: "TestSource",
48+
IsActived: false,
49+
Cfg: &OAuth2Config{
50+
Provider: "TestSourceProvider",
51+
CustomURLMapping: &oauth2.CustomURLMapping{},
52+
},
53+
})
54+
55+
sb := new(strings.Builder)
56+
57+
x.DumpTables([]*schemas.Table{loginSourceSchema}, sb)
58+
59+
assert.Contains(t, sb.String(), `"Provider":"TestSourceProvider"`)
60+
}

modules/markup/external/external.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import (
1414
"runtime"
1515
"strings"
1616

17+
"code.gitea.io/gitea/modules/graceful"
1718
"code.gitea.io/gitea/modules/log"
1819
"code.gitea.io/gitea/modules/markup"
1920
"code.gitea.io/gitea/modules/process"
@@ -99,7 +100,12 @@ func (p *Renderer) Render(ctx *markup.RenderContext, input io.Reader, output io.
99100
}
100101

101102
if ctx == nil || ctx.Ctx == nil {
102-
return fmt.Errorf("RenderContext did not provide context")
103+
if ctx == nil {
104+
log.Warn("RenderContext not provided defaulting to empty ctx")
105+
ctx = &markup.RenderContext{}
106+
}
107+
log.Warn("RenderContext did not provide context, defaulting to Shutdown context")
108+
ctx.Ctx = graceful.GetManager().ShutdownContext()
103109
}
104110

105111
processCtx, cancel := context.WithCancel(ctx.Ctx)

routers/web/repo/issue.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,6 +1138,7 @@ func ViewIssue(ctx *context.Context) {
11381138
URLPrefix: ctx.Repo.RepoLink,
11391139
Metas: ctx.Repo.Repository.ComposeMetas(),
11401140
GitRepo: ctx.Repo.GitRepo,
1141+
Ctx: ctx,
11411142
}, issue.Content)
11421143
if err != nil {
11431144
ctx.ServerError("RenderString", err)
@@ -1303,6 +1304,7 @@ func ViewIssue(ctx *context.Context) {
13031304
URLPrefix: ctx.Repo.RepoLink,
13041305
Metas: ctx.Repo.Repository.ComposeMetas(),
13051306
GitRepo: ctx.Repo.GitRepo,
1307+
Ctx: ctx,
13061308
}, comment.Content)
13071309
if err != nil {
13081310
ctx.ServerError("RenderString", err)
@@ -1379,6 +1381,7 @@ func ViewIssue(ctx *context.Context) {
13791381
URLPrefix: ctx.Repo.RepoLink,
13801382
Metas: ctx.Repo.Repository.ComposeMetas(),
13811383
GitRepo: ctx.Repo.GitRepo,
1384+
Ctx: ctx,
13821385
}, comment.Content)
13831386
if err != nil {
13841387
ctx.ServerError("RenderString", err)
@@ -1740,6 +1743,7 @@ func UpdateIssueContent(ctx *context.Context) {
17401743
URLPrefix: ctx.Query("context"),
17411744
Metas: ctx.Repo.Repository.ComposeMetas(),
17421745
GitRepo: ctx.Repo.GitRepo,
1746+
Ctx: ctx,
17431747
}, issue.Content)
17441748
if err != nil {
17451749
ctx.ServerError("RenderString", err)
@@ -2170,6 +2174,7 @@ func UpdateCommentContent(ctx *context.Context) {
21702174
URLPrefix: ctx.Query("context"),
21712175
Metas: ctx.Repo.Repository.ComposeMetas(),
21722176
GitRepo: ctx.Repo.GitRepo,
2177+
Ctx: ctx,
21732178
}, comment.Content)
21742179
if err != nil {
21752180
ctx.ServerError("RenderString", err)

routers/web/repo/milestone.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ func Milestones(ctx *context.Context) {
8989
URLPrefix: ctx.Repo.RepoLink,
9090
Metas: ctx.Repo.Repository.ComposeMetas(),
9191
GitRepo: ctx.Repo.GitRepo,
92+
Ctx: ctx,
9293
}, m.Content)
9394
if err != nil {
9495
ctx.ServerError("RenderString", err)
@@ -282,6 +283,7 @@ func MilestoneIssuesAndPulls(ctx *context.Context) {
282283
URLPrefix: ctx.Repo.RepoLink,
283284
Metas: ctx.Repo.Repository.ComposeMetas(),
284285
GitRepo: ctx.Repo.GitRepo,
286+
Ctx: ctx,
285287
}, milestone.Content)
286288
if err != nil {
287289
ctx.ServerError("RenderString", err)

routers/web/repo/projects.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ func Projects(ctx *context.Context) {
8282
URLPrefix: ctx.Repo.RepoLink,
8383
Metas: ctx.Repo.Repository.ComposeMetas(),
8484
GitRepo: ctx.Repo.GitRepo,
85+
Ctx: ctx,
8586
}, projects[i].Description)
8687
if err != nil {
8788
ctx.ServerError("RenderString", err)
@@ -324,6 +325,7 @@ func ViewProject(ctx *context.Context) {
324325
URLPrefix: ctx.Repo.RepoLink,
325326
Metas: ctx.Repo.Repository.ComposeMetas(),
326327
GitRepo: ctx.Repo.GitRepo,
328+
Ctx: ctx,
327329
}, project.Description)
328330
if err != nil {
329331
ctx.ServerError("RenderString", err)

routers/web/repo/release.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,7 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
146146
URLPrefix: ctx.Repo.RepoLink,
147147
Metas: ctx.Repo.Repository.ComposeMetas(),
148148
GitRepo: ctx.Repo.GitRepo,
149+
Ctx: ctx,
149150
}, r.Note)
150151
if err != nil {
151152
ctx.ServerError("RenderString", err)
@@ -215,6 +216,7 @@ func SingleRelease(ctx *context.Context) {
215216
URLPrefix: ctx.Repo.RepoLink,
216217
Metas: ctx.Repo.Repository.ComposeMetas(),
217218
GitRepo: ctx.Repo.GitRepo,
219+
Ctx: ctx,
218220
}, release.Note)
219221
if err != nil {
220222
ctx.ServerError("RenderString", err)

routers/web/user/home.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ func Milestones(ctx *context.Context) {
272272
milestones[i].RenderedContent, err = markdown.RenderString(&markup.RenderContext{
273273
URLPrefix: milestones[i].Repo.Link(),
274274
Metas: milestones[i].Repo.ComposeMetas(),
275+
Ctx: ctx,
275276
}, milestones[i].Content)
276277
if err != nil {
277278
ctx.ServerError("RenderString", err)

0 commit comments

Comments
 (0)