Skip to content

Commit 71fe2c2

Browse files
committed
Merge branch 'main' into improve-markdown-editor
2 parents 1f73dda + d0c406a commit 71fe2c2

File tree

5 files changed

+58
-25
lines changed

5 files changed

+58
-25
lines changed

models/migrations/migrations.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,8 @@ var migrations = []Migration{
479479
NewMigration("Improve Action table indices v3", v1_20.ImproveActionTableIndices),
480480
// v250 -> v251
481481
NewMigration("Change Container Metadata", v1_20.ChangeContainerMetadataMultiArch),
482+
// v251 -> v252
483+
NewMigration("Fix incorrect owner team unit access mode", v1_20.FixIncorrectOwnerTeamUnitAccessMode),
482484
}
483485

484486
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v251.go

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import (
7+
"code.gitea.io/gitea/modules/log"
8+
9+
"xorm.io/xorm"
10+
)
11+
12+
func FixIncorrectOwnerTeamUnitAccessMode(x *xorm.Engine) error {
13+
type UnitType int
14+
type AccessMode int
15+
16+
type TeamUnit struct {
17+
ID int64 `xorm:"pk autoincr"`
18+
OrgID int64 `xorm:"INDEX"`
19+
TeamID int64 `xorm:"UNIQUE(s)"`
20+
Type UnitType `xorm:"UNIQUE(s)"`
21+
AccessMode AccessMode
22+
}
23+
24+
const (
25+
// AccessModeOwner owner access
26+
AccessModeOwner = 4
27+
)
28+
29+
sess := x.NewSession()
30+
defer sess.Close()
31+
32+
if err := sess.Begin(); err != nil {
33+
return err
34+
}
35+
36+
count, err := sess.Table("team_unit").
37+
Where("team_id IN (SELECT id FROM team WHERE authorize = ?)", AccessModeOwner).
38+
Update(&TeamUnit{
39+
AccessMode: AccessModeOwner,
40+
})
41+
if err != nil {
42+
return err
43+
}
44+
log.Debug("Updated %d owner team unit access mode to belong to owner instead of none", count)
45+
46+
return sess.Commit()
47+
}

models/organization/org.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,9 +338,10 @@ func CreateOrganization(org *Organization, owner *user_model.User) (err error) {
338338
units := make([]TeamUnit, 0, len(unit.AllRepoUnitTypes))
339339
for _, tp := range unit.AllRepoUnitTypes {
340340
units = append(units, TeamUnit{
341-
OrgID: org.ID,
342-
TeamID: t.ID,
343-
Type: tp,
341+
OrgID: org.ID,
342+
TeamID: t.ID,
343+
Type: tp,
344+
AccessMode: perm.AccessModeOwner,
344345
})
345346
}
346347

routers/web/repo/pull.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,7 @@ func Fork(ctx *context.Context) {
203203
func ForkPost(ctx *context.Context) {
204204
form := web.GetForm(ctx).(*forms.CreateRepoForm)
205205
ctx.Data["Title"] = ctx.Tr("new_fork")
206+
ctx.Data["CanForkRepo"] = true
206207

207208
ctxUser := checkContextUser(ctx, form.UID)
208209
if ctx.Written() {

web_src/css/review.css

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -227,28 +227,10 @@ a.blob-excerpt:hover {
227227
max-height: calc(100vh - 360px);
228228
}
229229

230-
@media (max-width: 767px) {
231-
.review-box-panel .CodeMirror-scroll {
232-
max-width: calc(100vw - 70px);
233-
}
234-
}
235-
236-
@media (min-width: 768px) and (max-width: 991px) {
237-
.review-box-panel .CodeMirror-scroll {
238-
max-width: 700px;
239-
}
240-
}
241-
242-
@media (min-width: 992px) and (max-width: 1200px) {
243-
.review-box-panel .CodeMirror-scroll {
244-
max-width: 800px;
245-
}
246-
}
247-
248-
@media (min-width: 1201px) {
249-
.review-box-panel .CodeMirror-scroll {
250-
max-width: 900px;
251-
}
230+
.review-box-panel .editor-toolbar,
231+
.review-box-panel .CodeMirror-scroll {
232+
width: min(calc(100vw - 2em), 800px);
233+
max-width: none;
252234
}
253235

254236
.review-box-panel .combo-markdown-editor {

0 commit comments

Comments
 (0)