Skip to content

Commit f4e1295

Browse files
authored
Merge branch 'main' into dynamic-contenthash
2 parents a3c6037 + 502f752 commit f4e1295

File tree

8 files changed

+46
-6
lines changed

8 files changed

+46
-6
lines changed

docs/content/doc/usage/backup-and-restore.en-us.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ The SQL dump created by `gitea dump` uses XORM and Gitea admins may prefer to us
6262
# mysql
6363
mysqldump -u$USER -p$PASS --database $DATABASE > gitea-db.sql
6464
# postgres
65-
pgdump -U $USER $DATABASE > gitea-db.sql
65+
pg_dump -U $USER $DATABASE > gitea-db.sql
6666
```
6767

6868
### Using Docker (`dump`)

models/asymkey/gpg_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ type GPGKey struct {
3333
OwnerID int64 `xorm:"INDEX NOT NULL"`
3434
KeyID string `xorm:"INDEX CHAR(16) NOT NULL"`
3535
PrimaryKeyID string `xorm:"CHAR(16)"`
36-
Content string `xorm:"TEXT NOT NULL"`
36+
Content string `xorm:"MEDIUMTEXT NOT NULL"`
3737
CreatedUnix timeutil.TimeStamp `xorm:"created"`
3838
ExpiredUnix timeutil.TimeStamp
3939
AddedUnix timeutil.TimeStamp

models/asymkey/ssh_key.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ type PublicKey struct {
4141
OwnerID int64 `xorm:"INDEX NOT NULL"`
4242
Name string `xorm:"NOT NULL"`
4343
Fingerprint string `xorm:"INDEX NOT NULL"`
44-
Content string `xorm:"TEXT NOT NULL"`
44+
Content string `xorm:"MEDIUMTEXT NOT NULL"`
4545
Mode perm.AccessMode `xorm:"NOT NULL DEFAULT 2"`
4646
Type KeyType `xorm:"NOT NULL DEFAULT 1"`
4747
LoginSourceID int64 `xorm:"NOT NULL DEFAULT 0"`

models/migrations/migrations.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -406,8 +406,13 @@ var migrations = []Migration{
406406
NewMigration("Drop old CredentialID column", dropOldCredentialIDColumn),
407407
// v223 -> v224
408408
NewMigration("Rename CredentialIDBytes column to CredentialID", renameCredentialIDBytes),
409+
410+
// Gitea 1.17.0 ends at v224
411+
409412
// v224 -> v225
410-
NewMigration("Add badges to users", creatUserBadgesTable),
413+
NewMigration("Add badges to users", createUserBadgesTable),
414+
// v225 -> v226
415+
NewMigration("Alter gpg_key/public_key content TEXT fields to MEDIUMTEXT", alterPublicGPGKeyContentFieldsToMediumText),
411416
}
412417

413418
// GetCurrentDBVersion returns the current db version

models/migrations/v224.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"xorm.io/xorm"
99
)
1010

11-
func creatUserBadgesTable(x *xorm.Engine) error {
11+
func createUserBadgesTable(x *xorm.Engine) error {
1212
type Badge struct {
1313
ID int64 `xorm:"pk autoincr"`
1414
Description string

models/migrations/v225.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2022 The Gitea Authors. All rights reserved.
2+
// Use of this source code is governed by a MIT-style
3+
// license that can be found in the LICENSE file.
4+
5+
package migrations
6+
7+
import (
8+
"code.gitea.io/gitea/modules/setting"
9+
10+
"xorm.io/xorm"
11+
)
12+
13+
func alterPublicGPGKeyContentFieldsToMediumText(x *xorm.Engine) error {
14+
sess := x.NewSession()
15+
defer sess.Close()
16+
if err := sess.Begin(); err != nil {
17+
return err
18+
}
19+
20+
if setting.Database.UseMySQL {
21+
if _, err := sess.Exec("ALTER TABLE `gpg_key` CHANGE `content` `content` MEDIUMTEXT"); err != nil {
22+
return err
23+
}
24+
if _, err := sess.Exec("ALTER TABLE `public_key` CHANGE `content` `content` MEDIUMTEXT"); err != nil {
25+
return err
26+
}
27+
}
28+
return sess.Commit()
29+
}

routers/web/user/home.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -301,6 +301,7 @@ func Pulls(ctx *context.Context) {
301301

302302
ctx.Data["Title"] = ctx.Tr("pull_requests")
303303
ctx.Data["PageIsPulls"] = true
304+
ctx.Data["SingleRepoAction"] = "pull"
304305
buildIssueOverview(ctx, unit.TypePullRequests)
305306
}
306307

@@ -314,6 +315,7 @@ func Issues(ctx *context.Context) {
314315

315316
ctx.Data["Title"] = ctx.Tr("issues")
316317
ctx.Data["PageIsIssues"] = true
318+
ctx.Data["SingleRepoAction"] = "issue"
317319
buildIssueOverview(ctx, unit.TypeIssues)
318320
}
319321

templates/user/dashboard/issues.tmpl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,11 @@
100100
</div>
101101
</div>
102102
{{if .SingleRepoLink}}
103-
<a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
103+
{{if eq .SingleRepoAction "issue"}}
104+
<a class="ui green button" href="{{.SingleRepoLink}}/issues/new/choose">{{.locale.Tr "repo.issues.new"}}</a>
105+
{{else if eq .SingleRepoAction "pull"}}
106+
<a class="ui green button" href="{{.SingleRepoLink}}/compare">{{.locale.Tr "repo.pulls.new"}}</a>
107+
{{end}}
104108
{{end}}
105109
</div>
106110
</div>

0 commit comments

Comments
 (0)