mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-18 00:47:48 -04:00
Merge branch 'master' into graceful-queues
This commit is contained in:
commit
bde0cf23df
19
Makefile
19
Makefile
@ -92,6 +92,25 @@ all: build
|
|||||||
|
|
||||||
include docker/Makefile
|
include docker/Makefile
|
||||||
|
|
||||||
|
.PHONY: help
|
||||||
|
help:
|
||||||
|
@echo "Make Routines:"
|
||||||
|
@echo " - \"\" equivalent to \"build\""
|
||||||
|
@echo " - build creates the entire project"
|
||||||
|
@echo " - clean delete integration files and build files but not css and js files"
|
||||||
|
@echo " - clean-all delete all generated files (integration test, build, css and js files)"
|
||||||
|
@echo " - css rebuild only css files"
|
||||||
|
@echo " - js rebuild only js files"
|
||||||
|
@echo " - generate run \"make css js\" and \"go generate\""
|
||||||
|
@echo " - fmt format the code"
|
||||||
|
@echo " - generate-swagger generate the swagger spec from code comments"
|
||||||
|
@echo " - swagger-validate check if the swagger spec is valide"
|
||||||
|
@echo " - revive run code linter revive"
|
||||||
|
@echo " - misspell check if a word is written wrong"
|
||||||
|
@echo " - vet examines Go source code and reports suspicious constructs"
|
||||||
|
@echo " - test run unit test"
|
||||||
|
@echo " - test-sqlite run integration test for sqlite"
|
||||||
|
|
||||||
.PHONY: go-check
|
.PHONY: go-check
|
||||||
go-check:
|
go-check:
|
||||||
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell go version | grep -Eo '[0-9]+\.?[0-9]+?\.?[0-9]?\s' | tr '.' ' ');))
|
$(eval GO_VERSION := $(shell printf "%03d%03d%03d" $(shell go version | grep -Eo '[0-9]+\.?[0-9]+?\.?[0-9]?\s' | tr '.' ' ');))
|
||||||
|
6
go.mod
6
go.mod
@ -13,7 +13,7 @@ require (
|
|||||||
gitea.com/macaron/gzip v0.0.0-20191118033930-0c4c5566a0e5
|
gitea.com/macaron/gzip v0.0.0-20191118033930-0c4c5566a0e5
|
||||||
gitea.com/macaron/i18n v0.0.0-20190822004228-474e714e2223
|
gitea.com/macaron/i18n v0.0.0-20190822004228-474e714e2223
|
||||||
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
|
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
|
||||||
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb
|
gitea.com/macaron/macaron v1.4.0
|
||||||
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705
|
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705
|
||||||
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
|
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7
|
||||||
github.com/PuerkitoBio/goquery v1.5.0
|
github.com/PuerkitoBio/goquery v1.5.0
|
||||||
@ -88,7 +88,7 @@ require (
|
|||||||
github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481 // indirect
|
github.com/tecbot/gorocksdb v0.0.0-20181010114359-8752a9433481 // indirect
|
||||||
github.com/tstranex/u2f v1.0.0
|
github.com/tstranex/u2f v1.0.0
|
||||||
github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1
|
github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
|
github.com/unknwon/com v1.0.1
|
||||||
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6
|
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6
|
||||||
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141
|
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141
|
||||||
github.com/urfave/cli v1.20.0
|
github.com/urfave/cli v1.20.0
|
||||||
@ -104,7 +104,7 @@ require (
|
|||||||
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
gopkg.in/alexcesaro/quotedprintable.v3 v3.0.0-20150716171945-2caba252f4dc // indirect
|
||||||
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect
|
gopkg.in/asn1-ber.v1 v1.0.0-20150924051756-4e86f4367175 // indirect
|
||||||
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
gopkg.in/ini.v1 v1.48.0
|
gopkg.in/ini.v1 v1.51.1
|
||||||
gopkg.in/ldap.v3 v3.0.2
|
gopkg.in/ldap.v3 v3.0.2
|
||||||
gopkg.in/src-d/go-billy.v4 v4.3.2
|
gopkg.in/src-d/go-billy.v4 v4.3.2
|
||||||
gopkg.in/src-d/go-git.v4 v4.13.1
|
gopkg.in/src-d/go-git.v4 v4.13.1
|
||||||
|
8
go.sum
8
go.sum
@ -31,6 +31,8 @@ gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a/go.mod h1:h6E4kLao1Y
|
|||||||
gitea.com/macaron/macaron v1.3.3-0.20190803174002-53e005ff4827/go.mod h1:/rvxMjIkOq4BM8uPUb+VHuU02ZfAO6R4+wD//tiCiRw=
|
gitea.com/macaron/macaron v1.3.3-0.20190803174002-53e005ff4827/go.mod h1:/rvxMjIkOq4BM8uPUb+VHuU02ZfAO6R4+wD//tiCiRw=
|
||||||
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb h1:amL0md6orTj1tXY16ANzVU9FmzQB+W7aJwp8pVDbrmA=
|
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb h1:amL0md6orTj1tXY16ANzVU9FmzQB+W7aJwp8pVDbrmA=
|
||||||
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb/go.mod h1:0coI+mSPSwbsyAbOuFllVS38awuk9mevhLD52l50Gjs=
|
gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb/go.mod h1:0coI+mSPSwbsyAbOuFllVS38awuk9mevhLD52l50Gjs=
|
||||||
|
gitea.com/macaron/macaron v1.4.0 h1:FY1QDGqyuUzs21K6ChkbYbRUfwL7v2aUrhNEJ0IgsAw=
|
||||||
|
gitea.com/macaron/macaron v1.4.0/go.mod h1:P7hfDbQjcW22lkYkXlxdRIfWOXxH2+K4EogN4Q0UlLY=
|
||||||
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705 h1:mvkQGAlON1Z6Y8pqa/+FpYIskk54mazuECUfZK5oTg0=
|
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705 h1:mvkQGAlON1Z6Y8pqa/+FpYIskk54mazuECUfZK5oTg0=
|
||||||
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705/go.mod h1:1ujH0jD6Ca4iK9NL0Q2a7fG2chvXx5hVa7hBfABwpkA=
|
gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705/go.mod h1:1ujH0jD6Ca4iK9NL0Q2a7fG2chvXx5hVa7hBfABwpkA=
|
||||||
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7 h1:N9QFoeNsUXLhl14mefLzGluqV7w2mGU3u+iZU+jCeWk=
|
gitea.com/macaron/toolbox v0.0.0-20190822013122-05ff0fc766b7 h1:N9QFoeNsUXLhl14mefLzGluqV7w2mGU3u+iZU+jCeWk=
|
||||||
@ -532,6 +534,8 @@ github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1 h1:SpoCl3+Pta5/ubQyF+F
|
|||||||
github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1/go.mod h1:QaSeRctcea9fK6piJpAMCCPKxzJ01+xFcr2k1m3WRPU=
|
github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1/go.mod h1:QaSeRctcea9fK6piJpAMCCPKxzJ01+xFcr2k1m3WRPU=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
|
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
||||||
|
github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=
|
||||||
|
github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
||||||
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6 h1:sRrkJEHtNoaSvyXMbRgofEOX4/3gMiraevQKJdIBhYE=
|
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6 h1:sRrkJEHtNoaSvyXMbRgofEOX4/3gMiraevQKJdIBhYE=
|
||||||
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
|
github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6/go.mod h1:+5rDk6sDGpl3azws3O+f+GpFSyN9GVr0K8cvQLQM2ZQ=
|
||||||
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141 h1:Z79lyIznnziKADUf0J7EP8Z4ZL7YJDiPuaazlfUBSy4=
|
github.com/unknwon/paginater v0.0.0-20151104151617-7748a72e0141 h1:Z79lyIznnziKADUf0J7EP8Z4ZL7YJDiPuaazlfUBSy4=
|
||||||
@ -721,8 +725,8 @@ gopkg.in/ini.v1 v1.42.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
|||||||
gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.44.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/ini.v1 v1.44.2/go.mod h1:M3Cogqpuv0QCi3ExAY5V4uOt4qb/R3xZubo9m8lK5wg=
|
gopkg.in/ini.v1 v1.44.2/go.mod h1:M3Cogqpuv0QCi3ExAY5V4uOt4qb/R3xZubo9m8lK5wg=
|
||||||
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.46.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/ini.v1 v1.48.0 h1:URjZc+8ugRY5mL5uUeQH/a63JcHwdX9xZaWvmNWD7z8=
|
gopkg.in/ini.v1 v1.51.1 h1:GyboHr4UqMiLUybYjd22ZjQIKEJEpgtLXtuGbR21Oho=
|
||||||
gopkg.in/ini.v1 v1.48.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
gopkg.in/ini.v1 v1.51.1/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
|
||||||
gopkg.in/ldap.v3 v3.0.2 h1:R6RBtabK6e1GO0eQKtkyOFbAHO73QesLzI2w2DZ6b9w=
|
gopkg.in/ldap.v3 v3.0.2 h1:R6RBtabK6e1GO0eQKtkyOFbAHO73QesLzI2w2DZ6b9w=
|
||||||
gopkg.in/ldap.v3 v3.0.2/go.mod h1:oxD7NyBuxchC+SgJDE1Q5Od05eGt29SDQVBmV+HYbzw=
|
gopkg.in/ldap.v3 v3.0.2/go.mod h1:oxD7NyBuxchC+SgJDE1Q5Od05eGt29SDQVBmV+HYbzw=
|
||||||
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
gopkg.in/resty.v1 v1.12.0/go.mod h1:mDo4pnntr5jdWRML875a/NmxYqAlA73dVijT2AXvQQo=
|
||||||
|
@ -121,7 +121,8 @@ type SearchRepoOptions struct {
|
|||||||
StarredByID int64
|
StarredByID int64
|
||||||
Page int
|
Page int
|
||||||
IsProfile bool
|
IsProfile bool
|
||||||
AllPublic bool // Include also all public repositories
|
AllPublic bool // Include also all public repositories of users and public organisations
|
||||||
|
AllLimited bool // Include also all public repositories of limited organisations
|
||||||
PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
|
PageSize int // Can be smaller than or equal to setting.ExplorePagingNum
|
||||||
// None -> include collaborative AND non-collaborative
|
// None -> include collaborative AND non-collaborative
|
||||||
// True -> include just collaborative
|
// True -> include just collaborative
|
||||||
@ -228,7 +229,11 @@ func SearchRepository(opts *SearchRepoOptions) (RepositoryList, int64, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if opts.AllPublic {
|
if opts.AllPublic {
|
||||||
accessCond = accessCond.Or(builder.Eq{"is_private": false})
|
accessCond = accessCond.Or(builder.Eq{"is_private": false}.And(builder.In("owner_id", builder.Select("`user`.id").From("`user`").Where(builder.Eq{"`user`.visibility": structs.VisibleTypePublic}))))
|
||||||
|
}
|
||||||
|
|
||||||
|
if opts.AllLimited {
|
||||||
|
accessCond = accessCond.Or(builder.Eq{"is_private": false}.And(builder.In("owner_id", builder.Select("`user`.id").From("`user`").Where(builder.Eq{"`user`.visibility": structs.VisibleTypeLimited}))))
|
||||||
}
|
}
|
||||||
|
|
||||||
cond = cond.And(accessCond)
|
cond = cond.And(accessCond)
|
||||||
|
@ -177,8 +177,8 @@ func TestSearchRepository(t *testing.T) {
|
|||||||
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, AllPublic: true, Template: util.OptionalBoolFalse},
|
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, AllPublic: true, Template: util.OptionalBoolFalse},
|
||||||
count: 25},
|
count: 25},
|
||||||
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative",
|
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborative",
|
||||||
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true, Template: util.OptionalBoolFalse},
|
opts: &SearchRepoOptions{Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true, AllLimited: true, Template: util.OptionalBoolFalse},
|
||||||
count: 31},
|
count: 30},
|
||||||
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName",
|
{name: "AllPublic/PublicAndPrivateRepositoriesOfUserIncludingCollaborativeByName",
|
||||||
opts: &SearchRepoOptions{Keyword: "test", Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true},
|
opts: &SearchRepoOptions{Keyword: "test", Page: 1, PageSize: 10, OwnerID: 15, Private: true, AllPublic: true},
|
||||||
count: 15},
|
count: 15},
|
||||||
|
@ -369,3 +369,23 @@ func hasAccess(e Engine, userID int64, repo *Repository) (bool, error) {
|
|||||||
func HasAccess(userID int64, repo *Repository) (bool, error) {
|
func HasAccess(userID int64, repo *Repository) (bool, error) {
|
||||||
return hasAccess(x, userID, repo)
|
return hasAccess(x, userID, repo)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// FilterOutRepoIdsWithoutUnitAccess filter out repos where user has no access to repositories
|
||||||
|
func FilterOutRepoIdsWithoutUnitAccess(u *User, repoIDs []int64, units ...UnitType) ([]int64, error) {
|
||||||
|
i := 0
|
||||||
|
for _, rID := range repoIDs {
|
||||||
|
repo, err := GetRepositoryByID(rID)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
perm, err := GetUserRepoPermission(repo, u)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
if perm.CanReadAny(units...) {
|
||||||
|
repoIDs[i] = rID
|
||||||
|
i++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return repoIDs[:i], nil
|
||||||
|
}
|
||||||
|
@ -638,19 +638,20 @@ func (u *User) GetRepositoryIDs(units ...UnitType) ([]int64, error) {
|
|||||||
func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
func (u *User) GetOrgRepositoryIDs(units ...UnitType) ([]int64, error) {
|
||||||
var ids []int64
|
var ids []int64
|
||||||
|
|
||||||
sess := x.Table("repository").
|
if err := x.Table("repository").
|
||||||
Cols("repository.id").
|
Cols("repository.id").
|
||||||
Join("INNER", "team_user", "repository.owner_id = team_user.org_id").
|
Join("INNER", "team_user", "repository.owner_id = team_user.org_id").
|
||||||
Join("INNER", "team_repo", "repository.is_private != ? OR (team_user.team_id = team_repo.team_id AND repository.id = team_repo.repo_id)", true)
|
Join("INNER", "team_repo", "repository.is_private != ? OR (team_user.team_id = team_repo.team_id AND repository.id = team_repo.repo_id)", true).
|
||||||
|
Where("team_user.uid = ?", u.ID).
|
||||||
if len(units) > 0 {
|
GroupBy("repository.id").Find(&ids); err != nil {
|
||||||
sess = sess.Join("INNER", "team_unit", "team_unit.team_id = team_user.team_id")
|
return nil, err
|
||||||
sess = sess.In("team_unit.type", units)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return ids, sess.
|
if len(units) > 0 {
|
||||||
Where("team_user.uid = ?", u.ID).
|
return FilterOutRepoIdsWithoutUnitAccess(u, ids, units...)
|
||||||
GroupBy("repository.id").Find(&ids)
|
}
|
||||||
|
|
||||||
|
return ids, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetAccessRepoIDs returns all repositories IDs where user's or user is a team member organizations
|
// GetAccessRepoIDs returns all repositories IDs where user's or user is a team member organizations
|
||||||
|
@ -10,6 +10,7 @@ link_account=Vincular conta
|
|||||||
register=Cadastrar
|
register=Cadastrar
|
||||||
website=Site
|
website=Site
|
||||||
version=Versão
|
version=Versão
|
||||||
|
powered_by=Desenvolvido por %s
|
||||||
page=Página
|
page=Página
|
||||||
template=Template
|
template=Template
|
||||||
language=Idioma
|
language=Idioma
|
||||||
|
@ -142,6 +142,7 @@ func RenderRepoSearch(ctx *context.Context, opts *RepoSearchOptions) {
|
|||||||
Keyword: keyword,
|
Keyword: keyword,
|
||||||
OwnerID: opts.OwnerID,
|
OwnerID: opts.OwnerID,
|
||||||
AllPublic: true,
|
AllPublic: true,
|
||||||
|
AllLimited: true,
|
||||||
TopicOnly: topicOnly,
|
TopicOnly: topicOnly,
|
||||||
IncludeDescription: setting.UI.SearchRepoDescription,
|
IncludeDescription: setting.UI.SearchRepoDescription,
|
||||||
})
|
})
|
||||||
|
@ -180,6 +180,7 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var repo *models.Repository
|
||||||
var err error
|
var err error
|
||||||
if form.RepoTemplate > 0 {
|
if form.RepoTemplate > 0 {
|
||||||
opts := models.GenerateRepoOptions{
|
opts := models.GenerateRepoOptions{
|
||||||
@ -209,14 +210,14 @@ func CreatePost(ctx *context.Context, form auth.CreateRepoForm) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
repo, err := repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts)
|
repo, err = repo_service.GenerateRepository(ctx.User, ctxUser, templateRepo, opts)
|
||||||
if err == nil {
|
if err == nil {
|
||||||
log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
log.Trace("Repository generated [%d]: %s/%s", repo.ID, ctxUser.Name, repo.Name)
|
||||||
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
ctx.Redirect(setting.AppSubURL + "/" + ctxUser.Name + "/" + repo.Name)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
repo, err := repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
|
repo, err = repo_service.CreateRepository(ctx.User, ctxUser, models.CreateRepoOptions{
|
||||||
Name: form.RepoName,
|
Name: form.RepoName,
|
||||||
Description: form.Description,
|
Description: form.Description,
|
||||||
Gitignores: form.Gitignores,
|
Gitignores: form.Gitignores,
|
||||||
|
@ -188,9 +188,13 @@ func Milestones(ctx *context.Context) {
|
|||||||
ctx.ServerError("env.RepoIDs", err)
|
ctx.ServerError("env.RepoIDs", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
userRepoIDs, err = models.FilterOutRepoIdsWithoutUnitAccess(ctx.User, userRepoIDs, models.UnitTypeIssues, models.UnitTypePullRequests)
|
||||||
|
if err != nil {
|
||||||
|
ctx.ServerError("FilterOutRepoIdsWithoutUnitAccess", err)
|
||||||
|
return
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
unitType := models.UnitTypeIssues
|
userRepoIDs, err = ctxUser.GetAccessRepoIDs(models.UnitTypeIssues, models.UnitTypePullRequests)
|
||||||
userRepoIDs, err = ctxUser.GetAccessRepoIDs(unitType)
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
|
ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
|
||||||
return
|
return
|
||||||
@ -201,27 +205,30 @@ func Milestones(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var repoIDs []int64
|
var repoIDs []int64
|
||||||
if issueReposQueryPattern.MatchString(reposQuery) {
|
if len(reposQuery) != 0 {
|
||||||
// remove "[" and "]" from string
|
if issueReposQueryPattern.MatchString(reposQuery) {
|
||||||
reposQuery = reposQuery[1 : len(reposQuery)-1]
|
// remove "[" and "]" from string
|
||||||
//for each ID (delimiter ",") add to int to repoIDs
|
reposQuery = reposQuery[1 : len(reposQuery)-1]
|
||||||
reposSet := false
|
//for each ID (delimiter ",") add to int to repoIDs
|
||||||
for _, rID := range strings.Split(reposQuery, ",") {
|
reposSet := false
|
||||||
// Ensure nonempty string entries
|
for _, rID := range strings.Split(reposQuery, ",") {
|
||||||
if rID != "" && rID != "0" {
|
// Ensure nonempty string entries
|
||||||
reposSet = true
|
if rID != "" && rID != "0" {
|
||||||
rIDint64, err := strconv.ParseInt(rID, 10, 64)
|
reposSet = true
|
||||||
if err == nil && com.IsSliceContainsInt64(userRepoIDs, rIDint64) {
|
rIDint64, err := strconv.ParseInt(rID, 10, 64)
|
||||||
repoIDs = append(repoIDs, rIDint64)
|
// If the repo id specified by query is not parseable or not accessible by user, just ignore it.
|
||||||
|
if err == nil && com.IsSliceContainsInt64(userRepoIDs, rIDint64) {
|
||||||
|
repoIDs = append(repoIDs, rIDint64)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if reposSet && len(repoIDs) == 0 {
|
||||||
|
// force an empty result
|
||||||
|
repoIDs = []int64{-1}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
log.Warn("issueReposQueryPattern not match with query")
|
||||||
}
|
}
|
||||||
if reposSet && len(repoIDs) == 0 {
|
|
||||||
// force an empty result
|
|
||||||
repoIDs = []int64{-1}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
log.Error("issueReposQueryPattern not match with query")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(repoIDs) == 0 {
|
if len(repoIDs) == 0 {
|
||||||
@ -256,26 +263,6 @@ func Milestones(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
showReposMap[rID] = repo
|
showReposMap[rID] = repo
|
||||||
|
|
||||||
// Check if user has access to given repository.
|
|
||||||
perm, err := models.GetUserRepoPermission(repo, ctxUser)
|
|
||||||
if err != nil {
|
|
||||||
ctx.ServerError("GetUserRepoPermission", fmt.Errorf("[%d]%v", rID, err))
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if !perm.CanRead(models.UnitTypeIssues) {
|
|
||||||
if log.IsTrace() {
|
|
||||||
log.Trace("Permission Denied: User %-v cannot read %-v of repo %-v\n"+
|
|
||||||
"User in repo has Permissions: %-+v",
|
|
||||||
ctxUser,
|
|
||||||
models.UnitTypeIssues,
|
|
||||||
repo,
|
|
||||||
perm)
|
|
||||||
}
|
|
||||||
ctx.Status(404)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
showRepos := models.RepositoryListOfMap(showReposMap)
|
showRepos := models.RepositoryListOfMap(showReposMap)
|
||||||
@ -345,9 +332,11 @@ var issueReposQueryPattern = regexp.MustCompile(`^\[\d+(,\d+)*,?\]$`)
|
|||||||
// Issues render the user issues page
|
// Issues render the user issues page
|
||||||
func Issues(ctx *context.Context) {
|
func Issues(ctx *context.Context) {
|
||||||
isPullList := ctx.Params(":type") == "pulls"
|
isPullList := ctx.Params(":type") == "pulls"
|
||||||
|
unitType := models.UnitTypeIssues
|
||||||
if isPullList {
|
if isPullList {
|
||||||
ctx.Data["Title"] = ctx.Tr("pull_requests")
|
ctx.Data["Title"] = ctx.Tr("pull_requests")
|
||||||
ctx.Data["PageIsPulls"] = true
|
ctx.Data["PageIsPulls"] = true
|
||||||
|
unitType = models.UnitTypePullRequests
|
||||||
} else {
|
} else {
|
||||||
ctx.Data["Title"] = ctx.Tr("issues")
|
ctx.Data["Title"] = ctx.Tr("issues")
|
||||||
ctx.Data["PageIsIssues"] = true
|
ctx.Data["PageIsIssues"] = true
|
||||||
@ -404,7 +393,7 @@ func Issues(ctx *context.Context) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
log.Error("issueReposQueryPattern not match with query")
|
log.Warn("issueReposQueryPattern not match with query")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -424,11 +413,12 @@ func Issues(ctx *context.Context) {
|
|||||||
ctx.ServerError("env.RepoIDs", err)
|
ctx.ServerError("env.RepoIDs", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
} else {
|
userRepoIDs, err = models.FilterOutRepoIdsWithoutUnitAccess(ctx.User, userRepoIDs, unitType)
|
||||||
unitType := models.UnitTypeIssues
|
if err != nil {
|
||||||
if isPullList {
|
ctx.ServerError("FilterOutRepoIdsWithoutUnitAccess", err)
|
||||||
unitType = models.UnitTypePullRequests
|
return
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
userRepoIDs, err = ctxUser.GetAccessRepoIDs(unitType)
|
userRepoIDs, err = ctxUser.GetAccessRepoIDs(unitType)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
|
ctx.ServerError("ctxUser.GetAccessRepoIDs", err)
|
||||||
|
@ -360,19 +360,21 @@
|
|||||||
<img src="{{.Poster.RelAvatarLink}}">
|
<img src="{{.Poster.RelAvatarLink}}">
|
||||||
</a>
|
</a>
|
||||||
<div class="content">
|
<div class="content">
|
||||||
<a class="author" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
|
<div class="code-comment-content">
|
||||||
<div class="metadata">
|
<a class="author" {{if gt .Poster.ID 0}}href="{{.Poster.HomeLink}}"{{end}}>{{.Poster.GetDisplayName}}</a>
|
||||||
<span class="date">{{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdSubStr | Safe}}</span>
|
<div class="metadata">
|
||||||
</div>
|
<span class="date">{{$.i18n.Tr "repo.issues.commented_at" .HashTag $createdSubStr | Safe}}</span>
|
||||||
<div class="text">
|
</div>
|
||||||
<div class="render-content markdown has-emoji">
|
<div class="text">
|
||||||
{{if .RenderedContent}}
|
<div class="render-content markdown has-emoji">
|
||||||
{{.RenderedContent|Str2html}}
|
{{if .RenderedContent}}
|
||||||
{{else}}
|
{{.RenderedContent|Str2html}}
|
||||||
<span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
|
{{else}}
|
||||||
{{end}}
|
<span class="no-content">{{$.i18n.Tr "repo.issues.no_content"}}</span>
|
||||||
|
{{end}}
|
||||||
|
</div>
|
||||||
|
<div class="raw-content hide">{{.Content}}</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="raw-content hide">{{.Content}}</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
5
vendor/gitea.com/macaron/macaron/go.mod
generated
vendored
5
vendor/gitea.com/macaron/macaron/go.mod
generated
vendored
@ -3,9 +3,10 @@ module gitea.com/macaron/macaron
|
|||||||
go 1.11
|
go 1.11
|
||||||
|
|
||||||
require (
|
require (
|
||||||
gitea.com/macaron/inject v0.0.0-20190803172902-8375ba841591
|
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
|
||||||
|
github.com/smartystreets/assertions v1.0.1 // indirect
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
|
github.com/unknwon/com v1.0.1
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4
|
||||||
gopkg.in/ini.v1 v1.44.0
|
gopkg.in/ini.v1 v1.44.0
|
||||||
)
|
)
|
||||||
|
12
vendor/gitea.com/macaron/macaron/go.sum
generated
vendored
12
vendor/gitea.com/macaron/macaron/go.sum
generated
vendored
@ -1,19 +1,23 @@
|
|||||||
gitea.com/macaron/inject v0.0.0-20190803172902-8375ba841591 h1:UbCTjPcLrNxR9LzKDjQBMT2zoxZuEnca1pZCpgeMuhQ=
|
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a h1:aOKEXkDTnh4euoH0so/THLXeHtQuqHmDPb1xEk6Ehok=
|
||||||
gitea.com/macaron/inject v0.0.0-20190803172902-8375ba841591/go.mod h1:h6E4kLao1Yko6DOU6QDnQPcuoNzvbZqzj2mtPcEn1aM=
|
gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a/go.mod h1:h6E4kLao1Yko6DOU6QDnQPcuoNzvbZqzj2mtPcEn1aM=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e h1:JKmoR8x90Iww1ks85zJ1lfDGgIiMDuIptTOhJq+zKyg=
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
github.com/gopherjs/gopherjs v0.0.0-20181103185306-d547d1d9531e/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
||||||
|
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
|
||||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304 h1:Jpy1PXuP99tXNrhbq2BaPz9B+jNAvH1JPQQpG/9GCXY=
|
||||||
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
github.com/smartystreets/assertions v0.0.0-20190116191733-b6c0e53d7304/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
||||||
|
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
|
||||||
|
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
||||||
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c h1:Ho+uVpkel/udgjbwB5Lktg9BtvJSh2DT0Hi6LPSyI2w=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
github.com/smartystreets/goconvey v0.0.0-20181108003508-044398e4856c/go.mod h1:XDJAKZRPZ1CvBcN2aX5YOUTYGHki24fSF0Iv48Ibg0s=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e h1:GSGeB9EAKY2spCABz6xOX5DbxZEXolK+nBSvmsQwRjM=
|
github.com/unknwon/com v1.0.1 h1:3d1LTxD+Lnf3soQiD4Cp/0BRB+Rsa/+RTvz8GMMzIXs=
|
||||||
github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
github.com/unknwon/com v1.0.1/go.mod h1:tOOxU81rwgoCLoOVVPHb6T/wt8HZygqH5id+GNnlCXM=
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4 h1:HuIa8hRrWRSrqYzx1qI49NNxhdi2PrY7gxVSq1JjLDc=
|
||||||
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
||||||
|
9
vendor/gitea.com/macaron/macaron/macaron.go
generated
vendored
9
vendor/gitea.com/macaron/macaron/macaron.go
generated
vendored
@ -1,5 +1,3 @@
|
|||||||
// +build go1.3
|
|
||||||
|
|
||||||
// Copyright 2014 The Macaron Authors
|
// Copyright 2014 The Macaron Authors
|
||||||
//
|
//
|
||||||
// Licensed under the Apache License, Version 2.0 (the "License"): you may
|
// Licensed under the Apache License, Version 2.0 (the "License"): you may
|
||||||
@ -283,6 +281,7 @@ var (
|
|||||||
envLock sync.Mutex
|
envLock sync.Mutex
|
||||||
|
|
||||||
// Path of work directory.
|
// Path of work directory.
|
||||||
|
// You must set this value yourself
|
||||||
Root string
|
Root string
|
||||||
|
|
||||||
// Flash applies to current request.
|
// Flash applies to current request.
|
||||||
@ -310,12 +309,6 @@ func safeEnv() string {
|
|||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
setENV(os.Getenv("MACARON_ENV"))
|
setENV(os.Getenv("MACARON_ENV"))
|
||||||
|
|
||||||
var err error
|
|
||||||
Root, err = os.Getwd()
|
|
||||||
if err != nil {
|
|
||||||
panic("error getting work directory: " + err.Error())
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// SetConfig sets data sources for configuration.
|
// SetConfig sets data sources for configuration.
|
||||||
|
1
vendor/gopkg.in/ini.v1/.travis.yml
generated
vendored
1
vendor/gopkg.in/ini.v1/.travis.yml
generated
vendored
@ -8,6 +8,7 @@ go:
|
|||||||
- 1.10.x
|
- 1.10.x
|
||||||
- 1.11.x
|
- 1.11.x
|
||||||
- 1.12.x
|
- 1.12.x
|
||||||
|
- 1.13.x
|
||||||
|
|
||||||
install: skip
|
install: skip
|
||||||
script:
|
script:
|
||||||
|
5
vendor/gopkg.in/ini.v1/README.md
generated
vendored
5
vendor/gopkg.in/ini.v1/README.md
generated
vendored
@ -1,5 +1,6 @@
|
|||||||
INI [](https://travis-ci.org/go-ini/ini) [](https://sourcegraph.com/github.com/go-ini/ini)
|
# INI
|
||||||
===
|
|
||||||
|
[](https://travis-ci.org/go-ini/ini) [](https://sourcegraph.com/github.com/go-ini/ini)
|
||||||
|
|
||||||

|

|
||||||
|
|
||||||
|
9
vendor/gopkg.in/ini.v1/ini.go
generated
vendored
9
vendor/gopkg.in/ini.v1/ini.go
generated
vendored
@ -29,7 +29,7 @@ const (
|
|||||||
|
|
||||||
// Maximum allowed depth when recursively substituing variable names.
|
// Maximum allowed depth when recursively substituing variable names.
|
||||||
depthValues = 99
|
depthValues = 99
|
||||||
version = "1.48.0"
|
version = "1.51.1"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Version returns current package version literal.
|
// Version returns current package version literal.
|
||||||
@ -111,8 +111,15 @@ type LoadOptions struct {
|
|||||||
KeyValueDelimiters string
|
KeyValueDelimiters string
|
||||||
// PreserveSurroundedQuote indicates whether to preserve surrounded quote (single and double quotes).
|
// PreserveSurroundedQuote indicates whether to preserve surrounded quote (single and double quotes).
|
||||||
PreserveSurroundedQuote bool
|
PreserveSurroundedQuote bool
|
||||||
|
// DebugFunc is called to collect debug information (currently only useful to debug parsing Python-style multiline values).
|
||||||
|
DebugFunc DebugFunc
|
||||||
|
// ReaderBufferSize is the buffer size of the reader in bytes.
|
||||||
|
ReaderBufferSize int
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// DebugFunc is the type of function called to log parse events.
|
||||||
|
type DebugFunc func(message string)
|
||||||
|
|
||||||
// LoadSources allows caller to apply customized options for loading from data source(s).
|
// LoadSources allows caller to apply customized options for loading from data source(s).
|
||||||
func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {
|
func LoadSources(opts LoadOptions, source interface{}, others ...interface{}) (_ *File, err error) {
|
||||||
sources := make([]dataSource, len(others)+1)
|
sources := make([]dataSource, len(others)+1)
|
||||||
|
7
vendor/gopkg.in/ini.v1/key.go
generated
vendored
7
vendor/gopkg.in/ini.v1/key.go
generated
vendored
@ -147,10 +147,15 @@ func (k *Key) transformValue(val string) string {
|
|||||||
noption := vr[2 : len(vr)-2]
|
noption := vr[2 : len(vr)-2]
|
||||||
|
|
||||||
// Search in the same section.
|
// Search in the same section.
|
||||||
|
// If not found or found the key itself, then search again in default section.
|
||||||
nk, err := k.s.GetKey(noption)
|
nk, err := k.s.GetKey(noption)
|
||||||
if err != nil || k == nk {
|
if err != nil || k == nk {
|
||||||
// Search again in default section.
|
|
||||||
nk, _ = k.s.f.Section("").GetKey(noption)
|
nk, _ = k.s.f.Section("").GetKey(noption)
|
||||||
|
if nk == nil {
|
||||||
|
// Stop when no results found in the default section,
|
||||||
|
// and returns the value as-is.
|
||||||
|
break
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Substitute by new value and take off leading '%(' and trailing ')s'.
|
// Substitute by new value and take off leading '%(' and trailing ')s'.
|
||||||
|
59
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
59
vendor/gopkg.in/ini.v1/parser.go
generated
vendored
@ -25,7 +25,9 @@ import (
|
|||||||
"unicode"
|
"unicode"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pythonMultiline = regexp.MustCompile("^(\\s+)([^\n]+)")
|
const minReaderBufferSize = 4096
|
||||||
|
|
||||||
|
var pythonMultiline = regexp.MustCompile(`^([\t\f ]+)(.*)`)
|
||||||
|
|
||||||
type parserOptions struct {
|
type parserOptions struct {
|
||||||
IgnoreContinuation bool
|
IgnoreContinuation bool
|
||||||
@ -35,6 +37,8 @@ type parserOptions struct {
|
|||||||
UnescapeValueDoubleQuotes bool
|
UnescapeValueDoubleQuotes bool
|
||||||
UnescapeValueCommentSymbols bool
|
UnescapeValueCommentSymbols bool
|
||||||
PreserveSurroundedQuote bool
|
PreserveSurroundedQuote bool
|
||||||
|
DebugFunc DebugFunc
|
||||||
|
ReaderBufferSize int
|
||||||
}
|
}
|
||||||
|
|
||||||
type parser struct {
|
type parser struct {
|
||||||
@ -46,9 +50,20 @@ type parser struct {
|
|||||||
comment *bytes.Buffer
|
comment *bytes.Buffer
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (p *parser) debug(format string, args ...interface{}) {
|
||||||
|
if p.options.DebugFunc != nil {
|
||||||
|
p.options.DebugFunc(fmt.Sprintf(format, args...))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
func newParser(r io.Reader, opts parserOptions) *parser {
|
func newParser(r io.Reader, opts parserOptions) *parser {
|
||||||
|
size := opts.ReaderBufferSize
|
||||||
|
if size < minReaderBufferSize {
|
||||||
|
size = minReaderBufferSize
|
||||||
|
}
|
||||||
|
|
||||||
return &parser{
|
return &parser{
|
||||||
buf: bufio.NewReader(r),
|
buf: bufio.NewReaderSize(r, size),
|
||||||
options: opts,
|
options: opts,
|
||||||
count: 1,
|
count: 1,
|
||||||
comment: &bytes.Buffer{},
|
comment: &bytes.Buffer{},
|
||||||
@ -285,33 +300,55 @@ func (p *parser) readPythonMultilines(line string, bufferSize int) (string, erro
|
|||||||
parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
|
parserBufferPeekResult, _ := p.buf.Peek(bufferSize)
|
||||||
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
peekBuffer := bytes.NewBuffer(parserBufferPeekResult)
|
||||||
|
|
||||||
|
indentSize := 0
|
||||||
for {
|
for {
|
||||||
peekData, peekErr := peekBuffer.ReadBytes('\n')
|
peekData, peekErr := peekBuffer.ReadBytes('\n')
|
||||||
if peekErr != nil {
|
if peekErr != nil {
|
||||||
if peekErr == io.EOF {
|
if peekErr == io.EOF {
|
||||||
|
p.debug("readPythonMultilines: io.EOF, peekData: %q, line: %q", string(peekData), line)
|
||||||
return line, nil
|
return line, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.debug("readPythonMultilines: failed to peek with error: %v", peekErr)
|
||||||
return "", peekErr
|
return "", peekErr
|
||||||
}
|
}
|
||||||
|
|
||||||
|
p.debug("readPythonMultilines: parsing %q", string(peekData))
|
||||||
|
|
||||||
peekMatches := pythonMultiline.FindStringSubmatch(string(peekData))
|
peekMatches := pythonMultiline.FindStringSubmatch(string(peekData))
|
||||||
|
p.debug("readPythonMultilines: matched %d parts", len(peekMatches))
|
||||||
|
for n, v := range peekMatches {
|
||||||
|
p.debug(" %d: %q", n, v)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Return if not a Python multiline value.
|
||||||
if len(peekMatches) != 3 {
|
if len(peekMatches) != 3 {
|
||||||
|
p.debug("readPythonMultilines: end of value, got: %q", line)
|
||||||
return line, nil
|
return line, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Return if not a python-ini multi-line value.
|
// Determine indent size and line prefix.
|
||||||
currentIdentSize := len(peekMatches[1])
|
currentIndentSize := len(peekMatches[1])
|
||||||
if currentIdentSize <= 0 {
|
if indentSize < 1 {
|
||||||
|
indentSize = currentIndentSize
|
||||||
|
p.debug("readPythonMultilines: indent size is %d", indentSize)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure each line is indented at least as far as first line.
|
||||||
|
if currentIndentSize < indentSize {
|
||||||
|
p.debug("readPythonMultilines: end of value, current indent: %d, expected indent: %d, line: %q", currentIndentSize, indentSize, line)
|
||||||
return line, nil
|
return line, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: Just advance the parser reader (buffer) in-sync with the peek buffer.
|
// Advance the parser reader (buffer) in-sync with the peek buffer.
|
||||||
_, err := p.readUntil('\n')
|
_, err := p.buf.Discard(len(peekData))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
p.debug("readPythonMultilines: failed to skip to the end, returning error")
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
|
|
||||||
line += fmt.Sprintf("\n%s", peekMatches[2])
|
// Handle indented empty line.
|
||||||
|
line += "\n" + peekMatches[1][indentSize:] + peekMatches[2]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -325,6 +362,8 @@ func (f *File) parse(reader io.Reader) (err error) {
|
|||||||
UnescapeValueDoubleQuotes: f.options.UnescapeValueDoubleQuotes,
|
UnescapeValueDoubleQuotes: f.options.UnescapeValueDoubleQuotes,
|
||||||
UnescapeValueCommentSymbols: f.options.UnescapeValueCommentSymbols,
|
UnescapeValueCommentSymbols: f.options.UnescapeValueCommentSymbols,
|
||||||
PreserveSurroundedQuote: f.options.PreserveSurroundedQuote,
|
PreserveSurroundedQuote: f.options.PreserveSurroundedQuote,
|
||||||
|
DebugFunc: f.options.DebugFunc,
|
||||||
|
ReaderBufferSize: f.options.ReaderBufferSize,
|
||||||
})
|
})
|
||||||
if err = p.BOM(); err != nil {
|
if err = p.BOM(); err != nil {
|
||||||
return fmt.Errorf("BOM: %v", err)
|
return fmt.Errorf("BOM: %v", err)
|
||||||
@ -348,8 +387,8 @@ func (f *File) parse(reader io.Reader) (err error) {
|
|||||||
// the size of the parser buffer is found.
|
// the size of the parser buffer is found.
|
||||||
// TODO(unknwon): When Golang 1.10 is the lowest version supported, replace with `parserBufferSize := p.buf.Size()`.
|
// TODO(unknwon): When Golang 1.10 is the lowest version supported, replace with `parserBufferSize := p.buf.Size()`.
|
||||||
parserBufferSize := 0
|
parserBufferSize := 0
|
||||||
// NOTE: Peek 1kb at a time.
|
// NOTE: Peek 4kb at a time.
|
||||||
currentPeekSize := 1024
|
currentPeekSize := minReaderBufferSize
|
||||||
|
|
||||||
if f.options.AllowPythonMultilineValues {
|
if f.options.AllowPythonMultilineValues {
|
||||||
for {
|
for {
|
||||||
|
88
vendor/gopkg.in/ini.v1/struct.go
generated
vendored
88
vendor/gopkg.in/ini.v1/struct.go
generated
vendored
@ -155,23 +155,45 @@ func wrapStrictError(err error, isStrict bool) error {
|
|||||||
// but it does not return error for failing parsing,
|
// but it does not return error for failing parsing,
|
||||||
// because we want to use default value that is already assigned to struct.
|
// because we want to use default value that is already assigned to struct.
|
||||||
func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
|
func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim string, allowShadow, isStrict bool) error {
|
||||||
switch t.Kind() {
|
vt := t
|
||||||
|
isPtr := t.Kind() == reflect.Ptr
|
||||||
|
if isPtr {
|
||||||
|
vt = t.Elem()
|
||||||
|
}
|
||||||
|
switch vt.Kind() {
|
||||||
case reflect.String:
|
case reflect.String:
|
||||||
if len(key.String()) == 0 {
|
stringVal := key.String()
|
||||||
return nil
|
if isPtr {
|
||||||
|
field.Set(reflect.ValueOf(&stringVal))
|
||||||
|
} else if len(stringVal) > 0 {
|
||||||
|
field.SetString(key.String())
|
||||||
}
|
}
|
||||||
field.SetString(key.String())
|
|
||||||
case reflect.Bool:
|
case reflect.Bool:
|
||||||
boolVal, err := key.Bool()
|
boolVal, err := key.Bool()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapStrictError(err, isStrict)
|
return wrapStrictError(err, isStrict)
|
||||||
}
|
}
|
||||||
field.SetBool(boolVal)
|
if isPtr {
|
||||||
|
field.Set(reflect.ValueOf(&boolVal))
|
||||||
|
} else {
|
||||||
|
field.SetBool(boolVal)
|
||||||
|
}
|
||||||
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64:
|
||||||
durationVal, err := key.Duration()
|
// ParseDuration will not return err for `0`, so check the type name
|
||||||
// Skip zero value
|
if vt.Name() == "Duration" {
|
||||||
if err == nil && int64(durationVal) > 0 {
|
durationVal, err := key.Duration()
|
||||||
field.Set(reflect.ValueOf(durationVal))
|
if err != nil {
|
||||||
|
if intVal, err := key.Int64(); err == nil {
|
||||||
|
field.SetInt(intVal)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
return wrapStrictError(err, isStrict)
|
||||||
|
}
|
||||||
|
if isPtr {
|
||||||
|
field.Set(reflect.ValueOf(&durationVal))
|
||||||
|
} else if int64(durationVal) > 0 {
|
||||||
|
field.Set(reflect.ValueOf(durationVal))
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -179,13 +201,23 @@ func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim stri
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapStrictError(err, isStrict)
|
return wrapStrictError(err, isStrict)
|
||||||
}
|
}
|
||||||
field.SetInt(intVal)
|
if isPtr {
|
||||||
|
pv := reflect.New(t.Elem())
|
||||||
|
pv.Elem().SetInt(intVal)
|
||||||
|
field.Set(pv)
|
||||||
|
} else {
|
||||||
|
field.SetInt(intVal)
|
||||||
|
}
|
||||||
// byte is an alias for uint8, so supporting uint8 breaks support for byte
|
// byte is an alias for uint8, so supporting uint8 breaks support for byte
|
||||||
case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
case reflect.Uint, reflect.Uint16, reflect.Uint32, reflect.Uint64:
|
||||||
durationVal, err := key.Duration()
|
durationVal, err := key.Duration()
|
||||||
// Skip zero value
|
// Skip zero value
|
||||||
if err == nil && uint64(durationVal) > 0 {
|
if err == nil && uint64(durationVal) > 0 {
|
||||||
field.Set(reflect.ValueOf(durationVal))
|
if isPtr {
|
||||||
|
field.Set(reflect.ValueOf(&durationVal))
|
||||||
|
} else {
|
||||||
|
field.Set(reflect.ValueOf(durationVal))
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -193,33 +225,38 @@ func setWithProperType(t reflect.Type, key *Key, field reflect.Value, delim stri
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapStrictError(err, isStrict)
|
return wrapStrictError(err, isStrict)
|
||||||
}
|
}
|
||||||
field.SetUint(uintVal)
|
if isPtr {
|
||||||
|
pv := reflect.New(t.Elem())
|
||||||
|
pv.Elem().SetUint(uintVal)
|
||||||
|
field.Set(pv)
|
||||||
|
} else {
|
||||||
|
field.SetUint(uintVal)
|
||||||
|
}
|
||||||
|
|
||||||
case reflect.Float32, reflect.Float64:
|
case reflect.Float32, reflect.Float64:
|
||||||
floatVal, err := key.Float64()
|
floatVal, err := key.Float64()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapStrictError(err, isStrict)
|
return wrapStrictError(err, isStrict)
|
||||||
}
|
}
|
||||||
field.SetFloat(floatVal)
|
if isPtr {
|
||||||
|
pv := reflect.New(t.Elem())
|
||||||
|
pv.Elem().SetFloat(floatVal)
|
||||||
|
field.Set(pv)
|
||||||
|
} else {
|
||||||
|
field.SetFloat(floatVal)
|
||||||
|
}
|
||||||
case reflectTime:
|
case reflectTime:
|
||||||
timeVal, err := key.Time()
|
timeVal, err := key.Time()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return wrapStrictError(err, isStrict)
|
return wrapStrictError(err, isStrict)
|
||||||
}
|
}
|
||||||
field.Set(reflect.ValueOf(timeVal))
|
if isPtr {
|
||||||
|
field.Set(reflect.ValueOf(&timeVal))
|
||||||
|
} else {
|
||||||
|
field.Set(reflect.ValueOf(timeVal))
|
||||||
|
}
|
||||||
case reflect.Slice:
|
case reflect.Slice:
|
||||||
return setSliceWithProperType(key, field, delim, allowShadow, isStrict)
|
return setSliceWithProperType(key, field, delim, allowShadow, isStrict)
|
||||||
case reflect.Ptr:
|
|
||||||
switch t.Elem().Kind() {
|
|
||||||
case reflect.Bool:
|
|
||||||
boolVal, err := key.Bool()
|
|
||||||
if err != nil {
|
|
||||||
return wrapStrictError(err, isStrict)
|
|
||||||
}
|
|
||||||
field.Set(reflect.ValueOf(&boolVal))
|
|
||||||
default:
|
|
||||||
return fmt.Errorf("unsupported type '%s'", t)
|
|
||||||
}
|
|
||||||
default:
|
default:
|
||||||
return fmt.Errorf("unsupported type '%s'", t)
|
return fmt.Errorf("unsupported type '%s'", t)
|
||||||
}
|
}
|
||||||
@ -280,7 +317,6 @@ func (s *Section) mapTo(val reflect.Value, isStrict bool) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if key, err := s.GetKey(fieldName); err == nil {
|
if key, err := s.GetKey(fieldName); err == nil {
|
||||||
delim := parseDelim(tpField.Tag.Get("delim"))
|
delim := parseDelim(tpField.Tag.Get("delim"))
|
||||||
if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil {
|
if err = setWithProperType(tpField.Type, key, field, delim, allowShadow, isStrict); err != nil {
|
||||||
|
6
vendor/modules.txt
vendored
6
vendor/modules.txt
vendored
@ -20,7 +20,7 @@ gitea.com/macaron/gzip
|
|||||||
gitea.com/macaron/i18n
|
gitea.com/macaron/i18n
|
||||||
# gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
|
# gitea.com/macaron/inject v0.0.0-20190805023432-d4c86e31027a
|
||||||
gitea.com/macaron/inject
|
gitea.com/macaron/inject
|
||||||
# gitea.com/macaron/macaron v1.3.3-0.20190821202302-9646c0587edb
|
# gitea.com/macaron/macaron v1.4.0
|
||||||
gitea.com/macaron/macaron
|
gitea.com/macaron/macaron
|
||||||
# gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705
|
# gitea.com/macaron/session v0.0.0-20190821211443-122c47c5f705
|
||||||
gitea.com/macaron/session
|
gitea.com/macaron/session
|
||||||
@ -414,7 +414,7 @@ github.com/tstranex/u2f
|
|||||||
# github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1
|
# github.com/unknwon/cae v0.0.0-20190822084630-55a0b64484a1
|
||||||
github.com/unknwon/cae
|
github.com/unknwon/cae
|
||||||
github.com/unknwon/cae/zip
|
github.com/unknwon/cae/zip
|
||||||
# github.com/unknwon/com v0.0.0-20190804042917-757f69c95f3e
|
# github.com/unknwon/com v1.0.1
|
||||||
github.com/unknwon/com
|
github.com/unknwon/com
|
||||||
# github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6
|
# github.com/unknwon/i18n v0.0.0-20190805065654-5c6446a380b6
|
||||||
github.com/unknwon/i18n
|
github.com/unknwon/i18n
|
||||||
@ -547,7 +547,7 @@ gopkg.in/alexcesaro/quotedprintable.v3
|
|||||||
gopkg.in/asn1-ber.v1
|
gopkg.in/asn1-ber.v1
|
||||||
# gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
# gopkg.in/gomail.v2 v2.0.0-20160411212932-81ebce5c23df
|
||||||
gopkg.in/gomail.v2
|
gopkg.in/gomail.v2
|
||||||
# gopkg.in/ini.v1 v1.48.0
|
# gopkg.in/ini.v1 v1.51.1
|
||||||
gopkg.in/ini.v1
|
gopkg.in/ini.v1
|
||||||
# gopkg.in/ldap.v3 v3.0.2
|
# gopkg.in/ldap.v3 v3.0.2
|
||||||
gopkg.in/ldap.v3
|
gopkg.in/ldap.v3
|
||||||
|
@ -2271,7 +2271,7 @@ function initTemplateSearch() {
|
|||||||
const checkTemplate = function () {
|
const checkTemplate = function () {
|
||||||
const $templateUnits = $('#template_units');
|
const $templateUnits = $('#template_units');
|
||||||
const $nonTemplate = $('#non_template');
|
const $nonTemplate = $('#non_template');
|
||||||
if ($repoTemplate.val() !== '') {
|
if ($repoTemplate.val() !== '' && $repoTemplate.val() !== '0') {
|
||||||
$templateUnits.show();
|
$templateUnits.show();
|
||||||
$nonTemplate.hide();
|
$nonTemplate.hide();
|
||||||
} else {
|
} else {
|
||||||
|
@ -1178,3 +1178,9 @@ i.icon.centerlock {
|
|||||||
box-shadow: inset 0 0 0 1px #1678c2 !important;
|
box-shadow: inset 0 0 0 1px #1678c2 !important;
|
||||||
color: #1678c2 !important;
|
color: #1678c2 !important;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ui.label > img {
|
||||||
|
width: auto !important;
|
||||||
|
vertical-align: middle;
|
||||||
|
height: 2.1666em !important;
|
||||||
|
}
|
||||||
|
@ -850,6 +850,14 @@
|
|||||||
box-shadow: 0 0 10px #8c8c8c;
|
box-shadow: 0 0 10px #8c8c8c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:target > .content > .code-comment-content {
|
||||||
|
padding: 4px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&:target > .content > .code-comment-content > .text {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|
||||||
.ui.form {
|
.ui.form {
|
||||||
.field:first-child {
|
.field:first-child {
|
||||||
clear: none;
|
clear: none;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user