Skip to content

Commit 82ff90e

Browse files
committed
Merge branch 'main' into improve-dropdown-a11y
2 parents c62f03b + ccd3a55 commit 82ff90e

File tree

96 files changed

+1485
-8230
lines changed

Some content is hidden

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

96 files changed

+1485
-8230
lines changed

.drone.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ steps:
726726

727727
# TODO: We should probably build all dependencies into a test image
728728
- name: test-e2e
729-
image: mcr.microsoft.com/playwright:v1.29.2-focal
729+
image: mcr.microsoft.com/playwright:v1.31.2-focal
730730
commands:
731731
- curl -sLO https://go.dev/dl/go1.20.linux-amd64.tar.gz && tar -C /usr/local -xzf go1.20.linux-amd64.tar.gz
732732
- groupadd --gid 1001 gitea && useradd -m --gid 1001 --uid 1001 gitea

.npmrc

+1
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,4 @@ fund=false
33
update-notifier=false
44
package-lock=true
55
save-exact=true
6+
lockfile-version=3

CHANGELOG.md

+350
Large diffs are not rendered by default.

Makefile

+5-5
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,7 @@ fmt:
273273

274274
.PHONY: fmt-check
275275
fmt-check: fmt
276-
@diff=$$(git diff $(GO_SOURCES) templates $(WEB_DIRS)); \
276+
@diff=$$(git diff --color=always $(GO_SOURCES) templates $(WEB_DIRS)); \
277277
if [ -n "$$diff" ]; then \
278278
echo "Please run 'make fmt' and commit the result:"; \
279279
echo "$${diff}"; \
@@ -309,7 +309,7 @@ $(SWAGGER_SPEC): $(GO_SOURCES_NO_BINDATA)
309309

310310
.PHONY: swagger-check
311311
swagger-check: generate-swagger
312-
@diff=$$(git diff '$(SWAGGER_SPEC)'); \
312+
@diff=$$(git diff --color=always '$(SWAGGER_SPEC)'); \
313313
if [ -n "$$diff" ]; then \
314314
echo "Please run 'make generate-swagger' and commit the result:"; \
315315
echo "$${diff}"; \
@@ -414,7 +414,7 @@ vendor: go.mod go.sum
414414

415415
.PHONY: tidy-check
416416
tidy-check: tidy
417-
@diff=$$(git diff go.mod go.sum $(GO_LICENSE_FILE)); \
417+
@diff=$$(git diff --color=always go.mod go.sum $(GO_LICENSE_FILE)); \
418418
if [ -n "$$diff" ]; then \
419419
echo "Please run 'make tidy' and commit the result:"; \
420420
echo "$${diff}"; \
@@ -885,7 +885,7 @@ svg: node-check | node_modules
885885
.PHONY: svg-check
886886
svg-check: svg
887887
@git add $(SVG_DEST_DIR)
888-
@diff=$$(git diff --cached $(SVG_DEST_DIR)); \
888+
@diff=$$(git diff --color=always --cached $(SVG_DEST_DIR)); \
889889
if [ -n "$$diff" ]; then \
890890
echo "Please run 'make svg' and 'git add $(SVG_DEST_DIR)' and commit the result:"; \
891891
echo "$${diff}"; \
@@ -895,7 +895,7 @@ svg-check: svg
895895
.PHONY: lockfile-check
896896
lockfile-check:
897897
npm install --package-lock-only
898-
@diff=$$(git diff package-lock.json); \
898+
@diff=$$(git diff --color=always package-lock.json); \
899899
if [ -n "$$diff" ]; then \
900900
echo "package-lock.json is inconsistent with package.json"; \
901901
echo "Please run 'npm install --package-lock-only' and commit the result:"; \

custom/conf/app.example.ini

+1-1
Original file line numberDiff line numberDiff line change
@@ -1848,7 +1848,7 @@ ROUTER = console
18481848
;ENABLED = true
18491849
;;
18501850
;; Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
1851-
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
1851+
;ALLOWED_TYPES = .csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip
18521852
;;
18531853
;; Max size of each file. Defaults to 4MB
18541854
;MAX_SIZE = 4

docs/content/doc/advanced/config-cheat-sheet.en-us.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -841,7 +841,7 @@ Default templates for project boards:
841841
## Issue and pull request attachments (`attachment`)
842842

843843
- `ENABLED`: **true**: Whether issue and pull request attachments are enabled.
844-
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
844+
- `ALLOWED_TYPES`: **.csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip**: Comma-separated list of allowed file extensions (`.zip`), mime types (`text/plain`) or wildcard type (`image/*`, `audio/*`, `video/*`). Empty value or `*/*` allows all types.
845845
- `MAX_SIZE`: **4**: Maximum size (MB).
846846
- `MAX_FILES`: **5**: Maximum number of attachments that can be uploaded at once.
847847
- `STORAGE_TYPE`: **local**: Storage type for attachments, `local` for local disk or `minio` for s3 compatible object storage service, default is `local` or other name defined with `[storage.xxx]`

models/actions/runner.go

+1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ type ActionRunner struct {
2525
ID int64
2626
UUID string `xorm:"CHAR(36) UNIQUE"`
2727
Name string `xorm:"VARCHAR(255)"`
28+
Version string `xorm:"VARCHAR(64)"`
2829
OwnerID int64 `xorm:"index"` // org level runner, 0 means system
2930
Owner *user_model.User `xorm:"-"`
3031
RepoID int64 `xorm:"index"` // repo level runner, if orgid also is zero, then it's a global

models/migrations/migrations.go

+4
Original file line numberDiff line numberDiff line change
@@ -471,6 +471,10 @@ var migrations = []Migration{
471471
NewMigration("Rename Webhook org_id to owner_id", v1_20.RenameWebhookOrgToOwner),
472472
// v246 -> v247
473473
NewMigration("Add missed column owner_id for project table", v1_20.AddNewColumnForProject),
474+
// v247 -> v248
475+
NewMigration("Fix incorrect project type", v1_20.FixIncorrectProjectType),
476+
// v248 -> v249
477+
NewMigration("Add version column to action_runner table", v1_20.AddVersionToActionRunner),
474478
}
475479

476480
// GetCurrentDBVersion returns the current db version

models/migrations/v1_20/v247.go

+50
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
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+
// FixIncorrectProjectType: set individual project's type from 3(TypeOrganization) to 1(TypeIndividual)
13+
func FixIncorrectProjectType(x *xorm.Engine) error {
14+
type User struct {
15+
ID int64 `xorm:"pk autoincr"`
16+
Type int
17+
}
18+
19+
const (
20+
UserTypeIndividual int = 0
21+
22+
TypeIndividual uint8 = 1
23+
TypeOrganization uint8 = 3
24+
)
25+
26+
type Project struct {
27+
OwnerID int64 `xorm:"INDEX"`
28+
Type uint8
29+
Owner *User `xorm:"extends"`
30+
}
31+
32+
sess := x.NewSession()
33+
defer sess.Close()
34+
35+
if err := sess.Begin(); err != nil {
36+
return err
37+
}
38+
39+
count, err := sess.Table("project").
40+
Where("type = ? AND owner_id IN (SELECT id FROM `user` WHERE type = ?)", TypeOrganization, UserTypeIndividual).
41+
Update(&Project{
42+
Type: TypeIndividual,
43+
})
44+
if err != nil {
45+
return err
46+
}
47+
log.Debug("Updated %d projects to belong to a user instead of an organization", count)
48+
49+
return sess.Commit()
50+
}

models/migrations/v1_20/v248.go

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// Copyright 2023 The Gitea Authors. All rights reserved.
2+
// SPDX-License-Identifier: MIT
3+
4+
package v1_20 //nolint
5+
6+
import "xorm.io/xorm"
7+
8+
func AddVersionToActionRunner(x *xorm.Engine) error {
9+
type ActionRunner struct {
10+
Version string `xorm:"VARCHAR(64)"` // the version of act_runner
11+
}
12+
13+
return x.Sync(new(ActionRunner))
14+
}

models/project/project.go

+12-1
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,21 @@ func (p *Project) Link() string {
144144
return ""
145145
}
146146

147+
func (p *Project) IconName() string {
148+
if p.IsRepositoryProject() {
149+
return "octicon-project"
150+
}
151+
return "octicon-project-symlink"
152+
}
153+
147154
func (p *Project) IsOrganizationProject() bool {
148155
return p.Type == TypeOrganization
149156
}
150157

158+
func (p *Project) IsRepositoryProject() bool {
159+
return p.Type == TypeRepository
160+
}
161+
151162
func init() {
152163
db.RegisterModel(new(Project))
153164
}
@@ -172,7 +183,7 @@ func GetCardConfig() []CardConfig {
172183
// IsTypeValid checks if a project type is valid
173184
func IsTypeValid(p Type) bool {
174185
switch p {
175-
case TypeRepository, TypeOrganization:
186+
case TypeIndividual, TypeRepository, TypeOrganization:
176187
return true
177188
default:
178189
return false

models/project/project_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ func TestIsProjectTypeValid(t *testing.T) {
2020
typ Type
2121
valid bool
2222
}{
23-
{TypeIndividual, false},
23+
{TypeIndividual, true},
2424
{TypeRepository, true},
2525
{TypeOrganization, true},
2626
{UnknownType, false},

modules/packages/npm/creator.go

+1
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ func ParsePackage(r io.Reader) (*Package, error) {
223223
OptionalDependencies: meta.OptionalDependencies,
224224
Bin: meta.Bin,
225225
Readme: meta.Readme,
226+
Repository: meta.Repository,
226227
},
227228
}
228229

modules/packages/npm/creator_test.go

+7
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,10 @@ func TestParsePackage(t *testing.T) {
2626
packageDescription := "Test Description"
2727
data := "H4sIAAAAAAAA/ytITM5OTE/VL4DQelnF+XkMVAYGBgZmJiYK2MRBwNDcSIHB2NTMwNDQzMwAqA7IMDUxA9LUdgg2UFpcklgEdAql5kD8ogCnhwio5lJQUMpLzE1VslJQcihOzi9I1S9JLS7RhSYIJR2QgrLUouLM/DyQGkM9Az1D3YIiqExKanFyUWZBCVQ2BKhVwQVJDKwosbQkI78IJO/tZ+LsbRykxFXLNdA+HwWjYBSMgpENACgAbtAACAAA"
2828
integrity := "sha512-yA4FJsVhetynGfOC1jFf79BuS+jrHbm0fhh+aHzCQkOaOBXKf9oBnC4a6DnLLnEsHQDRLYd00cwj8sCXpC+wIg=="
29+
repository := Repository{
30+
Type: "gitea",
31+
URL: "http://localhost:3000/gitea/test.git",
32+
}
2933

3034
t.Run("InvalidUpload", func(t *testing.T) {
3135
p, err := ParsePackage(bytes.NewReader([]byte{0}))
@@ -242,6 +246,7 @@ func TestParsePackage(t *testing.T) {
242246
Dist: PackageDistribution{
243247
Integrity: integrity,
244248
},
249+
Repository: repository,
245250
},
246251
},
247252
},
@@ -272,5 +277,7 @@ func TestParsePackage(t *testing.T) {
272277
assert.Equal(t, "https://gitea.io/", p.Metadata.ProjectURL)
273278
assert.Contains(t, p.Metadata.Dependencies, "package")
274279
assert.Equal(t, "1.2.0", p.Metadata.Dependencies["package"])
280+
assert.Equal(t, repository.Type, p.Metadata.Repository.Type)
281+
assert.Equal(t, repository.URL, p.Metadata.Repository.URL)
275282
})
276283
}

modules/packages/npm/metadata.go

+1
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,5 @@ type Metadata struct {
2121
OptionalDependencies map[string]string `json:"optional_dependencies,omitempty"`
2222
Bin map[string]string `json:"bin,omitempty"`
2323
Readme string `json:"readme,omitempty"`
24+
Repository Repository `json:"repository,omitempty"`
2425
}

modules/setting/attachment.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ func loadAttachmentFrom(rootCfg ConfigProvider) {
2626

2727
Attachment.Storage = getStorage(rootCfg, "attachments", storageType, sec)
2828

29-
Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip")
29+
Attachment.AllowedTypes = sec.Key("ALLOWED_TYPES").MustString(".csv,.docx,.fodg,.fodp,.fods,.fodt,.gif,.gz,.jpeg,.jpg,.log,.md,.mov,.mp4,.odf,.odg,.odp,.ods,.odt,.patch,.pdf,.png,.pptx,.svg,.tgz,.txt,.webm,.xls,.xlsx,.zip")
3030
Attachment.MaxSize = sec.Key("MAX_SIZE").MustInt64(4)
3131
Attachment.MaxFiles = sec.Key("MAX_FILES").MustInt(5)
3232
Attachment.Enabled = sec.Key("ENABLED").MustBool(true)

options/locale/locale_cs-CZ.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1423,7 +1423,6 @@ issues.context.reference_issue=Odkázat v novém úkolu
14231423
issues.context.edit=Upravit
14241424
issues.context.delete=Smazat
14251425
issues.no_content=Není zde žádný obsah.
1426-
issues.close_issue=Zavřít
14271426
issues.pull_merged_at=`sloučil/a commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> do <b>%[3]s</b> %[4]s`
14281427
issues.manually_pull_merged_at=`sloučil/a commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> do <b>%[3]s</b> ručně %[4]s`
14291428
issues.close_comment_issue=Okomentovat a zavřít

options/locale/locale_de-DE.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1310,7 +1310,6 @@ issues.context.reference_issue=In neuem Issue referenzieren
13101310
issues.context.edit=Bearbeiten
13111311
issues.context.delete=Löschen
13121312
issues.no_content=Hier gibt es bis jetzt noch keinen Inhalt.
1313-
issues.close_issue=Schließen
13141313
issues.pull_merged_at=`mergte den Commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> %[4]s in <b>%[3]s</b>`
13151314
issues.manually_pull_merged_at=`mergte den Commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> %[4]s manuell in <b>%[3]s</b>`
13161315
issues.close_comment_issue=Kommentieren und schließen

options/locale/locale_el-GR.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1331,7 +1331,6 @@ issues.context.reference_issue=Αναφορά σε νέο ζήτημα
13311331
issues.context.edit=Επεξεργασία
13321332
issues.context.delete=Διαγραφή
13331333
issues.no_content=Δεν υπάρχει ακόμα περιεχόμενο.
1334-
issues.close_issue=Κλείσιμο
13351334
issues.pull_merged_at=`συγχώνευσε την υποβολή <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> σε <b>%[3]s</b> %[4]s`
13361335
issues.manually_pull_merged_at=`συγχώνευσε την υποβολή <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> σε <b>%[3]s</b> %[4]s`
13371336
issues.close_comment_issue=Σχόλιο και κλείσιμο

options/locale/locale_en-US.ini

+1
Original file line numberDiff line numberDiff line change
@@ -3356,6 +3356,7 @@ runners.status.unspecified = Unknown
33563356
runners.status.idle = Idle
33573357
runners.status.active = Active
33583358
runners.status.offline = Offline
3359+
runners.version = Version
33593360
33603361
runs.all_workflows = All Workflows
33613362
runs.open_tab = %d Open

options/locale/locale_es-ES.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1330,7 +1330,6 @@ issues.context.reference_issue=Referencia en una nueva incidencia
13301330
issues.context.edit=Editar
13311331
issues.context.delete=Eliminar
13321332
issues.no_content=Aún no existe contenido.
1333-
issues.close_issue=Cerrar
13341333
issues.pull_merged_at=`fusionado commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> en <b>%[3]s</b> %[4]s`
13351334
issues.manually_pull_merged_at=`fusionado manualmente commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> en <b>%[3]s</b> %[4]s`
13361335
issues.close_comment_issue=Comentar y cerrar

options/locale/locale_fa-IR.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1213,7 +1213,6 @@ issues.context.reference_issue=مرجع در شماره جدید
12131213
issues.context.edit=ویرایش
12141214
issues.context.delete=حذف
12151215
issues.no_content=هنوز محتوایی ایجاد نشده.
1216-
issues.close_issue=ببند
12171216
issues.pull_merged_at=`ادغام شده commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> در <b>%[3]s</b> %[4]s`
12181217
issues.manually_pull_merged_at=`ادغام شده commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> در <b>%[3]s</b> بصورت دستی %[4]s`
12191218
issues.close_comment_issue=ثبت دیدگاه و بستن

options/locale/locale_fi-FI.ini

-1
Original file line numberDiff line numberDiff line change
@@ -936,7 +936,6 @@ issues.context.reference_issue=Viittaa uudesa ongelmassa
936936
issues.context.edit=Muokkaa
937937
issues.context.delete=Poista
938938
issues.no_content=Sisältöä ei vielä ole.
939-
issues.close_issue=Sulje
940939
issues.close_comment_issue=Kommentoi ja sulje
941940
issues.reopen_issue=Avaa uudelleen
942941
issues.reopen_comment_issue=Kommentoi ja avaa uudelleen

options/locale/locale_fr-FR.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1195,7 +1195,6 @@ issues.context.reference_issue=Référencer dans un nouveau ticket
11951195
issues.context.edit=Éditer
11961196
issues.context.delete=Supprimer
11971197
issues.no_content=Il n'existe pas encore de contenu.
1198-
issues.close_issue=Fermer
11991198
issues.pull_merged_at=`révision fusionnée <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> dans <b>%[3]s</b> %[4]s`
12001199
issues.manually_pull_merged_at=`révision fusionnée <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> dans <b>%[3]s</b> manuellement %[4]s`
12011200
issues.close_comment_issue=Commenter et Fermer

options/locale/locale_hu-HU.ini

-1
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ issues.context.quote_reply=Válasz idézettel
881881
issues.context.edit=Szerkesztés
882882
issues.context.delete=Törlés
883883
issues.no_content=Még nincs tartalom.
884-
issues.close_issue=Lezárás
885884
issues.close_comment_issue=Hozzászólás és lezárás
886885
issues.reopen_issue=Újranyitás
887886
issues.reopen_comment_issue=Hozzászólás és újranyitás

options/locale/locale_id-ID.ini

-1
Original file line numberDiff line numberDiff line change
@@ -752,7 +752,6 @@ issues.context.quote_reply=Kutip Balasan
752752
issues.context.edit=Sunting
753753
issues.context.delete=Hapus
754754
issues.no_content=Belum ada konten.
755-
issues.close_issue=Tutup
756755
issues.close_comment_issue=Komentar dan Tutup
757756
issues.reopen_issue=Buka kembali
758757
issues.reopen_comment_issue=Komentar dan Buka Kembali

options/locale/locale_is-IS.ini

-1
Original file line numberDiff line numberDiff line change
@@ -823,7 +823,6 @@ issues.num_comments=%d ummæli
823823
issues.commented_at=`gerði ummæli <a href="#%s">%s</a>`
824824
issues.context.edit=Breyta
825825
issues.context.delete=Eyða
826-
issues.close_issue=Loka
827826
issues.manually_pull_merged_at=`sameinaði framlag <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> inni í <b>%[3]s</b> handvirkt %[4]s`
828827
issues.close_comment_issue=Senda ummæli og Loka
829828
issues.reopen_issue=Enduropna

options/locale/locale_it-IT.ini

-1
Original file line numberDiff line numberDiff line change
@@ -1315,7 +1315,6 @@ issues.context.reference_issue=Fai riferimento in un nuovo problema
13151315
issues.context.edit=Modifica
13161316
issues.context.delete=Elimina
13171317
issues.no_content=Non ci sono ancora contenuti.
1318-
issues.close_issue=Chiudi
13191318
issues.pull_merged_at=`merged commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> in <b>%[3]s</b> %[4]s`
13201319
issues.manually_pull_merged_at=`merged commit <a class="ui sha" href="%[1]s"><code>%[2]s</code></a> in <b>%[3]s</b> manualmente %[4]s`
13211320
issues.close_comment_issue=Commenta e Chiudi

0 commit comments

Comments
 (0)