mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-04 10:52:46 +02:00
Merge remote-tracking branch 'upstream/main' into limit-repo-size
Conflicts: models/migrations/migrations.go models/migrations/v1_19/v237.go new file: models/migrations/v1_19/v238.go
This commit is contained in:
+1
-3
@@ -928,10 +928,8 @@ trigger:
|
||||
|
||||
steps:
|
||||
- name: build-docs
|
||||
image: plugins/hugo:latest
|
||||
pull: always
|
||||
image: golang:1.19
|
||||
commands:
|
||||
- apk add --no-cache make bash curl
|
||||
- cd docs
|
||||
- make trans-copy clean build
|
||||
|
||||
|
||||
@@ -4,6 +4,60 @@ This changelog goes through all the changes that have been made in each release
|
||||
without substantial changes to our git log; to see the highlights of what has
|
||||
been added to each release, please refer to the [blog](https://blog.gitea.io).
|
||||
|
||||
## [1.17.4](https://github.com/go-gitea/gitea/releases/tag/1.17.4) - 2022-12-21
|
||||
|
||||
* SECURITY
|
||||
* Do not allow Ghost access to limited visible user/org (#21849) (#21875)
|
||||
* Fix package access for admins and inactive users (#21580) (#21592)
|
||||
* ENHANCEMENTS
|
||||
* Fix button in branch list, avoid unexpected page jump before restore branch actually done (#21562) (#21927)
|
||||
* Fix vertical align of committer avatar rendered by email address (#21884) (#21919)
|
||||
* Fix setting HTTP headers after write (#21833) (#21874)
|
||||
* Ignore line anchor links with leading zeroes (#21728) (#21777)
|
||||
* Enable Monaco automaticLayout (#21516)
|
||||
* BUGFIXES
|
||||
* Do not list active repositories as unadopted (#22034) (#22167)
|
||||
* Correctly handle moved files in apply patch (#22118) (#22136)
|
||||
* Fix condition for is_internal (#22095) (#22131)
|
||||
* Fix permission check on issue/pull lock (#22114)
|
||||
* Fix sorting admin user list by last login (#22081) (#22106)
|
||||
* Workaround for container registry push/pull errors (#21862) (#22069)
|
||||
* Fix issue/PR numbers (#22037) (#22045)
|
||||
* Handle empty author names (#21902) (#22028)
|
||||
* Fix ListBranches to handle empty case (#21921) (#22025)
|
||||
* Fix enabling partial clones on 1.17 (#21809)
|
||||
* Prevent panic in doctor command when running default checks (#21791) (#21808)
|
||||
* Upgrade golang.org/x/crypto (#21792) (#21794)
|
||||
* Init git module before database migration (#21764) (#21766)
|
||||
* Set last login when activating account (#21731) (#21754)
|
||||
* Add HEAD fix to gitea doctor (#21352) (#21751)
|
||||
* Fix UI language switching bug (#21597) (#21748)
|
||||
* Remove semver compatible flag and change pypi to an array of test cases (#21708) (#21729)
|
||||
* Allow local package identifiers for PyPI packages (#21690) (#21726)
|
||||
* Fix repository adoption on Windows (#21646) (#21651)
|
||||
* Sync git hooks when config file path changed (#21619) (#21625)
|
||||
* Added check for disabled Packages (#21540) (#21614)
|
||||
* Fix `Timestamp.IsZero` (#21593) (#21604)
|
||||
* Fix issues count bug (#21600)
|
||||
* Support binary deploy in npm packages (#21589)
|
||||
* Update milestone counters when issue is deleted (#21459) (#21586)
|
||||
* SessionUser protection against nil pointer dereference (#21581)
|
||||
* Case-insensitive NuGet symbol file GUID (#21409) (#21575)
|
||||
* Suppress `ExternalLoginUserNotExist` error (#21504) (#21572)
|
||||
* Prevent Authorization header for presigned LFS urls (#21531) (#21569)
|
||||
* Update binding to fix bugs (#21560)
|
||||
* Fix generating compare link (#21519) (#21530)
|
||||
* Ignore error when retrieving changed PR review files (#21487) (#21524)
|
||||
* Fix incorrect notification commit url (#21479) (#21483)
|
||||
* Display total commit count in hook message (#21400) (#21481)
|
||||
* Enforce grouped NuGet search results (#21442) (#21480)
|
||||
* Return 404 when user is not found on avatar (#21476) (#21477)
|
||||
* Normalize NuGet package version on upload (#22186) (#22201)
|
||||
* MISC
|
||||
* Check for zero time instant in TimeStamp.IsZero() (#22171) (#22173)
|
||||
* Fix warn in database structs sync (#22111)
|
||||
* Allow for resolution of NPM registry paths that match upstream (#21568) (#21723)
|
||||
|
||||
## [1.17.3](https://github.com/go-gitea/gitea/releases/tag/v1.17.3) - 2022-10-15
|
||||
|
||||
* SECURITY
|
||||
|
||||
@@ -190,6 +190,8 @@ To maintain understandable code and avoid circular dependencies it is important
|
||||
- **templates:** Golang templates for generating the html output.
|
||||
- **tests/e2e:** End to end tests
|
||||
- **tests/integration:** Integration tests
|
||||
- **tests/gitea-repositories-meta:** Sample repos used in integration tests. Adding a new repo requires editing `models/fixtures/repositories.yml` and `models/fixtures/repo_unit.yml` to match.
|
||||
- **tests/gitea-lfs-meta:** Sample LFS objects used in integration tests. Adding a new object requires editing `models/fixtures/lfs_meta_object.yml` to match.
|
||||
- **vendor:** External code that Gitea depends on.
|
||||
|
||||
## Documentation
|
||||
|
||||
+6
-4
@@ -2,6 +2,8 @@ THEME := themes/gitea
|
||||
PUBLIC := public
|
||||
ARCHIVE := https://dl.gitea.io/theme/master.tar.gz
|
||||
|
||||
HUGO_PACKAGE := github.com/gohugoio/hugo@v0.82.0
|
||||
|
||||
.PHONY: all
|
||||
all: build
|
||||
|
||||
@@ -11,19 +13,19 @@ clean:
|
||||
|
||||
.PHONY: trans-copy
|
||||
trans-copy:
|
||||
@bash scripts/trans-copy
|
||||
bash scripts/trans-copy.sh
|
||||
|
||||
.PHONY: server
|
||||
server: $(THEME)
|
||||
hugo server
|
||||
go run $(HUGO_PACKAGE) server
|
||||
|
||||
.PHONY: build
|
||||
build: $(THEME)
|
||||
hugo --cleanDestinationDir
|
||||
go run $(HUGO_PACKAGE) --cleanDestinationDir
|
||||
|
||||
.PHONY: build-offline
|
||||
build-offline: $(THEME)
|
||||
hugo --baseURL="/" --cleanDestinationDir
|
||||
go run $(HUGO_PACKAGE) --baseURL="/" --cleanDestinationDir
|
||||
|
||||
.PHONY: update
|
||||
update: $(THEME)
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ params:
|
||||
description: Git with a cup of tea
|
||||
author: The Gitea Authors
|
||||
website: https://docs.gitea.io
|
||||
version: 1.17.3
|
||||
version: 1.17.4
|
||||
minGoVersion: 1.18
|
||||
goVersion: 1.19
|
||||
minNodeVersion: 14
|
||||
|
||||
@@ -26,7 +26,6 @@ for SOURCE in $(find ${ROOT}/content -type f -iname *.en-us.md); do
|
||||
DEST="${SOURCE%.en-us.md}.${LOCALE}.md"
|
||||
|
||||
if [[ ! -f ${DEST} ]]; then
|
||||
echo "Creating fallback for ${DEST#${ROOT}/content/}"
|
||||
cp ${SOURCE} ${DEST}
|
||||
sed -i.bak "s/en\-us/${LOCALE}/g" ${DEST}
|
||||
rm ${DEST}.bak
|
||||
@@ -16,7 +16,7 @@ require (
|
||||
github.com/NYTimes/gziphandler v1.1.1
|
||||
github.com/PuerkitoBio/goquery v1.8.0
|
||||
github.com/alecthomas/chroma/v2 v2.4.0
|
||||
github.com/blevesearch/bleve/v2 v2.3.4
|
||||
github.com/blevesearch/bleve/v2 v2.3.5
|
||||
github.com/buildkite/terminal-to-html/v3 v3.7.0
|
||||
github.com/caddyserver/certmagic v0.17.2
|
||||
github.com/chi-middleware/proxy v1.1.1
|
||||
@@ -129,21 +129,21 @@ require (
|
||||
github.com/beorn7/perks v1.0.1 // indirect
|
||||
github.com/bgentry/speakeasy v0.1.0 // indirect
|
||||
github.com/bits-and-blooms/bitset v1.3.3 // indirect
|
||||
github.com/blevesearch/bleve_index_api v1.0.3 // indirect
|
||||
github.com/blevesearch/geo v0.1.14 // indirect
|
||||
github.com/blevesearch/bleve_index_api v1.0.4 // indirect
|
||||
github.com/blevesearch/geo v0.1.15 // indirect
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3 // indirect
|
||||
github.com/blevesearch/gtreap v0.1.1 // indirect
|
||||
github.com/blevesearch/mmap-go v1.0.4 // indirect
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.2 // indirect
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.3 // indirect
|
||||
github.com/blevesearch/segment v0.9.0 // indirect
|
||||
github.com/blevesearch/snowballstem v0.9.0 // indirect
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.1 // indirect
|
||||
github.com/blevesearch/vellum v1.0.8 // indirect
|
||||
github.com/blevesearch/zapx/v11 v11.3.5 // indirect
|
||||
github.com/blevesearch/zapx/v12 v12.3.5 // indirect
|
||||
github.com/blevesearch/zapx/v13 v13.3.5 // indirect
|
||||
github.com/blevesearch/zapx/v14 v14.3.5 // indirect
|
||||
github.com/blevesearch/zapx/v15 v15.3.5 // indirect
|
||||
github.com/blevesearch/vellum v1.0.9 // indirect
|
||||
github.com/blevesearch/zapx/v11 v11.3.6 // indirect
|
||||
github.com/blevesearch/zapx/v12 v12.3.6 // indirect
|
||||
github.com/blevesearch/zapx/v13 v13.3.6 // indirect
|
||||
github.com/blevesearch/zapx/v14 v14.3.6 // indirect
|
||||
github.com/blevesearch/zapx/v15 v15.3.6 // indirect
|
||||
github.com/boombuler/barcode v1.0.1 // indirect
|
||||
github.com/bradfitz/gomemcache v0.0.0-20190913173617-a41fca850d0b // indirect
|
||||
github.com/census-instrumentation/opencensus-proto v0.3.0 // indirect
|
||||
@@ -305,6 +305,8 @@ replace github.com/shurcooL/vfsgen => github.com/lunny/vfsgen v0.0.0-20220105142
|
||||
|
||||
replace github.com/satori/go.uuid v1.2.0 => github.com/gofrs/uuid v4.2.0+incompatible
|
||||
|
||||
replace github.com/blevesearch/zapx/v15 v15.3.6 => github.com/zeripath/zapx/v15 v15.3.6-alignment-fix
|
||||
|
||||
exclude github.com/gofrs/uuid v3.2.0+incompatible
|
||||
|
||||
exclude github.com/gofrs/uuid v4.0.0+incompatible
|
||||
|
||||
@@ -149,7 +149,6 @@ github.com/PuerkitoBio/purell v1.1.1/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbt
|
||||
github.com/PuerkitoBio/urlesc v0.0.0-20170810143723-de5bf2ad4578/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE=
|
||||
github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo=
|
||||
github.com/RoaringBitmap/roaring v0.7.1/go.mod h1:jdT9ykXwHFNdJbEtxePexlFYH9LXucApeS0/+/g+p1I=
|
||||
github.com/RoaringBitmap/roaring v0.9.4/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA=
|
||||
github.com/RoaringBitmap/roaring v1.2.1 h1:58/LJlg/81wfEHd5L9qsHduznOIhyv4qb1yWcSvVq9A=
|
||||
github.com/RoaringBitmap/roaring v1.2.1/go.mod h1:icnadbWcNyfEHlYdr+tDlOTih1Bf/h+rzPpv4sbomAA=
|
||||
github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo=
|
||||
@@ -226,52 +225,47 @@ github.com/bits-and-blooms/bitset v1.3.3/go.mod h1:gIdJ4wp64HaoK2YrL1Q5/N7Y16edY
|
||||
github.com/bketelsen/crypt v0.0.3-0.20200106085610-5cbc8cc4026c/go.mod h1:MKsuJmJgSg28kpZDP6UIiPt0e0Oz0kqKNGyRaWEPv84=
|
||||
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb/go.mod h1:PkYb9DJNAwrSvRx5DYA+gUcOIgTGVMNkfSCbZM8cWpI=
|
||||
github.com/blevesearch/bleve/v2 v2.0.5/go.mod h1:ZjWibgnbRX33c+vBRgla9QhPb4QOjD6fdVJ+R1Bk8LM=
|
||||
github.com/blevesearch/bleve/v2 v2.3.4 h1:SSb7/cwGzo85LWX1jchIsXM8ZiNNMX3shT5lROM63ew=
|
||||
github.com/blevesearch/bleve/v2 v2.3.4/go.mod h1:Ot0zYum8XQRfPcwhae8bZmNyYubynsoMjVvl1jPqL30=
|
||||
github.com/blevesearch/bleve/v2 v2.3.5 h1:1wuR7eB8Fk9UaCaBUfnQt5V7zIpi4VDok9ExN7Rl+/8=
|
||||
github.com/blevesearch/bleve/v2 v2.3.5/go.mod h1:FneKGHMRrCLrp4X9+iy3wlBqgM2ALucg7bp8jUuAi/s=
|
||||
github.com/blevesearch/bleve_index_api v1.0.0/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4=
|
||||
github.com/blevesearch/bleve_index_api v1.0.3 h1:DDSWaPXOZZJ2BB73ZTWjKxydAugjwywcqU+91AAqcAg=
|
||||
github.com/blevesearch/bleve_index_api v1.0.3/go.mod h1:fiwKS0xLEm+gBRgv5mumf0dhgFr2mDgZah1pqv1c1M4=
|
||||
github.com/blevesearch/geo v0.1.13/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc=
|
||||
github.com/blevesearch/geo v0.1.14 h1:TTDpJN6l9ck/cUYbXSn4aCElNls0Whe44rcQKsB7EfU=
|
||||
github.com/blevesearch/geo v0.1.14/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc=
|
||||
github.com/blevesearch/go-metrics v0.0.0-20201227073835-cf1acfcdf475/go.mod h1:9eJDeqxJ3E7WnLebQUlPD7ZjSce7AnDb9vjGmMCbD0A=
|
||||
github.com/blevesearch/bleve_index_api v1.0.4 h1:mtlzsyJjMIlDngqqB1mq8kPryUMIuEVVbRbJHOWEexU=
|
||||
github.com/blevesearch/bleve_index_api v1.0.4/go.mod h1:YXMDwaXFFXwncRS8UobWs7nvo0DmusriM1nztTlj1ms=
|
||||
github.com/blevesearch/geo v0.1.15 h1:0NybEduqE5fduFRYiUKF0uqybAIFKXYjkBdXKYn7oA4=
|
||||
github.com/blevesearch/geo v0.1.15/go.mod h1:cRIvqCdk3cgMhGeHNNe6yPzb+w56otxbfo1FBJfR2Pc=
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3 h1:GtmsqID0aZdCSNiY8SkuPJ12pD4jI+DdXTAn4YRcHCo=
|
||||
github.com/blevesearch/go-porterstemmer v1.0.3/go.mod h1:angGc5Ht+k2xhJdZi511LtmxuEf0OVpvUUNrwmM1P7M=
|
||||
github.com/blevesearch/goleveldb v1.0.1/go.mod h1:WrU8ltZbIp0wAoig/MHbrPCXSOLpe79nz5lv5nqfYrQ=
|
||||
github.com/blevesearch/gtreap v0.1.1 h1:2JWigFrzDMR+42WGIN/V2p0cUvn4UP3C4Q5nmaZGW8Y=
|
||||
github.com/blevesearch/gtreap v0.1.1/go.mod h1:QaQyDRAT51sotthUWAH4Sj08awFSSWzgYICSZ3w0tYk=
|
||||
github.com/blevesearch/mmap-go v1.0.2/go.mod h1:ol2qBqYaOUsGdm7aRMRrYGgPvnwLe6Y+7LMvAB5IbSA=
|
||||
github.com/blevesearch/mmap-go v1.0.4 h1:OVhDhT5B/M1HNPpYPBKIEJaD0F3Si+CrEKULGCDPWmc=
|
||||
github.com/blevesearch/mmap-go v1.0.4/go.mod h1:EWmEAOmdAS9z/pi/+Toxu99DnsbhG1TIxUoRmJw/pSs=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.0.1/go.mod h1:lq7yK2jQy1yQjtjTfU931aVqz7pYxEudHaDwOt1tXfU=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.2 h1:TAte9VZLWda5WAVlZTTZ+GCzEHqGJb4iB2aiZSA6Iv8=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.2/go.mod h1:rvoQXZGq8drq7vXbNeyiRzdEOwZkjkiYGf1822i6CRA=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.3 h1:2UzpR2dR5DvSZk8tVJkcQ7D5xhoK/UBelYw8ttBHrRQ=
|
||||
github.com/blevesearch/scorch_segment_api/v2 v2.1.3/go.mod h1:eZrfp1y+lUh+DzFjUcTBUSnKGuunyFIpBIvqYVzJfvc=
|
||||
github.com/blevesearch/segment v0.9.0 h1:5lG7yBCx98or7gK2cHMKPukPZ/31Kag7nONpoBt22Ac=
|
||||
github.com/blevesearch/segment v0.9.0/go.mod h1:9PfHYUdQCgHktBgvtUOF4x+pc4/l8rdH0u5spnW85UQ=
|
||||
github.com/blevesearch/snowball v0.6.1/go.mod h1:ZF0IBg5vgpeoUhnMza2v0A/z8m1cWPlwhke08LpNusg=
|
||||
github.com/blevesearch/snowballstem v0.9.0 h1:lMQ189YspGP6sXvZQ4WZ+MLawfV8wOmPoD/iWeNXm8s=
|
||||
github.com/blevesearch/snowballstem v0.9.0/go.mod h1:PivSj3JMc8WuaFkTSRDW2SlrulNWPl4ABg1tC/hlgLs=
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.1 h1:1SYRwyoFLwG3sj0ed89RLtM15amfX2pXlYbFOnF8zNU=
|
||||
github.com/blevesearch/upsidedown_store_api v1.0.1/go.mod h1:MQDVGpHZrpe3Uy26zJBf/a8h0FZY6xJbthIMm8myH2Q=
|
||||
github.com/blevesearch/vellum v1.0.3/go.mod h1:2u5ax02KeDuNWu4/C+hVQMD6uLN4txH1JbtpaDNLJRo=
|
||||
github.com/blevesearch/vellum v1.0.4/go.mod h1:cMhywHI0de50f7Nj42YgvyD6bFJ2WkNRvNBlNMrEVgY=
|
||||
github.com/blevesearch/vellum v1.0.8 h1:iMGh4lfxza4BnWO/UJTMPlI3HsK9YawjPv+TteVa9ck=
|
||||
github.com/blevesearch/vellum v1.0.8/go.mod h1:+cpRi/tqq49xUYSQN2P7A5zNSNrS+MscLeeaZ3J46UA=
|
||||
github.com/blevesearch/vellum v1.0.9 h1:PL+NWVk3dDGPCV0hoDu9XLLJgqU4E5s/dOeEJByQ2uQ=
|
||||
github.com/blevesearch/vellum v1.0.9/go.mod h1:ul1oT0FhSMDIExNjIxHqJoGpVrBpKCdgDQNxfqgJt7k=
|
||||
github.com/blevesearch/zapx/v11 v11.2.0/go.mod h1:gN/a0alGw1FZt/YGTo1G6Z6XpDkeOfujX5exY9sCQQM=
|
||||
github.com/blevesearch/zapx/v11 v11.3.5 h1:eBQWQ7huA+mzm0sAGnZDwgGGli7S45EO+N+ObFWssbI=
|
||||
github.com/blevesearch/zapx/v11 v11.3.5/go.mod h1:5UdIa/HRMdeRCiLQOyFESsnqBGiip7vQmYReA9toevU=
|
||||
github.com/blevesearch/zapx/v11 v11.3.6 h1:50jET4HUJ6eCqGxdhUt+mjybMvEX2MWyqLGtCx3yUgc=
|
||||
github.com/blevesearch/zapx/v11 v11.3.6/go.mod h1:B0CzJRj/pS7hJIroflRtFsa9mRHpMSucSgre0FVINns=
|
||||
github.com/blevesearch/zapx/v12 v12.2.0/go.mod h1:fdjwvCwWWwJW/EYTYGtAp3gBA0geCYGLcVTtJEZnY6A=
|
||||
github.com/blevesearch/zapx/v12 v12.3.5 h1:5pX2hU+R1aZihT7ac1dNWh1n4wqkIM9pZzWp0ANED9s=
|
||||
github.com/blevesearch/zapx/v12 v12.3.5/go.mod h1:ANcthYRZQycpbRut/6ArF5gP5HxQyJqiFcuJCBju/ss=
|
||||
github.com/blevesearch/zapx/v12 v12.3.6 h1:G304NHBLgQeZ+IHK/XRCM0nhHqAts8MEvHI6LhoDNM4=
|
||||
github.com/blevesearch/zapx/v12 v12.3.6/go.mod h1:iYi7tIKpauwU5os5wTxJITixr5Km21Hl365otMwdaP0=
|
||||
github.com/blevesearch/zapx/v13 v13.2.0/go.mod h1:o5rAy/lRS5JpAbITdrOHBS/TugWYbkcYZTz6VfEinAQ=
|
||||
github.com/blevesearch/zapx/v13 v13.3.5 h1:eJ3gbD+Nu8p36/O6lhfdvWQ4pxsGYSuTOBrLLPVWJ74=
|
||||
github.com/blevesearch/zapx/v13 v13.3.5/go.mod h1:FV+dRnScFgKnRDIp08RQL4JhVXt1x2HE3AOzqYa6fjo=
|
||||
github.com/blevesearch/zapx/v13 v13.3.6 h1:vavltQHNdjQezhLZs5nIakf+w/uOa1oqZxB58Jy/3Ig=
|
||||
github.com/blevesearch/zapx/v13 v13.3.6/go.mod h1:X+FsTwCU8qOHtK0d/ArvbOH7qiIgViSQ1GQvcR6LSkI=
|
||||
github.com/blevesearch/zapx/v14 v14.2.0/go.mod h1:GNgZusc1p4ot040cBQMRGEZobvwjCquiEKYh1xLFK9g=
|
||||
github.com/blevesearch/zapx/v14 v14.3.5 h1:hEvVjZaagFCvOUJrlFQ6/Z6Jjy0opM3g7TMEo58TwP4=
|
||||
github.com/blevesearch/zapx/v14 v14.3.5/go.mod h1:954A/eKFb+pg/ncIYWLWCKY+mIjReM9FGTGIO2Wu1cU=
|
||||
github.com/blevesearch/zapx/v14 v14.3.6 h1:b9lub7TvcwUyJxK/cQtnN79abngKxsI7zMZnICU0WhE=
|
||||
github.com/blevesearch/zapx/v14 v14.3.6/go.mod h1:9X8W3XoikagU0rwcTqwZho7p9cC7m7zhPZO94S4wUvM=
|
||||
github.com/blevesearch/zapx/v15 v15.2.0/go.mod h1:MmQceLpWfME4n1WrBFIwplhWmaQbQqLQARpaKUEOs/A=
|
||||
github.com/blevesearch/zapx/v15 v15.3.5 h1:NVD0qq8vRk66ImJn1KloXT5ckqPDUZT7VbVJs9jKlac=
|
||||
github.com/blevesearch/zapx/v15 v15.3.5/go.mod h1:QMUh2hXCaYIWFKPYGavq/Iga2zbHWZ9DZAa9uFbWyvg=
|
||||
github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
github.com/boombuler/barcode v1.0.1 h1:NDBbPmhS+EqABEs5Kg3n/5ZNjy73Pz7SIV+KCeqyXcs=
|
||||
github.com/boombuler/barcode v1.0.1/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8=
|
||||
@@ -362,7 +356,6 @@ github.com/couchbase/goutils v0.0.0-20201030094643-5e82bb967e67/go.mod h1:BQwMFl
|
||||
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401 h1:4KDlx3vjalrHD/EfsjCpV91HNX3JPaIqRtt83zZ7x+Y=
|
||||
github.com/couchbase/goutils v0.0.0-20210118111533-e33d3ffb5401/go.mod h1:BQwMFlJzDjFDG3DJUdU0KORxn88UlsOULuxLExMh3Hs=
|
||||
github.com/couchbase/moss v0.1.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs=
|
||||
github.com/couchbase/moss v0.2.0/go.mod h1:9MaHIaRuy9pvLPUJxB8sh8OrLfyDczECVL37grCIubs=
|
||||
github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU=
|
||||
@@ -1495,6 +1488,8 @@ github.com/yuin/goldmark-highlighting/v2 v2.0.0-20220924101305-151362477c87/go.m
|
||||
github.com/yuin/goldmark-meta v1.1.0 h1:pWw+JLHGZe8Rk0EGsMVssiNb/AaPMHfSRszZeUeiOUc=
|
||||
github.com/yuin/goldmark-meta v1.1.0/go.mod h1:U4spWENafuA7Zyg+Lj5RqK/MF+ovMYtBvXi1lBb2VP0=
|
||||
github.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=
|
||||
github.com/zeripath/zapx/v15 v15.3.6-alignment-fix h1:fKZ9OxEDoJKgM0KBXRbSb5IgKUEXis6C3zEIiMtzzQ0=
|
||||
github.com/zeripath/zapx/v15 v15.3.6-alignment-fix/go.mod h1:5DbhhDTGtuQSns1tS2aJxJLPc91boXCvjOMeCLD1saM=
|
||||
github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0=
|
||||
github.com/zmap/rc2 v0.0.0-20131011165748-24b9757f5521/go.mod h1:3YZ9o3WnatTIZhuOtot4IcUfzoKVjUHqu6WALIyI0nE=
|
||||
github.com/zmap/zcertificate v0.0.0-20180516150559-0e3d58b1bac4/go.mod h1:5iU54tB79AMBcySS0R2XIyZBAVmeHranShAFELYx7is=
|
||||
|
||||
@@ -12,6 +12,8 @@ import (
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
|
||||
_ "code.gitea.io/gitea/cmd" // for TestPrimaryKeys
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
@@ -51,3 +53,34 @@ func TestDeleteOrphanedObjects(t *testing.T) {
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, countBefore, countAfter)
|
||||
}
|
||||
|
||||
func TestPrimaryKeys(t *testing.T) {
|
||||
// Some dbs require that all tables have primary keys, see
|
||||
// https://github.com/go-gitea/gitea/issues/21086
|
||||
// https://github.com/go-gitea/gitea/issues/16802
|
||||
// To avoid creating tables without primary key again, this test will check them.
|
||||
// Import "code.gitea.io/gitea/cmd" to make sure each db.RegisterModel in init functions has been called.
|
||||
|
||||
beans, err := db.NamesToBean()
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
whitelist := map[string]string{
|
||||
"the_table_name_to_skip_checking": "Write a note here to explain why",
|
||||
}
|
||||
|
||||
for _, bean := range beans {
|
||||
table, err := db.TableInfo(bean)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
if why, ok := whitelist[table.Name]; ok {
|
||||
t.Logf("ignore %q because %q", table.Name, why)
|
||||
continue
|
||||
}
|
||||
if len(table.PrimaryKeys) == 0 {
|
||||
t.Errorf("table %q has no primary key", table.Name)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ func TestIterate(t *testing.T) {
|
||||
return nil
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, 80, repoCnt)
|
||||
assert.EqualValues(t, 81, repoCnt)
|
||||
|
||||
err = db.Iterate(db.DefaultContext, nil, func(ctx context.Context, repoUnit *repo_model.RepoUnit) error {
|
||||
reopUnit2 := repo_model.RepoUnit{ID: repoUnit.ID}
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
[] # empty
|
||||
@@ -0,0 +1,32 @@
|
||||
# These are the LFS objects in user2/lfs.git
|
||||
-
|
||||
|
||||
id: 1
|
||||
oid: 0b8d8b5f15046343fd32f451df93acc2bdd9e6373be478b968e4cad6b6647351
|
||||
size: 107
|
||||
repository_id: 54
|
||||
created_unix: 1671607299
|
||||
|
||||
-
|
||||
|
||||
id: 2
|
||||
oid: 2eccdb43825d2a49d99d542daa20075cff1d97d9d2349a8977efe9c03661737c
|
||||
size: 107
|
||||
repository_id: 54
|
||||
created_unix: 1671607299
|
||||
|
||||
-
|
||||
|
||||
id: 3
|
||||
oid: 7b6b2c88dba9f760a1a58469b67fee2b698ef7e9399c4ca4f34a14ccbe39f623
|
||||
size: 27
|
||||
repository_id: 54
|
||||
created_unix: 1671607299
|
||||
|
||||
-
|
||||
|
||||
id: 4
|
||||
oid: 9d172e5c64b4f0024b9901ec6afe9ea052f3c9b6ff9f4b07956d8c48c86fca82
|
||||
size: 25
|
||||
repository_id: 54
|
||||
created_unix: 1671607299
|
||||
@@ -550,3 +550,9 @@
|
||||
repo_id: 53
|
||||
type: 1
|
||||
created_unix: 946684810
|
||||
|
||||
-
|
||||
id: 81
|
||||
repo_id: 54
|
||||
type: 1
|
||||
created_unix: 946684810
|
||||
|
||||
@@ -1585,3 +1585,14 @@
|
||||
size: 0
|
||||
is_fsck_enabled: true
|
||||
close_issues_via_commit_in_any_branch: false
|
||||
|
||||
-
|
||||
id: 54
|
||||
owner_id: 2
|
||||
owner_name: user2
|
||||
lower_name: lfs
|
||||
name: lfs
|
||||
is_empty: false
|
||||
is_archived: false
|
||||
is_private: true
|
||||
status: 0
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
num_followers: 2
|
||||
num_following: 1
|
||||
num_stars: 2
|
||||
num_repos: 9
|
||||
num_repos: 10
|
||||
num_teams: 0
|
||||
num_members: 0
|
||||
visibility: 0
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
// Copyright 2022 Gitea. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package foreignreference
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
)
|
||||
|
||||
// ErrLocalIndexNotExist represents a "LocalIndexNotExist" kind of error.
|
||||
type ErrLocalIndexNotExist struct {
|
||||
RepoID int64
|
||||
ForeignIndex int64
|
||||
Type string
|
||||
}
|
||||
|
||||
// ErrLocalIndexNotExist checks if an error is a ErrLocalIndexNotExist.
|
||||
func IsErrLocalIndexNotExist(err error) bool {
|
||||
_, ok := err.(ErrLocalIndexNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrLocalIndexNotExist) Error() string {
|
||||
return fmt.Sprintf("repository %d has no LocalIndex for ForeignIndex %d of type %s", err.RepoID, err.ForeignIndex, err.Type)
|
||||
}
|
||||
|
||||
func (err ErrLocalIndexNotExist) Unwrap() error {
|
||||
return util.ErrNotExist
|
||||
}
|
||||
|
||||
// ErrForeignIndexNotExist represents a "ForeignIndexNotExist" kind of error.
|
||||
type ErrForeignIndexNotExist struct {
|
||||
RepoID int64
|
||||
LocalIndex int64
|
||||
Type string
|
||||
}
|
||||
|
||||
// ErrForeignIndexNotExist checks if an error is a ErrForeignIndexNotExist.
|
||||
func IsErrForeignIndexNotExist(err error) bool {
|
||||
_, ok := err.(ErrForeignIndexNotExist)
|
||||
return ok
|
||||
}
|
||||
|
||||
func (err ErrForeignIndexNotExist) Error() string {
|
||||
return fmt.Sprintf("repository %d has no ForeignIndex for LocalIndex %d of type %s", err.RepoID, err.LocalIndex, err.Type)
|
||||
}
|
||||
|
||||
func (err ErrForeignIndexNotExist) Unwrap() error {
|
||||
return util.ErrNotExist
|
||||
}
|
||||
@@ -1,31 +0,0 @@
|
||||
// Copyright 2022 Gitea. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package foreignreference
|
||||
|
||||
import (
|
||||
"code.gitea.io/gitea/models/db"
|
||||
)
|
||||
|
||||
// Type* are valid values for the Type field of ForeignReference
|
||||
const (
|
||||
TypeIssue = "issue"
|
||||
TypePullRequest = "pull_request"
|
||||
TypeComment = "comment"
|
||||
TypeReview = "review"
|
||||
TypeReviewComment = "review_comment"
|
||||
TypeRelease = "release"
|
||||
)
|
||||
|
||||
// ForeignReference represents external references
|
||||
type ForeignReference struct {
|
||||
// RepoID is the first column in all indices. now we only need 2 indices: (repo, local) and (repo, foreign, type)
|
||||
RepoID int64 `xorm:"UNIQUE(repo_foreign_type) INDEX(repo_local)" `
|
||||
LocalIndex int64 `xorm:"INDEX(repo_local)"` // the resource key inside Gitea, it can be IssueIndex, or some model ID.
|
||||
ForeignIndex string `xorm:"INDEX UNIQUE(repo_foreign_type)"`
|
||||
Type string `xorm:"VARCHAR(16) INDEX UNIQUE(repo_foreign_type)"`
|
||||
}
|
||||
|
||||
func init() {
|
||||
db.RegisterModel(new(ForeignReference))
|
||||
}
|
||||
+5
-55
@@ -9,11 +9,9 @@ import (
|
||||
"fmt"
|
||||
"regexp"
|
||||
"sort"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/foreignreference"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
"code.gitea.io/gitea/models/perm"
|
||||
access_model "code.gitea.io/gitea/models/perm/access"
|
||||
@@ -136,12 +134,11 @@ type Issue struct {
|
||||
UpdatedUnix timeutil.TimeStamp `xorm:"INDEX updated"`
|
||||
ClosedUnix timeutil.TimeStamp `xorm:"INDEX"`
|
||||
|
||||
Attachments []*repo_model.Attachment `xorm:"-"`
|
||||
Comments []*Comment `xorm:"-"`
|
||||
Reactions ReactionList `xorm:"-"`
|
||||
TotalTrackedTime int64 `xorm:"-"`
|
||||
Assignees []*user_model.User `xorm:"-"`
|
||||
ForeignReference *foreignreference.ForeignReference `xorm:"-"`
|
||||
Attachments []*repo_model.Attachment `xorm:"-"`
|
||||
Comments []*Comment `xorm:"-"`
|
||||
Reactions ReactionList `xorm:"-"`
|
||||
TotalTrackedTime int64 `xorm:"-"`
|
||||
Assignees []*user_model.User `xorm:"-"`
|
||||
|
||||
// IsLocked limits commenting abilities to users on an issue
|
||||
// with write access
|
||||
@@ -321,29 +318,6 @@ func (issue *Issue) loadReactions(ctx context.Context) (err error) {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (issue *Issue) loadForeignReference(ctx context.Context) (err error) {
|
||||
if issue.ForeignReference != nil {
|
||||
return nil
|
||||
}
|
||||
reference := &foreignreference.ForeignReference{
|
||||
RepoID: issue.RepoID,
|
||||
LocalIndex: issue.Index,
|
||||
Type: foreignreference.TypeIssue,
|
||||
}
|
||||
has, err := db.GetEngine(ctx).Get(reference)
|
||||
if err != nil {
|
||||
return err
|
||||
} else if !has {
|
||||
return foreignreference.ErrForeignIndexNotExist{
|
||||
RepoID: issue.RepoID,
|
||||
LocalIndex: issue.Index,
|
||||
Type: foreignreference.TypeIssue,
|
||||
}
|
||||
}
|
||||
issue.ForeignReference = reference
|
||||
return nil
|
||||
}
|
||||
|
||||
// LoadMilestone load milestone of this issue.
|
||||
func (issue *Issue) LoadMilestone(ctx context.Context) (err error) {
|
||||
if (issue.Milestone == nil || issue.Milestone.ID != issue.MilestoneID) && issue.MilestoneID > 0 {
|
||||
@@ -406,10 +380,6 @@ func (issue *Issue) LoadAttributes(ctx context.Context) (err error) {
|
||||
}
|
||||
}
|
||||
|
||||
if err = issue.loadForeignReference(ctx); err != nil && !foreignreference.IsErrForeignIndexNotExist(err) {
|
||||
return err
|
||||
}
|
||||
|
||||
return issue.loadReactions(ctx)
|
||||
}
|
||||
|
||||
@@ -1097,26 +1067,6 @@ func GetIssueByIndex(repoID, index int64) (*Issue, error) {
|
||||
return issue, nil
|
||||
}
|
||||
|
||||
// GetIssueByForeignIndex returns raw issue by foreign ID
|
||||
func GetIssueByForeignIndex(ctx context.Context, repoID, foreignIndex int64) (*Issue, error) {
|
||||
reference := &foreignreference.ForeignReference{
|
||||
RepoID: repoID,
|
||||
ForeignIndex: strconv.FormatInt(foreignIndex, 10),
|
||||
Type: foreignreference.TypeIssue,
|
||||
}
|
||||
has, err := db.GetEngine(ctx).Get(reference)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
} else if !has {
|
||||
return nil, foreignreference.ErrLocalIndexNotExist{
|
||||
RepoID: repoID,
|
||||
ForeignIndex: foreignIndex,
|
||||
Type: foreignreference.TypeIssue,
|
||||
}
|
||||
}
|
||||
return GetIssueByIndex(repoID, reference.LocalIndex)
|
||||
}
|
||||
|
||||
// GetIssueWithAttrsByIndex returns issue by index in a repository.
|
||||
func GetIssueWithAttrsByIndex(repoID, index int64) (*Issue, error) {
|
||||
issue, err := GetIssueByIndex(repoID, index)
|
||||
|
||||
@@ -7,13 +7,11 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"sort"
|
||||
"strconv"
|
||||
"sync"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/foreignreference"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
"code.gitea.io/gitea/models/organization"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
@@ -501,38 +499,6 @@ func TestCorrectIssueStats(t *testing.T) {
|
||||
assert.EqualValues(t, issueStats.OpenCount, issueAmount)
|
||||
}
|
||||
|
||||
func TestIssueForeignReference(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
issue := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{ID: 4})
|
||||
assert.NotEqualValues(t, issue.Index, issue.ID) // make sure they are different to avoid false positive
|
||||
|
||||
// it is fine for an issue to not have a foreign reference
|
||||
err := issue.LoadAttributes(db.DefaultContext)
|
||||
assert.NoError(t, err)
|
||||
assert.Nil(t, issue.ForeignReference)
|
||||
|
||||
var foreignIndex int64 = 12345
|
||||
_, err = issues_model.GetIssueByForeignIndex(context.Background(), issue.RepoID, foreignIndex)
|
||||
assert.True(t, foreignreference.IsErrLocalIndexNotExist(err))
|
||||
|
||||
err = db.Insert(db.DefaultContext, &foreignreference.ForeignReference{
|
||||
LocalIndex: issue.Index,
|
||||
ForeignIndex: strconv.FormatInt(foreignIndex, 10),
|
||||
RepoID: issue.RepoID,
|
||||
Type: foreignreference.TypeIssue,
|
||||
})
|
||||
assert.NoError(t, err)
|
||||
|
||||
err = issue.LoadAttributes(db.DefaultContext)
|
||||
assert.NoError(t, err)
|
||||
|
||||
assert.EqualValues(t, issue.ForeignReference.ForeignIndex, strconv.FormatInt(foreignIndex, 10))
|
||||
|
||||
found, err := issues_model.GetIssueByForeignIndex(context.Background(), issue.RepoID, foreignIndex)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, found.Index, issue.Index)
|
||||
}
|
||||
|
||||
func TestMilestoneList_LoadTotalTrackedTimes(t *testing.T) {
|
||||
assert.NoError(t, unittest.PrepareTestDatabase())
|
||||
miles := issues_model.MilestoneList{
|
||||
|
||||
@@ -83,13 +83,6 @@ func insertIssue(ctx context.Context, issue *issues_model.Issue) error {
|
||||
}
|
||||
}
|
||||
|
||||
if issue.ForeignReference != nil {
|
||||
issue.ForeignReference.LocalIndex = issue.Index
|
||||
if _, err := sess.Insert(issue.ForeignReference); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
@@ -4,11 +4,9 @@
|
||||
package models
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/foreignreference"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
@@ -48,7 +46,6 @@ func assertCreateIssues(t *testing.T, isPull bool) {
|
||||
UserID: owner.ID,
|
||||
}
|
||||
|
||||
foreignIndex := int64(12345)
|
||||
title := "issuetitle1"
|
||||
is := &issues_model.Issue{
|
||||
RepoID: repo.ID,
|
||||
@@ -62,20 +59,11 @@ func assertCreateIssues(t *testing.T, isPull bool) {
|
||||
IsClosed: true,
|
||||
Labels: []*issues_model.Label{label},
|
||||
Reactions: []*issues_model.Reaction{reaction},
|
||||
ForeignReference: &foreignreference.ForeignReference{
|
||||
ForeignIndex: strconv.FormatInt(foreignIndex, 10),
|
||||
RepoID: repo.ID,
|
||||
Type: foreignreference.TypeIssue,
|
||||
},
|
||||
}
|
||||
err := InsertIssues(is)
|
||||
assert.NoError(t, err)
|
||||
|
||||
i := unittest.AssertExistsAndLoadBean(t, &issues_model.Issue{Title: title})
|
||||
assert.Nil(t, i.ForeignReference)
|
||||
err = i.LoadAttributes(db.DefaultContext)
|
||||
assert.NoError(t, err)
|
||||
assert.EqualValues(t, strconv.FormatInt(foreignIndex, 10), i.ForeignReference.ForeignIndex)
|
||||
unittest.AssertExistsAndLoadBean(t, &issues_model.Reaction{Type: "heart", UserID: owner.ID, IssueID: i.ID})
|
||||
}
|
||||
|
||||
|
||||
@@ -444,6 +444,8 @@ var migrations = []Migration{
|
||||
NewMigration("Add index for access_token", v1_19.AddIndexForAccessToken),
|
||||
// v236 -> v237
|
||||
NewMigration("Create secrets table", v1_19.CreateSecretsTable),
|
||||
// v237 -> v238
|
||||
NewMigration("Drop ForeignReference table", v1_19.DropForeignReferenceTable),
|
||||
// to modify later
|
||||
NewMigration("add size limit on repository", v1_19.AddSizeLimitOnRepo),
|
||||
}
|
||||
|
||||
@@ -1,17 +1,15 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_19 // nolint
|
||||
package v1_19 //nolint
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddSizeLimitOnRepo(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
SizeLimit int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(Repository))
|
||||
func DropForeignReferenceTable(x *xorm.Engine) error {
|
||||
// Drop the table introduced in `v211`, it's considered badly designed and doesn't look like to be used.
|
||||
// See: https://github.com/go-gitea/gitea/issues/21086#issuecomment-1318217453
|
||||
type ForeignReference struct{}
|
||||
return x.DropTables(new(ForeignReference))
|
||||
}
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package v1_19 // nolint
|
||||
|
||||
import (
|
||||
"xorm.io/xorm"
|
||||
)
|
||||
|
||||
func AddSizeLimitOnRepo(x *xorm.Engine) error {
|
||||
type Repository struct {
|
||||
ID int64 `xorm:"pk autoincr"`
|
||||
SizeLimit int64 `xorm:"NOT NULL DEFAULT 0"`
|
||||
}
|
||||
|
||||
return x.Sync2(new(Repository))
|
||||
}
|
||||
@@ -1,3 +1,6 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
|
||||
# Godot-specific ignores
|
||||
.import/
|
||||
export.cfg
|
||||
@@ -9,3 +12,4 @@ export_presets.cfg
|
||||
# Mono-specific ignores
|
||||
.mono/
|
||||
data_*/
|
||||
mono_crash.*.json
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
(c) Copyright 1989-1992, Bitstream Inc., Cambridge, MA.
|
||||
|
||||
You are hereby granted permission under all Bitstream propriety rights
|
||||
to use, copy, modify, sublicense, sell, and redistribute the 4 Bitstream
|
||||
Charter (r) Type 1 outline fonts and the 4 Courier Type 1 outline fonts for
|
||||
any purpose and without restriction; provided, that this notice is left
|
||||
intact on all copies of such fonts and that Bitstream's trademark is acknowledged
|
||||
as shown below on all unmodified copies of the 4 Charter Type 1 fonts.
|
||||
BITSTREAM CHARTER is a registered trademark of Bitstream Inc.
|
||||
@@ -0,0 +1,5 @@
|
||||
LICENSE
|
||||
|
||||
This code repository predates the concept of Open Source, and predates most licenses along such lines. As such, the official license truly is:
|
||||
|
||||
EULA: The Graphics Gems code is copyright-protected. In other words, you cannot claim the text of the code as your own and resell it. Using the code is permitted in any program, product, or library, non-commercial or commercial. Giving credit is not required, though is a nice gesture. The code comes as-is, and if there are any flaws or problems with any Gems code, nobody involved with Gems - authors, editors, publishers, or webmasters - are to be held responsible. Basically, don't be a jerk, and remember that anything free comes with no guarantee.
|
||||
@@ -0,0 +1,35 @@
|
||||
The authors make NO WARRANTY or representation, either express or
|
||||
implied, with respect to this software, its quality, accuracy,
|
||||
merchantability, or fitness for a particular purpose. This software is
|
||||
provided "AS IS", and you, its user, assume the entire risk as to its
|
||||
quality and accuracy.
|
||||
|
||||
This software is copyright (C) 1991, 1992, Thomas G. Lane. All Rights
|
||||
Reserved except as specified below.
|
||||
|
||||
Permission is hereby granted to use, copy, modify, and distribute this
|
||||
software (or portions thereof) for any purpose, without fee, subject to
|
||||
these conditions:
|
||||
|
||||
(1) If any part of the source code for this software
|
||||
is distributed, then this README file must be included, with this
|
||||
copyright and no-warranty notice unaltered; and any additions,
|
||||
deletions, or changes to the original files must be clearly indicated
|
||||
in accompanying documentation.
|
||||
|
||||
(2) If only executable code is
|
||||
distributed, then the accompanying documentation must state that "this
|
||||
software is based in part on the work of the Independent JPEG Group".
|
||||
|
||||
(3) Permission for use of this software is granted only if the user
|
||||
accepts full responsibility for any undesirable consequences; the
|
||||
authors accept NO LIABILITY for damages of any kind.
|
||||
|
||||
Permission is NOT granted for the use of any IJG author's name or
|
||||
company name in advertising or publicity relating to this software or
|
||||
products derived from it. This software may be referred to only as
|
||||
"the Independent JPEG Group's software".
|
||||
|
||||
We specifically permit and encourage the use of this software as the
|
||||
basis of commercial products, provided that all warranty or liability
|
||||
claims are assumed by the product vendor.
|
||||
@@ -0,0 +1,28 @@
|
||||
Copyright (c) 2003-2005 Tom Wu
|
||||
All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the
|
||||
"Software"), to deal in the Software without restriction, including
|
||||
without limitation the rights to use, copy, modify, merge, publish,
|
||||
distribute, sublicense, and/or sell copies of the Software, and to
|
||||
permit persons to whom the Software is furnished to do so, subject to
|
||||
the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be
|
||||
included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS-IS" AND WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS, IMPLIED OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY
|
||||
WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
IN NO EVENT SHALL TOM WU BE LIABLE FOR ANY SPECIAL, INCIDENTAL,
|
||||
INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES WHATSOEVER
|
||||
RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR NOT ADVISED OF
|
||||
THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF LIABILITY, ARISING OUT
|
||||
OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
In addition, the following condition applies:
|
||||
|
||||
All redistributions must retain an intact copy of this copyright notice
|
||||
and disclaimer.
|
||||
@@ -0,0 +1,2 @@
|
||||
Copyright (C) 1996-2010 David Muir Sharnoff. Copyright (C) 2011 Google, Inc.
|
||||
License hereby granted for anyone to use, modify or redistribute this module at their own risk. Please feed useful changes back to cpan@dave.sharnoff.org.
|
||||
@@ -0,0 +1,8 @@
|
||||
Copyright (C) 1996-2002,2005,2006 David Muir Sharnoff.
|
||||
Copyright (C) 2005 Aristotle Pagaltzis
|
||||
Copyright (C) 2012-2013 Google, Inc.
|
||||
|
||||
This module may be modified, used, copied, and redistributed at your own risk.
|
||||
Although allowed by the preceding license, please do not publicly
|
||||
redistribute modified versions of this code with the name "Text::Tabs"
|
||||
unless it passes the unmodified Text::Tabs test suite.
|
||||
@@ -2282,6 +2282,8 @@ release.downloads = Downloads
|
||||
release.download_count = Downloads: %s
|
||||
release.add_tag_msg = Use the title and content of release as tag message.
|
||||
release.add_tag = Create Tag Only
|
||||
release.releases_for = Releases for %s
|
||||
release.tags_for = Tags for %s
|
||||
|
||||
branch.name = Branch Name
|
||||
branch.search = Search branches
|
||||
|
||||
@@ -490,6 +490,11 @@ func EditPullRequest(ctx *context.APIContext) {
|
||||
issue := pr.Issue
|
||||
issue.Repo = ctx.Repo.Repository
|
||||
|
||||
if err := issue.LoadAttributes(ctx); err != nil {
|
||||
ctx.Error(http.StatusInternalServerError, "LoadAttributes", err)
|
||||
return
|
||||
}
|
||||
|
||||
if !issue.IsPoster(ctx.Doer.ID) && !ctx.Repo.CanWrite(unit.TypePullRequests) {
|
||||
ctx.Status(http.StatusForbidden)
|
||||
return
|
||||
|
||||
@@ -12,6 +12,7 @@ import (
|
||||
"strings"
|
||||
|
||||
activities_model "code.gitea.io/gitea/models/activities"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
@@ -268,3 +269,46 @@ func GetFeedType(name string, req *http.Request) (bool, string, string) {
|
||||
|
||||
return false, name, ""
|
||||
}
|
||||
|
||||
// feedActionsToFeedItems convert gitea's Repo's Releases to feeds Item
|
||||
func releasesToFeedItems(ctx *context.Context, releases []*repo_model.Release, isReleasesOnly bool) (items []*feeds.Item, err error) {
|
||||
for _, rel := range releases {
|
||||
err := rel.LoadAttributes(ctx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var title, content string
|
||||
|
||||
if rel.IsTag {
|
||||
title = rel.TagName
|
||||
} else {
|
||||
title = rel.Title
|
||||
}
|
||||
|
||||
link := &feeds.Link{Href: rel.HTMLURL()}
|
||||
content, err = markdown.RenderString(&markup.RenderContext{
|
||||
Ctx: ctx,
|
||||
URLPrefix: rel.Repo.Link(),
|
||||
Metas: rel.Repo.ComposeMetas(),
|
||||
}, rel.Note)
|
||||
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
items = append(items, &feeds.Item{
|
||||
Title: title,
|
||||
Link: link,
|
||||
Created: rel.CreatedUnix.AsTime(),
|
||||
Author: &feeds.Author{
|
||||
Name: rel.Publisher.DisplayName(),
|
||||
Email: rel.Publisher.GetEmail(),
|
||||
},
|
||||
Id: fmt.Sprintf("%v: %v", strconv.FormatInt(rel.ID, 10), link.Href),
|
||||
Content: content,
|
||||
})
|
||||
}
|
||||
|
||||
return items, err
|
||||
}
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package feed
|
||||
|
||||
import (
|
||||
"time"
|
||||
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
|
||||
"github.com/gorilla/feeds"
|
||||
)
|
||||
|
||||
// shows tags and/or releases on the repo as RSS / Atom feed
|
||||
func ShowReleaseFeed(ctx *context.Context, repo *repo_model.Repository, isReleasesOnly bool, formatType string) {
|
||||
releases, err := repo_model.GetReleasesByRepoID(ctx, ctx.Repo.Repository.ID, repo_model.FindReleasesOptions{
|
||||
IncludeTags: !isReleasesOnly,
|
||||
})
|
||||
if err != nil {
|
||||
ctx.ServerError("GetReleasesByRepoID", err)
|
||||
return
|
||||
}
|
||||
|
||||
var title string
|
||||
var link *feeds.Link
|
||||
|
||||
if isReleasesOnly {
|
||||
title = ctx.Tr("repo.release.releases_for", repo.FullName())
|
||||
link = &feeds.Link{Href: repo.HTMLURL() + "/release"}
|
||||
} else {
|
||||
title = ctx.Tr("repo.release.tags_for", repo.FullName())
|
||||
link = &feeds.Link{Href: repo.HTMLURL() + "/tags"}
|
||||
}
|
||||
|
||||
feed := &feeds.Feed{
|
||||
Title: title,
|
||||
Link: link,
|
||||
Description: repo.Description,
|
||||
Created: time.Now(),
|
||||
}
|
||||
|
||||
feed.Items, err = releasesToFeedItems(ctx, releases, isReleasesOnly)
|
||||
if err != nil {
|
||||
ctx.ServerError("releasesToFeedItems", err)
|
||||
return
|
||||
}
|
||||
|
||||
writeFeed(ctx, feed, formatType)
|
||||
}
|
||||
@@ -23,6 +23,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/upload"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/web/feed"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
releaseservice "code.gitea.io/gitea/services/release"
|
||||
)
|
||||
@@ -199,6 +200,30 @@ func releasesOrTags(ctx *context.Context, isTagList bool) {
|
||||
ctx.HTML(http.StatusOK, tplReleases)
|
||||
}
|
||||
|
||||
// ReleasesFeedRSS get feeds for releases in RSS format
|
||||
func ReleasesFeedRSS(ctx *context.Context) {
|
||||
releasesOrTagsFeed(ctx, true, "rss")
|
||||
}
|
||||
|
||||
// TagsListFeedRSS get feeds for tags in RSS format
|
||||
func TagsListFeedRSS(ctx *context.Context) {
|
||||
releasesOrTagsFeed(ctx, false, "rss")
|
||||
}
|
||||
|
||||
// ReleasesFeedAtom get feeds for releases in Atom format
|
||||
func ReleasesFeedAtom(ctx *context.Context) {
|
||||
releasesOrTagsFeed(ctx, true, "atom")
|
||||
}
|
||||
|
||||
// TagsListFeedAtom get feeds for tags in RSS format
|
||||
func TagsListFeedAtom(ctx *context.Context) {
|
||||
releasesOrTagsFeed(ctx, false, "atom")
|
||||
}
|
||||
|
||||
func releasesOrTagsFeed(ctx *context.Context, isReleasesOnly bool, formatType string) {
|
||||
feed.ShowReleaseFeed(ctx, ctx.Repo.Repository, isReleasesOnly, formatType)
|
||||
}
|
||||
|
||||
// SingleRelease renders a single release's page
|
||||
func SingleRelease(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.releases")
|
||||
|
||||
+11
-2
@@ -1087,12 +1087,21 @@ func RegisterRoutes(m *web.Route) {
|
||||
|
||||
// Releases
|
||||
m.Group("/{username}/{reponame}", func() {
|
||||
m.Get("/tags", repo.TagsList, repo.MustBeNotEmpty,
|
||||
reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag))
|
||||
m.Group("/tags", func() {
|
||||
m.Get("", repo.TagsList)
|
||||
m.Get(".rss", feedEnabled, repo.TagsListFeedRSS)
|
||||
m.Get(".atom", feedEnabled, repo.TagsListFeedAtom)
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["EnableFeed"] = setting.EnableFeed
|
||||
}, repo.MustBeNotEmpty, reqRepoCodeReader, context.RepoRefByType(context.RepoRefTag, true))
|
||||
m.Group("/releases", func() {
|
||||
m.Get("/", repo.Releases)
|
||||
m.Get("/tag/*", repo.SingleRelease)
|
||||
m.Get("/latest", repo.LatestRelease)
|
||||
m.Get(".rss", feedEnabled, repo.ReleasesFeedRSS)
|
||||
m.Get(".atom", feedEnabled, repo.ReleasesFeedAtom)
|
||||
}, func(ctx *context.Context) {
|
||||
ctx.Data["EnableFeed"] = setting.EnableFeed
|
||||
}, repo.MustBeNotEmpty, reqRepoReleaseReader, context.RepoRefByType(context.RepoRefTag, true))
|
||||
m.Get("/releases/attachments/{uuid}", repo.GetAttachment, repo.MustBeNotEmpty, reqRepoReleaseReader)
|
||||
m.Group("/releases", func() {
|
||||
|
||||
@@ -17,7 +17,6 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/models/db"
|
||||
"code.gitea.io/gitea/models/foreignreference"
|
||||
issues_model "code.gitea.io/gitea/models/issues"
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
@@ -403,16 +402,6 @@ func (g *GiteaLocalUploader) CreateIssues(issues ...*base.Issue) error {
|
||||
Labels: labels,
|
||||
CreatedUnix: timeutil.TimeStamp(issue.Created.Unix()),
|
||||
UpdatedUnix: timeutil.TimeStamp(issue.Updated.Unix()),
|
||||
ForeignReference: &foreignreference.ForeignReference{
|
||||
LocalIndex: issue.GetLocalIndex(),
|
||||
ForeignIndex: strconv.FormatInt(issue.GetForeignIndex(), 10),
|
||||
RepoID: g.repo.ID,
|
||||
Type: foreignreference.TypeIssue,
|
||||
},
|
||||
}
|
||||
|
||||
if is.ForeignReference.ForeignIndex == "0" {
|
||||
is.ForeignReference.ForeignIndex = strconv.FormatInt(is.Index, 10)
|
||||
}
|
||||
|
||||
if err := g.remapUser(issue, &is); err != nil {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
{{end}}
|
||||
{{if .PackageDescriptor.Metadata.ImageLayers}}
|
||||
<h4 class="ui top attached header">{{.locale.Tr "packages.container.layers"}}</h4>
|
||||
<div class="ui attached segment">
|
||||
<div class="ui attached segment word-break">
|
||||
<table class="ui very basic compact table">
|
||||
<tbody>
|
||||
{{range .PackageDescriptor.Metadata.ImageLayers}}
|
||||
|
||||
@@ -11,6 +11,9 @@
|
||||
<a class="{{if .PageIsTagList}}active {{end}}item" href="{{.RepoLink}}/tags">{{.locale.Tr "repo.release.tags"}}</a>
|
||||
{{end}}
|
||||
</h2>
|
||||
{{if .EnableFeed}}
|
||||
<a href="{{.RepoLink}}/{{if .PageIsTagList}}tags{{else}}releases{{end}}.rss"><i class="ui grey icon tooltip ml-3" data-content="{{.locale.Tr "rss_feed"}}" data-position="top center">{{svg "octicon-rss" 18}}</i></a>
|
||||
{{end}}
|
||||
{{if (and .CanCreateRelease (not .PageIsTagList))}}
|
||||
<a class="ui right small green button" href="{{$.RepoLink}}/releases/new">
|
||||
{{.locale.Tr "repo.release.new_release"}}
|
||||
|
||||
BIN
Binary file not shown.
|
After Width: | Height: | Size: 107 B |
BIN
Binary file not shown.
+1
@@ -0,0 +1 @@
|
||||
# Testing documents in LFS
|
||||
+1
@@ -0,0 +1 @@
|
||||
# Testing READMEs in LFS
|
||||
@@ -0,0 +1 @@
|
||||
ref: refs/heads/master
|
||||
@@ -0,0 +1,4 @@
|
||||
[core]
|
||||
repositoryformatversion = 0
|
||||
filemode = true
|
||||
bare = true
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
+2
@@ -0,0 +1,2 @@
|
||||
x•�Q
|
||||
B!Eûv³�bÆ—£AD¿ý×Ô7’ðÌ0µü„VÐßá¹'ÖRr²´éMÈèY0Y";2Á¸8:/A¦Äœ&²Z”_û½6¸½¤Áõ]á¸Ògùøò\dk9±%æi�¶hÕXGå?O]¹g¿Àï@}97�
|
||||
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
BIN
Binary file not shown.
@@ -0,0 +1 @@
|
||||
73cf03db6ece34e12bf91e8853dc58f678f2f82d
|
||||
@@ -11,6 +11,8 @@ import (
|
||||
"code.gitea.io/gitea/models/unittest"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
func TestEmptyRepo(t *testing.T) {
|
||||
@@ -21,7 +23,8 @@ func TestEmptyRepo(t *testing.T) {
|
||||
"commit/1ae57b34ccf7e18373",
|
||||
"graph",
|
||||
}
|
||||
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{}, unittest.Cond("is_empty = ?", true))
|
||||
emptyRepo := unittest.AssertExistsAndLoadBean(t, &repo_model.Repository{ID: 5})
|
||||
assert.True(t, emptyRepo.IsEmpty)
|
||||
owner := unittest.AssertExistsAndLoadBean(t, &user_model.User{ID: emptyRepo.OwnerID})
|
||||
for _, subpath := range subpaths {
|
||||
req := NewRequestf(t, "GET", "/%s/%s/%s", owner.Name, emptyRepo.Name, subpath)
|
||||
|
||||
@@ -209,8 +209,6 @@ func (s *TestSession) MakeRequestNilResponseHashSumRecorder(t testing.TB, req *h
|
||||
|
||||
const userPassword = "password"
|
||||
|
||||
var loginSessionCache = make(map[string]*TestSession, 10)
|
||||
|
||||
func emptyTestSession(t testing.TB) *TestSession {
|
||||
t.Helper()
|
||||
jar, err := cookiejar.New(nil)
|
||||
@@ -225,12 +223,8 @@ func getUserToken(t testing.TB, userName string) string {
|
||||
|
||||
func loginUser(t testing.TB, userName string) *TestSession {
|
||||
t.Helper()
|
||||
if session, ok := loginSessionCache[userName]; ok {
|
||||
return session
|
||||
}
|
||||
session := loginUserWithPassword(t, userName, userPassword)
|
||||
loginSessionCache[userName] = session
|
||||
return session
|
||||
|
||||
return loginUserWithPassword(t, userName, userPassword)
|
||||
}
|
||||
|
||||
func loginUserWithPassword(t testing.TB, userName, password string) *TestSession {
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
// Copyright 2022 The Gitea Authors. All rights reserved.
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
package integration
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/tests"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
|
||||
// check that files stored in LFS render properly in the web UI
|
||||
func TestLFSRender(t *testing.T) {
|
||||
defer tests.PrepareTestEnv(t)()
|
||||
|
||||
session := loginUser(t, "user2")
|
||||
|
||||
// check that a markup file is flagged with "Stored in Git LFS" and shows its text
|
||||
t.Run("Markup", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/CONTRIBUTING.md")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
|
||||
content := doc.Find("div.file-view").Text()
|
||||
assert.Contains(t, content, "Testing documents in LFS")
|
||||
})
|
||||
|
||||
// check that an image is flagged with "Stored in Git LFS" and renders inline
|
||||
t.Run("Image", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/jpeg.jpg")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
|
||||
src, exists := doc.Find(".file-view img").Attr("src")
|
||||
assert.True(t, exists, "The image should be in an <img> tag")
|
||||
assert.Equal(t, "/user2/lfs/media/branch/master/jpeg.jpg", src, "The image should use the /media link because it's in LFS")
|
||||
})
|
||||
|
||||
// check that a binary file is flagged with "Stored in Git LFS" and renders a /media/ link instead of a /raw/ link
|
||||
t.Run("Binary", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/crypt.bin")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
fileInfo := doc.Find("div.file-info-entry").First().Text()
|
||||
assert.Contains(t, fileInfo, "Stored with Git LFS")
|
||||
|
||||
rawLink, exists := doc.Find("div.file-view > div.view-raw > a").Attr("href")
|
||||
assert.True(t, exists, "Download link should render instead of content because this is a binary file")
|
||||
assert.Equal(t, "/user2/lfs/media/branch/master/crypt.bin", rawLink, "The download link should use the proper /media link because it's in LFS")
|
||||
})
|
||||
|
||||
// check that a directory with a README file shows its text
|
||||
t.Run("Readme", func(t *testing.T) {
|
||||
defer tests.PrintCurrentTest(t)()
|
||||
|
||||
req := NewRequest(t, "GET", "/user2/lfs/src/branch/master/subdir")
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
doc := NewHTMLParser(t, resp.Body).doc
|
||||
|
||||
content := doc.Find("div.file-view").Text()
|
||||
assert.Contains(t, content, "Testing READMEs in LFS")
|
||||
})
|
||||
}
|
||||
@@ -21,7 +21,4 @@ func TestSignOut(t *testing.T) {
|
||||
// try to view a private repo, should fail
|
||||
req = NewRequest(t, "GET", "/user2/repo2")
|
||||
session.MakeRequest(t, req, http.StatusNotFound)
|
||||
|
||||
// invalidate cached cookies for user2, for subsequent tests
|
||||
delete(loginSessionCache, "user2")
|
||||
}
|
||||
|
||||
@@ -167,7 +167,11 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() {
|
||||
ourSkip += skip[0]
|
||||
}
|
||||
deferFn := PrintCurrentTest(t, ourSkip)
|
||||
|
||||
// load database fixtures
|
||||
assert.NoError(t, unittest.LoadFixtures())
|
||||
|
||||
// load git repo fixtures
|
||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||
@@ -190,6 +194,16 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() {
|
||||
}
|
||||
}
|
||||
|
||||
// load LFS object fixtures
|
||||
// (LFS storage can be on any of several backends, including remote servers, so we init it with the storage API)
|
||||
lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")})
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, storage.Clean(storage.LFS))
|
||||
assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error {
|
||||
_, err := storage.Copy(storage.LFS, path, lfsFixtures, path)
|
||||
return err
|
||||
}))
|
||||
|
||||
return deferFn
|
||||
}
|
||||
|
||||
@@ -198,7 +212,11 @@ func PrepareTestEnv(t testing.TB, skip ...int) func() {
|
||||
// within a single test this is required
|
||||
func ResetFixtures(t *testing.T) {
|
||||
assert.NoError(t, queue.GetManager().FlushAll(context.Background(), -1))
|
||||
|
||||
// load database fixtures
|
||||
assert.NoError(t, unittest.LoadFixtures())
|
||||
|
||||
// load git repo fixtures
|
||||
assert.NoError(t, util.RemoveAll(setting.RepoRootPath))
|
||||
assert.NoError(t, unittest.CopyDir(path.Join(filepath.Dir(setting.AppPath), "tests/gitea-repositories-meta"), setting.RepoRootPath))
|
||||
ownerDirs, err := os.ReadDir(setting.RepoRootPath)
|
||||
@@ -220,4 +238,14 @@ func ResetFixtures(t *testing.T) {
|
||||
_ = os.MkdirAll(filepath.Join(setting.RepoRootPath, ownerDir.Name(), repoDir.Name(), "refs", "tag"), 0o755)
|
||||
}
|
||||
}
|
||||
|
||||
// load LFS object fixtures
|
||||
// (LFS storage can be on any of several backends, including remote servers, so we init it with the storage API)
|
||||
lfsFixtures, err := storage.NewStorage("", storage.LocalStorageConfig{Path: path.Join(filepath.Dir(setting.AppPath), "tests/gitea-lfs-meta")})
|
||||
assert.NoError(t, err)
|
||||
assert.NoError(t, storage.Clean(storage.LFS))
|
||||
assert.NoError(t, lfsFixtures.IterateObjects(func(path string, _ storage.Object) error {
|
||||
_, err := storage.Copy(storage.LFS, path, lfsFixtures, path)
|
||||
return err
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
import {CalendarHeatmap} from 'vue3-calendar-heatmap';
|
||||
|
||||
export default {
|
||||
name: 'ActivityHeatmap',
|
||||
components: {CalendarHeatmap},
|
||||
props: {
|
||||
values: {
|
||||
|
||||
@@ -46,19 +46,13 @@ const luminance = (colorString) => {
|
||||
const luminanceThreshold = 0.179;
|
||||
|
||||
export default {
|
||||
name: 'ContextPopup',
|
||||
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
data: () => ({
|
||||
loading: false,
|
||||
issue: null,
|
||||
i18nErrorOccurred: i18n.error_occurred,
|
||||
i18nErrorMessage: null,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
createdAt() {
|
||||
return new Date(this.issue.created_at).toLocaleDateString(undefined, {year: 'numeric', month: 'short', day: 'numeric'});
|
||||
@@ -107,7 +101,6 @@ export default {
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.$refs.root.addEventListener('us-load-context-popup', (e) => {
|
||||
const data = e.detail;
|
||||
@@ -116,7 +109,6 @@ export default {
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
methods: {
|
||||
load(data) {
|
||||
this.loading = true;
|
||||
|
||||
@@ -27,12 +27,9 @@ import {doLoadMoreFiles} from '../features/repo-diff.js';
|
||||
const {pageData} = window.config;
|
||||
|
||||
export default {
|
||||
name: 'DiffFileList',
|
||||
|
||||
data: () => {
|
||||
return pageData.diffFileInfo;
|
||||
},
|
||||
|
||||
watch: {
|
||||
fileListIsVisible(newValue) {
|
||||
if (newValue === true) {
|
||||
@@ -44,15 +41,12 @@ export default {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
document.getElementById('show-file-list-btn').addEventListener('click', this.toggleFileList);
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
document.getElementById('show-file-list-btn').removeEventListener('click', this.toggleFileList);
|
||||
},
|
||||
|
||||
methods: {
|
||||
toggleFileList() {
|
||||
this.fileListIsVisible = !this.fileListIsVisible;
|
||||
|
||||
@@ -21,15 +21,12 @@ const {pageData} = window.config;
|
||||
const LOCAL_STORAGE_KEY = 'diff_file_tree_visible';
|
||||
|
||||
export default {
|
||||
name: 'DiffFileTree',
|
||||
components: {DiffFileTreeItem},
|
||||
|
||||
data: () => {
|
||||
const fileTreeIsVisible = localStorage.getItem(LOCAL_STORAGE_KEY) === 'true';
|
||||
pageData.diffFileInfo.fileTreeIsVisible = fileTreeIsVisible;
|
||||
return pageData.diffFileInfo;
|
||||
},
|
||||
|
||||
computed: {
|
||||
fileTree() {
|
||||
const result = [];
|
||||
@@ -94,7 +91,6 @@ export default {
|
||||
return result;
|
||||
}
|
||||
},
|
||||
|
||||
mounted() {
|
||||
// ensure correct buttons when we are mounted to the dom
|
||||
this.adjustToggleButton(this.fileTreeIsVisible);
|
||||
@@ -125,7 +121,7 @@ export default {
|
||||
doLoadMoreFiles(this.link, this.diffEnd, () => {
|
||||
this.isLoadingNewData = false;
|
||||
});
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
@@ -43,11 +43,7 @@
|
||||
import {SvgIcon} from '../svg.js';
|
||||
|
||||
export default {
|
||||
name: 'DiffFileTreeItem',
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
props: {
|
||||
item: {
|
||||
type: Object,
|
||||
@@ -59,7 +55,6 @@ export default {
|
||||
default: true
|
||||
}
|
||||
},
|
||||
|
||||
data: () => ({
|
||||
collapsed: false,
|
||||
}),
|
||||
|
||||
@@ -111,11 +111,7 @@ import {SvgIcon} from '../svg.js';
|
||||
const {csrfToken, pageData} = window.config;
|
||||
|
||||
export default {
|
||||
name: 'PullRequestMergeForm',
|
||||
components: {
|
||||
SvgIcon,
|
||||
},
|
||||
|
||||
components: {SvgIcon},
|
||||
data: () => ({
|
||||
csrfToken,
|
||||
mergeForm: pageData.pullRequestMergeForm,
|
||||
@@ -137,20 +133,17 @@ export default {
|
||||
showMergeStyleMenu: false,
|
||||
showActionForm: false,
|
||||
}),
|
||||
|
||||
computed: {
|
||||
mergeButtonStyleClass() {
|
||||
if (this.mergeForm.allOverridableChecksOk) return 'green';
|
||||
return this.autoMergeWhenSucceed ? 'blue' : 'red';
|
||||
}
|
||||
},
|
||||
|
||||
watch: {
|
||||
mergeStyle(val) {
|
||||
this.mergeStyleDetail = this.mergeForm.mergeStyles.find((e) => e.name === val);
|
||||
}
|
||||
},
|
||||
|
||||
created() {
|
||||
this.mergeStyleAllowedCount = this.mergeForm.mergeStyles.reduce((v, msd) => v + (msd.allowed ? 1 : 0), 0);
|
||||
|
||||
@@ -158,15 +151,12 @@ export default {
|
||||
if (!mergeStyle) mergeStyle = this.mergeForm.mergeStyles.find((e) => e.allowed)?.name;
|
||||
this.switchMergeStyle(mergeStyle, !this.mergeForm.canMergeNow);
|
||||
},
|
||||
|
||||
mounted() {
|
||||
document.addEventListener('mouseup', this.hideMergeStyleMenu);
|
||||
},
|
||||
|
||||
unmounted() {
|
||||
document.removeEventListener('mouseup', this.hideMergeStyleMenu);
|
||||
},
|
||||
|
||||
methods: {
|
||||
hideMergeStyleMenu() {
|
||||
this.showMergeStyleMenu = false;
|
||||
|
||||
@@ -44,7 +44,7 @@ function fallbackCopyToClipboard(text) {
|
||||
|
||||
// For all DOM elements with [data-clipboard-target] or [data-clipboard-text],
|
||||
// this copy-to-clipboard will work for them
|
||||
export default function initGlobalCopyToClipboardListener() {
|
||||
export function initGlobalCopyToClipboardListener() {
|
||||
document.addEventListener('click', (e) => {
|
||||
let target = e.target;
|
||||
// in case <button data-clipboard-text><svg></button>, so we just search
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default async function createColorPicker($els) {
|
||||
export async function createColorPicker($els) {
|
||||
if (!$els || !$els.length) return;
|
||||
|
||||
await Promise.all([
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import 'jquery.are-you-sure';
|
||||
import {mqBinarySearch} from '../utils.js';
|
||||
import createDropzone from './dropzone.js';
|
||||
import {createDropzone} from './dropzone.js';
|
||||
import {initCompColorPicker} from './comp/ColorPicker.js';
|
||||
import {showGlobalErrorMessage} from '../bootstrap.js';
|
||||
import {attachDropdownAria} from './aria.js';
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import createColorPicker from '../colorpicker.js';
|
||||
import {createColorPicker} from '../colorpicker.js';
|
||||
|
||||
export function initCompColorPicker() {
|
||||
createColorPicker($('.color-picker'));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import attachTribute from '../tribute.js';
|
||||
import {attachTribute} from '../tribute.js';
|
||||
import {handleGlobalEnterQuickSubmit} from './QuickSubmit.js';
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,7 +2,6 @@ import $ from 'jquery';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
|
||||
const {appSubUrl} = window.config;
|
||||
|
||||
const looksLikeEmailAddressCheck = /^\S+@\S+$/;
|
||||
|
||||
export function initCompSearchUserBox() {
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
export function initCompWebHookEditor() {
|
||||
|
||||
@@ -4,7 +4,7 @@ import ContextPopup from '../components/ContextPopup.vue';
|
||||
import {parseIssueHref} from '../utils.js';
|
||||
import {createTippy} from '../modules/tippy.js';
|
||||
|
||||
export default function initContextPopups() {
|
||||
export function initContextPopups() {
|
||||
const refIssues = $('.ref-issue');
|
||||
if (!refIssues.length) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import {copyToClipboard} from './clipboard.js';
|
||||
import {showTemporaryTooltip} from '../modules/tippy.js';
|
||||
import {convertImage} from '../utils.js';
|
||||
|
||||
const {i18n} = window.config;
|
||||
|
||||
async function doCopy(content, btn) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default async function createDropzone(el, opts) {
|
||||
export async function createDropzone(el, opts) {
|
||||
const [{Dropzone}] = await Promise.all([
|
||||
import(/* webpackChunkName: "dropzone" */'dropzone'),
|
||||
import(/* webpackChunkName: "dropzone" */'dropzone/dist/dropzone.css'),
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import emojis from '../../../assets/emoji.json';
|
||||
|
||||
const {assetUrlPrefix} = window.config;
|
||||
const {customEmojis} = window.config;
|
||||
const {assetUrlPrefix, customEmojis} = window.config;
|
||||
|
||||
const tempMap = {...customEmojis};
|
||||
for (const {emoji, aliases} of emojis) {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
import {svg} from '../svg.js';
|
||||
|
||||
|
||||
// Hides the file if newFold is true, and shows it otherwise. The actual hiding is performed using CSS.
|
||||
//
|
||||
// The fold arrow is the icon displayed on the upper left of the file box, especially intended for components having the 'fold-file' class.
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
import {prettyNumber} from '../utils.js';
|
||||
|
||||
const {lang} = document.documentElement;
|
||||
|
||||
const dateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'long', day: 'numeric'});
|
||||
const shortDateFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric'});
|
||||
const dateTimeFormatter = new Intl.DateTimeFormat(lang, {year: 'numeric', month: 'short', day: 'numeric', hour: 'numeric', minute: 'numeric', second: 'numeric'});
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
import {createApp} from 'vue';
|
||||
import ActivityHeatmap from '../components/ActivityHeatmap.vue';
|
||||
import {translateMonth, translateDay} from '../utils.js';
|
||||
export default function initHeatmap() {
|
||||
|
||||
export function initHeatmap() {
|
||||
const el = document.getElementById('user-heatmap');
|
||||
if (!el) return;
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ function getDefaultSvgBoundsIfUndefined(svgXml, src) {
|
||||
return null;
|
||||
}
|
||||
|
||||
export default function initImageDiff() {
|
||||
export function initImageDiff() {
|
||||
function createContext(image1, image2) {
|
||||
const size1 = {
|
||||
width: image1 && image1.width || 0,
|
||||
|
||||
@@ -2,7 +2,7 @@ import {createApp} from 'vue';
|
||||
import DiffFileTree from '../components/DiffFileTree.vue';
|
||||
import DiffFileList from '../components/DiffFileList.vue';
|
||||
|
||||
export default function initDiffFileTree() {
|
||||
export function initDiffFileTree() {
|
||||
const el = document.getElementById('diff-file-tree');
|
||||
if (!el) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
import {svg} from '../svg.js';
|
||||
|
||||
const {csrf} = window.config;
|
||||
|
||||
const threshold = 50;
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
|
||||
export default function initRepoGraphGit() {
|
||||
export function initRepoGraphGit() {
|
||||
const graphContainer = document.getElementById('git-graph-container');
|
||||
if (!graphContainer) return;
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import {createApp} from 'vue';
|
||||
import PullRequestMergeForm from '../components/PullRequestMergeForm.vue';
|
||||
|
||||
export default function initPullRequestMergeForm() {
|
||||
export function initRepoPullRequestMergeForm() {
|
||||
const el = document.getElementById('pull-request-merge-form');
|
||||
if (!el) return;
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import $ from 'jquery';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
import attachTribute from './tribute.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
|
||||
@@ -3,33 +3,28 @@ import {createCommentEasyMDE, getAttachedEasyMDE} from './comp/EasyMDE.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel,
|
||||
initRepoIssueCommentDelete,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete,
|
||||
initRepoIssueReferenceIssue, initRepoIssueStatusButton,
|
||||
initRepoIssueTitleEdit,
|
||||
initRepoIssueWipToggle, initRepoPullRequestUpdate,
|
||||
updateIssuesMeta,
|
||||
initRepoIssueBranchSelect, initRepoIssueCodeCommentCancel, initRepoIssueCommentDelete,
|
||||
initRepoIssueComments, initRepoIssueDependencyDelete, initRepoIssueReferenceIssue,
|
||||
initRepoIssueStatusButton, initRepoIssueTitleEdit, initRepoIssueWipToggle,
|
||||
initRepoPullRequestUpdate, updateIssuesMeta,
|
||||
} from './repo-issue.js';
|
||||
import {initUnicodeEscapeButton} from './repo-unicode-escape.js';
|
||||
import {svg} from '../svg.js';
|
||||
import {htmlEscape} from 'escape-goat';
|
||||
import {initRepoBranchTagDropdown} from '../components/RepoBranchTagDropdown.js';
|
||||
import {
|
||||
initRepoCloneLink,
|
||||
initRepoCommonBranchOrTagDropdown,
|
||||
initRepoCommonFilterSearchDropdown,
|
||||
initRepoCloneLink, initRepoCommonBranchOrTagDropdown, initRepoCommonFilterSearchDropdown,
|
||||
initRepoCommonLanguageStats,
|
||||
} from './repo-common.js';
|
||||
import {initCitationFileCopyContent} from './citation.js';
|
||||
import {initCompLabelEdit} from './comp/LabelEdit.js';
|
||||
import {initRepoDiffConversationNav} from './repo-diff.js';
|
||||
import attachTribute from './tribute.js';
|
||||
import createDropzone from './dropzone.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {createDropzone} from './dropzone.js';
|
||||
import {initCommentContent, initMarkupContent} from '../markup/content.js';
|
||||
import {initCompReactionSelector} from './comp/ReactionSelector.js';
|
||||
import {initRepoSettingBranches} from './repo-settings.js';
|
||||
import initRepoPullRequestMergeForm from './repo-issue-pr-form.js';
|
||||
import {initRepoPullRequestMergeForm} from './repo-issue-pr-form.js';
|
||||
|
||||
const {csrfToken} = window.config;
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ const $lfsSettings = $('#lfs_settings');
|
||||
const $lfsEndpoint = $('#lfs_endpoint');
|
||||
const $items = $('#migrate_items').find('input[type=checkbox]');
|
||||
|
||||
export default function initRepoMigration() {
|
||||
export function initRepoMigration() {
|
||||
checkAuth();
|
||||
setLFSSettingsVisibility();
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ async function initRepoProjectSortable() {
|
||||
}
|
||||
}
|
||||
|
||||
export default function initRepoProject() {
|
||||
export function initRepoProject() {
|
||||
if (!$('.repository.projects').length) {
|
||||
return;
|
||||
}
|
||||
@@ -204,7 +204,7 @@ function getRelativeColor(color) {
|
||||
}
|
||||
|
||||
function rgbToHex(rgb) {
|
||||
rgb = rgb.match(/^rgb\((\d+),\s*(\d+),\s*(\d+)\)$/);
|
||||
rgb = rgb.match(/^rgba?\((\d+),\s*(\d+),\s*(\d+).*\)$/);
|
||||
return `#${hex(rgb[1])}${hex(rgb[2])}${hex(rgb[3])}`;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import $ from 'jquery';
|
||||
import attachTribute from './tribute.js';
|
||||
import {attachTribute} from './tribute.js';
|
||||
import {initCompMarkupContentPreviewTab} from './comp/MarkupContentPreview.js';
|
||||
import {initEasyMDEImagePaste} from './comp/ImagePaste.js';
|
||||
import {createCommentEasyMDE} from './comp/EasyMDE.js';
|
||||
|
||||
@@ -35,7 +35,7 @@ async function checkCacheValidity() {
|
||||
}
|
||||
}
|
||||
|
||||
export default async function initServiceWorker() {
|
||||
export async function initServiceWorker() {
|
||||
if (!('serviceWorker' in navigator)) return;
|
||||
|
||||
if (useServiceWorker) {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export default function initTableSort() {
|
||||
export function initTableSort() {
|
||||
for (const header of document.querySelectorAll('th[data-sortt-asc]') || []) {
|
||||
const sorttAsc = header.getAttribute('data-sortt-asc');
|
||||
const sorttDesc = header.getAttribute('data-sortt-desc');
|
||||
|
||||
@@ -49,7 +49,7 @@ function makeCollections({mentions, emoji}) {
|
||||
return collections;
|
||||
}
|
||||
|
||||
export default async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) {
|
||||
export async function attachTribute(elementOrNodeList, {mentions, emoji} = {}) {
|
||||
if (!window.config.requireTribute || !elementOrNodeList) return;
|
||||
const nodes = Array.from('length' in elementOrNodeList ? elementOrNodeList : [elementOrNodeList]);
|
||||
if (!nodes.length) return;
|
||||
|
||||
+11
-11
@@ -6,16 +6,16 @@ import {initVueEnv} from './components/VueComponentLoader.js';
|
||||
import {initRepoActivityTopAuthorsChart} from './components/RepoActivityTopAuthors.vue';
|
||||
import {initDashboardRepoList} from './components/DashboardRepoList.js';
|
||||
|
||||
import attachTribute from './features/tribute.js';
|
||||
import initGlobalCopyToClipboardListener from './features/clipboard.js';
|
||||
import initContextPopups from './features/contextpopup.js';
|
||||
import initRepoGraphGit from './features/repo-graph.js';
|
||||
import initHeatmap from './features/heatmap.js';
|
||||
import initImageDiff from './features/imagediff.js';
|
||||
import initRepoMigration from './features/repo-migration.js';
|
||||
import initRepoProject from './features/repo-projects.js';
|
||||
import initServiceWorker from './features/serviceworker.js';
|
||||
import initTableSort from './features/tablesort.js';
|
||||
import {attachTribute} from './features/tribute.js';
|
||||
import {initGlobalCopyToClipboardListener} from './features/clipboard.js';
|
||||
import {initContextPopups} from './features/contextpopup.js';
|
||||
import {initRepoGraphGit} from './features/repo-graph.js';
|
||||
import {initHeatmap} from './features/heatmap.js';
|
||||
import {initImageDiff} from './features/imagediff.js';
|
||||
import {initRepoMigration} from './features/repo-migration.js';
|
||||
import {initRepoProject} from './features/repo-projects.js';
|
||||
import {initServiceWorker} from './features/serviceworker.js';
|
||||
import {initTableSort} from './features/tablesort.js';
|
||||
import {initAdminUserListSearchForm} from './features/admin/users.js';
|
||||
import {initAdminConfigs} from './features/admin/config.js';
|
||||
import {initMarkupAnchors} from './markup/anchors.js';
|
||||
@@ -24,7 +24,7 @@ import {initRepoIssueContentHistory} from './features/repo-issue-content.js';
|
||||
import {initStopwatch} from './features/stopwatch.js';
|
||||
import {initFindFileInRepo} from './features/repo-findfile.js';
|
||||
import {initCommentContent, initMarkupContent} from './markup/content.js';
|
||||
import initDiffFileTree from './features/repo-diff-filetree.js';
|
||||
import {initDiffFileTree} from './features/repo-diff-filetree.js';
|
||||
|
||||
import {initUserAuthLinkAccountView, initUserAuthOauth2} from './features/user-auth.js';
|
||||
import {
|
||||
|
||||
@@ -26,7 +26,6 @@ import octiconSidebarExpand from '../../public/img/svg/octicon-sidebar-expand.sv
|
||||
import octiconTriangleDown from '../../public/img/svg/octicon-triangle-down.svg';
|
||||
import octiconX from '../../public/img/svg/octicon-x.svg';
|
||||
|
||||
|
||||
export const svgs = {
|
||||
'octicon-chevron-down': octiconChevronDown,
|
||||
'octicon-chevron-right': octiconChevronRight,
|
||||
@@ -57,7 +56,6 @@ export const svgs = {
|
||||
'octicon-x': octiconX,
|
||||
};
|
||||
|
||||
|
||||
const parser = new DOMParser();
|
||||
const serializer = new XMLSerializer();
|
||||
|
||||
|
||||
@@ -1595,6 +1595,8 @@
|
||||
border-bottom: 1px solid var(--color-secondary);
|
||||
padding-left: 2px;
|
||||
padding-right: 2px;
|
||||
margin-left: -1px;
|
||||
margin-right: -1px;
|
||||
}
|
||||
|
||||
> div::after {
|
||||
|
||||
Reference in New Issue
Block a user