mirror of
https://github.com/go-gitea/gitea.git
synced 2025-08-13 00:03:31 -04:00
Compare commits
11 Commits
05209f0d1d
...
97b70a0cd4
Author | SHA1 | Date | |
---|---|---|---|
|
97b70a0cd4 | ||
|
4daf40505a | ||
|
46679554d0 | ||
|
95e2e3aa30 | ||
|
ef92459e18 | ||
|
db582d97ef | ||
|
bc888e5f92 | ||
|
291c868046 | ||
|
e5a8ebc0ed | ||
|
0ebabf3c6b | ||
|
0deb5053bd |
5
.github/workflows/pull-compliance.yml
vendored
5
.github/workflows/pull-compliance.yml
vendored
@ -16,6 +16,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
run: make deps-backend deps-tools
|
run: make deps-backend deps-tools
|
||||||
- name: lint backend
|
- name: lint backend
|
||||||
@ -33,6 +34,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
run: make deps-backend deps-tools
|
run: make deps-backend deps-tools
|
||||||
- name: lint-backend-windows
|
- name: lint-backend-windows
|
||||||
@ -52,6 +54,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
run: make deps-backend deps-tools
|
run: make deps-backend deps-tools
|
||||||
- name: lint-backend-gogit
|
- name: lint-backend-gogit
|
||||||
@ -71,6 +74,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: deps-backend
|
- name: deps-backend
|
||||||
run: make deps-backend deps-tools
|
run: make deps-backend deps-tools
|
||||||
- name: checks backend
|
- name: checks backend
|
||||||
@ -101,6 +105,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
1
.github/workflows/pull-e2e.yml
vendored
1
.github/workflows/pull-e2e.yml
vendored
@ -16,6 +16,7 @@ jobs:
|
|||||||
uses: actions/setup-go@v4
|
uses: actions/setup-go@v4
|
||||||
with:
|
with:
|
||||||
go-version: '>=1.20'
|
go-version: '>=1.20'
|
||||||
|
check-latest: true
|
||||||
- name: setup node
|
- name: setup node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
|
@ -110,7 +110,7 @@ Translations are done through Crowdin. If you want to translate to a new languag
|
|||||||
|
|
||||||
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
|
You can also just create an issue for adding a language or ask on discord on the #translation channel. If you need context or find some translation issues, you can leave a comment on the string or ask on Discord. For general translation questions there is a section in the docs. Currently a bit empty but we hope to fill it as questions pop up.
|
||||||
|
|
||||||
https://docs.gitea.io/en-us/translation-guidelines/
|
https://docs.gitea.io/en-us/contributing/translation-guidelines/
|
||||||
|
|
||||||
[](https://crowdin.com/project/gitea)
|
[](https://crowdin.com/project/gitea)
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ dnf config-manager --add-repo https://gitea.example.com/api/packages/{owner}/rpm
|
|||||||
| ----------- | ----------- |
|
| ----------- | ----------- |
|
||||||
| `owner` | The owner of the package. |
|
| `owner` | The owner of the package. |
|
||||||
|
|
||||||
If the registry is private, provide credentials in the url. You can use a password or a [personal access token]({{< relref "doc/developers/api-usage.en-us.md#authentication" >}}):
|
If the registry is private, provide credentials in the url. You can use a password or a [personal access token]({{< relref "doc/development/api-usage.en-us.md#authentication" >}}):
|
||||||
|
|
||||||
```shell
|
```shell
|
||||||
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm.repo
|
dnf config-manager --add-repo https://{username}:{your_password_or_token}@gitea.example.com/api/packages/{owner}/rpm.repo
|
||||||
@ -66,7 +66,7 @@ curl --user your_username:your_password_or_token \
|
|||||||
https://gitea.example.com/api/packages/testuser/rpm/upload
|
https://gitea.example.com/api/packages/testuser/rpm/upload
|
||||||
```
|
```
|
||||||
|
|
||||||
If you are using 2FA or OAuth use a [personal access token]({{< relref "doc/developers/api-usage.en-us.md#authentication" >}}) instead of the password.
|
If you are using 2FA or OAuth use a [personal access token]({{< relref "doc/development/api-usage.en-us.md#authentication" >}}) instead of the password.
|
||||||
You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
|
You cannot publish a file with the same name twice to a package. You must delete the existing package version first.
|
||||||
|
|
||||||
The server reponds with the following HTTP Status codes.
|
The server reponds with the following HTTP Status codes.
|
||||||
|
@ -40,7 +40,9 @@ var ItemsPerPage = 40
|
|||||||
|
|
||||||
// Init initialize model
|
// Init initialize model
|
||||||
func Init(ctx context.Context) error {
|
func Init(ctx context.Context) error {
|
||||||
unit.LoadUnitConfig()
|
if err := unit.LoadUnitConfig(); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
return system_model.Init(ctx)
|
return system_model.Init(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
package unit
|
package unit
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
@ -106,12 +107,6 @@ var (
|
|||||||
TypeExternalTracker,
|
TypeExternalTracker,
|
||||||
}
|
}
|
||||||
|
|
||||||
// MustRepoUnits contains the units could not be disabled currently
|
|
||||||
MustRepoUnits = []Type{
|
|
||||||
TypeCode,
|
|
||||||
TypeReleases,
|
|
||||||
}
|
|
||||||
|
|
||||||
// DisabledRepoUnits contains the units that have been globally disabled
|
// DisabledRepoUnits contains the units that have been globally disabled
|
||||||
DisabledRepoUnits = []Type{}
|
DisabledRepoUnits = []Type{}
|
||||||
)
|
)
|
||||||
@ -122,20 +117,15 @@ func validateDefaultRepoUnits(defaultUnits, settingDefaultUnits []Type) []Type {
|
|||||||
|
|
||||||
// Use setting if not empty
|
// Use setting if not empty
|
||||||
if len(settingDefaultUnits) > 0 {
|
if len(settingDefaultUnits) > 0 {
|
||||||
// MustRepoUnits required as default
|
units = make([]Type, 0, len(settingDefaultUnits))
|
||||||
units = make([]Type, len(MustRepoUnits))
|
|
||||||
copy(units, MustRepoUnits)
|
|
||||||
for _, settingUnit := range settingDefaultUnits {
|
for _, settingUnit := range settingDefaultUnits {
|
||||||
if !settingUnit.CanBeDefault() {
|
if !settingUnit.CanBeDefault() {
|
||||||
log.Warn("Not allowed as default unit: %s", settingUnit.String())
|
log.Warn("Not allowed as default unit: %s", settingUnit.String())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
// MustRepoUnits already added
|
|
||||||
if settingUnit.CanDisable() {
|
|
||||||
units = append(units, settingUnit)
|
units = append(units, settingUnit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// Remove disabled units
|
// Remove disabled units
|
||||||
for _, disabledUnit := range DisabledRepoUnits {
|
for _, disabledUnit := range DisabledRepoUnits {
|
||||||
@ -150,30 +140,30 @@ func validateDefaultRepoUnits(defaultUnits, settingDefaultUnits []Type) []Type {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// LoadUnitConfig load units from settings
|
// LoadUnitConfig load units from settings
|
||||||
func LoadUnitConfig() {
|
func LoadUnitConfig() error {
|
||||||
var invalidKeys []string
|
var invalidKeys []string
|
||||||
DisabledRepoUnits, invalidKeys = FindUnitTypes(setting.Repository.DisabledRepoUnits...)
|
DisabledRepoUnits, invalidKeys = FindUnitTypes(setting.Repository.DisabledRepoUnits...)
|
||||||
if len(invalidKeys) > 0 {
|
if len(invalidKeys) > 0 {
|
||||||
log.Warn("Invalid keys in disabled repo units: %s", strings.Join(invalidKeys, ", "))
|
log.Warn("Invalid keys in disabled repo units: %s", strings.Join(invalidKeys, ", "))
|
||||||
}
|
}
|
||||||
// Check that must units are not disabled
|
|
||||||
for i, disabledU := range DisabledRepoUnits {
|
|
||||||
if !disabledU.CanDisable() {
|
|
||||||
log.Warn("Not allowed to global disable unit %s", disabledU.String())
|
|
||||||
DisabledRepoUnits = append(DisabledRepoUnits[:i], DisabledRepoUnits[i+1:]...)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
setDefaultRepoUnits, invalidKeys := FindUnitTypes(setting.Repository.DefaultRepoUnits...)
|
setDefaultRepoUnits, invalidKeys := FindUnitTypes(setting.Repository.DefaultRepoUnits...)
|
||||||
if len(invalidKeys) > 0 {
|
if len(invalidKeys) > 0 {
|
||||||
log.Warn("Invalid keys in default repo units: %s", strings.Join(invalidKeys, ", "))
|
log.Warn("Invalid keys in default repo units: %s", strings.Join(invalidKeys, ", "))
|
||||||
}
|
}
|
||||||
DefaultRepoUnits = validateDefaultRepoUnits(DefaultRepoUnits, setDefaultRepoUnits)
|
DefaultRepoUnits = validateDefaultRepoUnits(DefaultRepoUnits, setDefaultRepoUnits)
|
||||||
|
if len(DefaultRepoUnits) == 0 {
|
||||||
|
return errors.New("no default repository units found")
|
||||||
|
}
|
||||||
setDefaultForkRepoUnits, invalidKeys := FindUnitTypes(setting.Repository.DefaultForkRepoUnits...)
|
setDefaultForkRepoUnits, invalidKeys := FindUnitTypes(setting.Repository.DefaultForkRepoUnits...)
|
||||||
if len(invalidKeys) > 0 {
|
if len(invalidKeys) > 0 {
|
||||||
log.Warn("Invalid keys in default fork repo units: %s", strings.Join(invalidKeys, ", "))
|
log.Warn("Invalid keys in default fork repo units: %s", strings.Join(invalidKeys, ", "))
|
||||||
}
|
}
|
||||||
DefaultForkRepoUnits = validateDefaultRepoUnits(DefaultForkRepoUnits, setDefaultForkRepoUnits)
|
DefaultForkRepoUnits = validateDefaultRepoUnits(DefaultForkRepoUnits, setDefaultForkRepoUnits)
|
||||||
|
if len(DefaultForkRepoUnits) == 0 {
|
||||||
|
return errors.New("no default fork repository units found")
|
||||||
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// UnitGlobalDisabled checks if unit type is global disabled
|
// UnitGlobalDisabled checks if unit type is global disabled
|
||||||
@ -186,16 +176,6 @@ func (u Type) UnitGlobalDisabled() bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanDisable checks if this unit type can be disabled.
|
|
||||||
func (u *Type) CanDisable() bool {
|
|
||||||
for _, mu := range MustRepoUnits {
|
|
||||||
if *u == mu {
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
// CanBeDefault checks if the unit type can be a default repo unit
|
// CanBeDefault checks if the unit type can be a default repo unit
|
||||||
func (u *Type) CanBeDefault() bool {
|
func (u *Type) CanBeDefault() bool {
|
||||||
for _, nadU := range NotAllowedDefaultRepoUnits {
|
for _, nadU := range NotAllowedDefaultRepoUnits {
|
||||||
@ -216,11 +196,6 @@ type Unit struct {
|
|||||||
MaxAccessMode perm.AccessMode // The max access mode of the unit. i.e. Read means this unit can only be read.
|
MaxAccessMode perm.AccessMode // The max access mode of the unit. i.e. Read means this unit can only be read.
|
||||||
}
|
}
|
||||||
|
|
||||||
// CanDisable returns if this unit could be disabled.
|
|
||||||
func (u *Unit) CanDisable() bool {
|
|
||||||
return u.Type.CanDisable()
|
|
||||||
}
|
|
||||||
|
|
||||||
// IsLessThan compares order of two units
|
// IsLessThan compares order of two units
|
||||||
func (u Unit) IsLessThan(unit Unit) bool {
|
func (u Unit) IsLessThan(unit Unit) bool {
|
||||||
if (u.Type == TypeExternalTracker || u.Type == TypeExternalWiki) && unit.Type != TypeExternalTracker && unit.Type != TypeExternalWiki {
|
if (u.Type == TypeExternalTracker || u.Type == TypeExternalWiki) && unit.Type != TypeExternalTracker && unit.Type != TypeExternalWiki {
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestLoadUnitConfig(t *testing.T) {
|
func TestLoadUnitConfig(t *testing.T) {
|
||||||
|
t.Run("regular", func(t *testing.T) {
|
||||||
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []Type) {
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []Type) {
|
||||||
DisabledRepoUnits = disabledRepoUnits
|
DisabledRepoUnits = disabledRepoUnits
|
||||||
DefaultRepoUnits = defaultRepoUnits
|
DefaultRepoUnits = defaultRepoUnits
|
||||||
@ -23,31 +24,72 @@ func TestLoadUnitConfig(t *testing.T) {
|
|||||||
setting.Repository.DefaultForkRepoUnits = defaultForkRepoUnits
|
setting.Repository.DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
}(setting.Repository.DisabledRepoUnits, setting.Repository.DefaultRepoUnits, setting.Repository.DefaultForkRepoUnits)
|
}(setting.Repository.DisabledRepoUnits, setting.Repository.DefaultRepoUnits, setting.Repository.DefaultForkRepoUnits)
|
||||||
|
|
||||||
t.Run("regular", func(t *testing.T) {
|
|
||||||
setting.Repository.DisabledRepoUnits = []string{"repo.issues"}
|
setting.Repository.DisabledRepoUnits = []string{"repo.issues"}
|
||||||
setting.Repository.DefaultRepoUnits = []string{"repo.code", "repo.releases", "repo.issues", "repo.pulls"}
|
setting.Repository.DefaultRepoUnits = []string{"repo.code", "repo.releases", "repo.issues", "repo.pulls"}
|
||||||
setting.Repository.DefaultForkRepoUnits = []string{"repo.releases"}
|
setting.Repository.DefaultForkRepoUnits = []string{"repo.releases"}
|
||||||
LoadUnitConfig()
|
assert.NoError(t, LoadUnitConfig())
|
||||||
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases}, DefaultForkRepoUnits)
|
assert.Equal(t, []Type{TypeReleases}, DefaultForkRepoUnits)
|
||||||
})
|
})
|
||||||
t.Run("invalid", func(t *testing.T) {
|
t.Run("invalid", func(t *testing.T) {
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []Type) {
|
||||||
|
DisabledRepoUnits = disabledRepoUnits
|
||||||
|
DefaultRepoUnits = defaultRepoUnits
|
||||||
|
DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(DisabledRepoUnits, DefaultRepoUnits, DefaultForkRepoUnits)
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []string) {
|
||||||
|
setting.Repository.DisabledRepoUnits = disabledRepoUnits
|
||||||
|
setting.Repository.DefaultRepoUnits = defaultRepoUnits
|
||||||
|
setting.Repository.DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(setting.Repository.DisabledRepoUnits, setting.Repository.DefaultRepoUnits, setting.Repository.DefaultForkRepoUnits)
|
||||||
|
|
||||||
setting.Repository.DisabledRepoUnits = []string{"repo.issues", "invalid.1"}
|
setting.Repository.DisabledRepoUnits = []string{"repo.issues", "invalid.1"}
|
||||||
setting.Repository.DefaultRepoUnits = []string{"repo.code", "invalid.2", "repo.releases", "repo.issues", "repo.pulls"}
|
setting.Repository.DefaultRepoUnits = []string{"repo.code", "invalid.2", "repo.releases", "repo.issues", "repo.pulls"}
|
||||||
setting.Repository.DefaultForkRepoUnits = []string{"invalid.3", "repo.releases"}
|
setting.Repository.DefaultForkRepoUnits = []string{"invalid.3", "repo.releases"}
|
||||||
LoadUnitConfig()
|
assert.NoError(t, LoadUnitConfig())
|
||||||
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases}, DefaultForkRepoUnits)
|
assert.Equal(t, []Type{TypeReleases}, DefaultForkRepoUnits)
|
||||||
})
|
})
|
||||||
t.Run("duplicate", func(t *testing.T) {
|
t.Run("duplicate", func(t *testing.T) {
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []Type) {
|
||||||
|
DisabledRepoUnits = disabledRepoUnits
|
||||||
|
DefaultRepoUnits = defaultRepoUnits
|
||||||
|
DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(DisabledRepoUnits, DefaultRepoUnits, DefaultForkRepoUnits)
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []string) {
|
||||||
|
setting.Repository.DisabledRepoUnits = disabledRepoUnits
|
||||||
|
setting.Repository.DefaultRepoUnits = defaultRepoUnits
|
||||||
|
setting.Repository.DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(setting.Repository.DisabledRepoUnits, setting.Repository.DefaultRepoUnits, setting.Repository.DefaultForkRepoUnits)
|
||||||
|
|
||||||
setting.Repository.DisabledRepoUnits = []string{"repo.issues", "repo.issues"}
|
setting.Repository.DisabledRepoUnits = []string{"repo.issues", "repo.issues"}
|
||||||
setting.Repository.DefaultRepoUnits = []string{"repo.code", "repo.releases", "repo.issues", "repo.pulls", "repo.code"}
|
setting.Repository.DefaultRepoUnits = []string{"repo.code", "repo.releases", "repo.issues", "repo.pulls", "repo.code"}
|
||||||
setting.Repository.DefaultForkRepoUnits = []string{"repo.releases", "repo.releases"}
|
setting.Repository.DefaultForkRepoUnits = []string{"repo.releases", "repo.releases"}
|
||||||
LoadUnitConfig()
|
assert.NoError(t, LoadUnitConfig())
|
||||||
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
assert.Equal(t, []Type{TypeCode, TypeReleases, TypePullRequests}, DefaultRepoUnits)
|
||||||
assert.Equal(t, []Type{TypeCode, TypeReleases}, DefaultForkRepoUnits)
|
assert.Equal(t, []Type{TypeReleases}, DefaultForkRepoUnits)
|
||||||
|
})
|
||||||
|
t.Run("empty_default", func(t *testing.T) {
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []Type) {
|
||||||
|
DisabledRepoUnits = disabledRepoUnits
|
||||||
|
DefaultRepoUnits = defaultRepoUnits
|
||||||
|
DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(DisabledRepoUnits, DefaultRepoUnits, DefaultForkRepoUnits)
|
||||||
|
defer func(disabledRepoUnits, defaultRepoUnits, defaultForkRepoUnits []string) {
|
||||||
|
setting.Repository.DisabledRepoUnits = disabledRepoUnits
|
||||||
|
setting.Repository.DefaultRepoUnits = defaultRepoUnits
|
||||||
|
setting.Repository.DefaultForkRepoUnits = defaultForkRepoUnits
|
||||||
|
}(setting.Repository.DisabledRepoUnits, setting.Repository.DefaultRepoUnits, setting.Repository.DefaultForkRepoUnits)
|
||||||
|
|
||||||
|
setting.Repository.DisabledRepoUnits = []string{"repo.issues", "repo.issues"}
|
||||||
|
setting.Repository.DefaultRepoUnits = []string{}
|
||||||
|
setting.Repository.DefaultForkRepoUnits = []string{"repo.releases", "repo.releases"}
|
||||||
|
assert.NoError(t, LoadUnitConfig())
|
||||||
|
assert.Equal(t, []Type{TypeIssues}, DisabledRepoUnits)
|
||||||
|
assert.ElementsMatch(t, []Type{TypeCode, TypePullRequests, TypeReleases, TypeWiki, TypePackages, TypeProjects}, DefaultRepoUnits)
|
||||||
|
assert.Equal(t, []Type{TypeReleases}, DefaultForkRepoUnits)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
@ -65,3 +65,8 @@ func (ctx *Context) FormOptionalBool(key string) util.OptionalBool {
|
|||||||
v = v || strings.EqualFold(s, "on")
|
v = v || strings.EqualFold(s, "on")
|
||||||
return util.OptionalBoolOf(v)
|
return util.OptionalBoolOf(v)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (ctx *Context) SetFormString(key, value string) {
|
||||||
|
_ = ctx.Req.FormValue(key) // force parse form
|
||||||
|
ctx.Req.Form.Set(key, value)
|
||||||
|
}
|
||||||
|
@ -559,7 +559,7 @@ target_branch_not_exist = Target branch does not exist.
|
|||||||
|
|
||||||
[user]
|
[user]
|
||||||
change_avatar = Change your avatar…
|
change_avatar = Change your avatar…
|
||||||
join_on = Joined on
|
joined_on = Joined on %s
|
||||||
repositories = Repositories
|
repositories = Repositories
|
||||||
activity = Public Activity
|
activity = Public Activity
|
||||||
followers = Followers
|
followers = Followers
|
||||||
@ -754,8 +754,8 @@ ssh_principal_deletion_desc = Removing a SSH Certificate Principal revokes its a
|
|||||||
ssh_key_deletion_success = The SSH key has been removed.
|
ssh_key_deletion_success = The SSH key has been removed.
|
||||||
gpg_key_deletion_success = The GPG key has been removed.
|
gpg_key_deletion_success = The GPG key has been removed.
|
||||||
ssh_principal_deletion_success = The principal has been removed.
|
ssh_principal_deletion_success = The principal has been removed.
|
||||||
add_on = Added on
|
added_on = Added on %s
|
||||||
valid_until = Valid until
|
valid_until_date = Valid until %s
|
||||||
valid_forever = Valid forever
|
valid_forever = Valid forever
|
||||||
last_used = Last used on
|
last_used = Last used on
|
||||||
no_activity = No recent activity
|
no_activity = No recent activity
|
||||||
@ -2004,6 +2004,7 @@ settings.delete_notices_2 = - This operation will permanently delete the <strong
|
|||||||
settings.delete_notices_fork_1 = - Forks of this repository will become independent after deletion.
|
settings.delete_notices_fork_1 = - Forks of this repository will become independent after deletion.
|
||||||
settings.deletion_success = The repository has been deleted.
|
settings.deletion_success = The repository has been deleted.
|
||||||
settings.update_settings_success = The repository settings have been updated.
|
settings.update_settings_success = The repository settings have been updated.
|
||||||
|
settings.update_settings_no_unit = The repository should allow at least some sort of interaction.
|
||||||
settings.confirm_delete = Delete Repository
|
settings.confirm_delete = Delete Repository
|
||||||
settings.add_collaborator = Add Collaborator
|
settings.add_collaborator = Add Collaborator
|
||||||
settings.add_collaborator_success = The collaborator has been added.
|
settings.add_collaborator_success = The collaborator has been added.
|
||||||
|
@ -970,10 +970,12 @@ func updateRepoUnits(ctx *context.APIContext, opts api.EditRepoOption) error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(units)+len(deleteUnitTypes) > 0 {
|
||||||
if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
|
if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
|
||||||
ctx.Error(http.StatusInternalServerError, "UpdateRepositoryUnits", err)
|
ctx.Error(http.StatusInternalServerError, "UpdateRepositoryUnits", err)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
log.Trace("Repository advanced settings updated: %s/%s", owner.Name, repo.Name)
|
log.Trace("Repository advanced settings updated: %s/%s", owner.Name, repo.Name)
|
||||||
return nil
|
return nil
|
||||||
|
@ -23,6 +23,10 @@ func Organizations(ctx *context.Context) {
|
|||||||
ctx.Data["Title"] = ctx.Tr("admin.organizations")
|
ctx.Data["Title"] = ctx.Tr("admin.organizations")
|
||||||
ctx.Data["PageIsAdminOrganizations"] = true
|
ctx.Data["PageIsAdminOrganizations"] = true
|
||||||
|
|
||||||
|
if ctx.FormString("sort") == "" {
|
||||||
|
ctx.SetFormString("sort", explore.UserSearchDefaultAdminSort)
|
||||||
|
}
|
||||||
|
|
||||||
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
explore.RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
||||||
Actor: ctx.Doer,
|
Actor: ctx.Doer,
|
||||||
Type: user_model.UserTypeOrganization,
|
Type: user_model.UserTypeOrganization,
|
||||||
|
@ -53,7 +53,8 @@ func Users(ctx *context.Context) {
|
|||||||
|
|
||||||
sortType := ctx.FormString("sort")
|
sortType := ctx.FormString("sort")
|
||||||
if sortType == "" {
|
if sortType == "" {
|
||||||
sortType = explore.UserSearchDefaultSortType
|
sortType = explore.UserSearchDefaultAdminSort
|
||||||
|
ctx.SetFormString("sort", sortType)
|
||||||
}
|
}
|
||||||
ctx.PageData["adminUserListSearchForm"] = map[string]interface{}{
|
ctx.PageData["adminUserListSearchForm"] = map[string]interface{}{
|
||||||
"StatusFilterMap": statusFilterMap,
|
"StatusFilterMap": statusFilterMap,
|
||||||
|
@ -30,6 +30,10 @@ func Organizations(ctx *context.Context) {
|
|||||||
visibleTypes = append(visibleTypes, structs.VisibleTypeLimited, structs.VisibleTypePrivate)
|
visibleTypes = append(visibleTypes, structs.VisibleTypeLimited, structs.VisibleTypePrivate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ctx.FormString("sort") == "" {
|
||||||
|
ctx.SetFormString("sort", UserSearchDefaultSortType)
|
||||||
|
}
|
||||||
|
|
||||||
RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
||||||
Actor: ctx.Doer,
|
Actor: ctx.Doer,
|
||||||
Type: user_model.UserTypeOrganization,
|
Type: user_model.UserTypeOrganization,
|
||||||
|
@ -24,7 +24,10 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
// UserSearchDefaultSortType is the default sort type for user search
|
// UserSearchDefaultSortType is the default sort type for user search
|
||||||
const UserSearchDefaultSortType = "alphabetically"
|
const (
|
||||||
|
UserSearchDefaultSortType = "recentupdate"
|
||||||
|
UserSearchDefaultAdminSort = "alphabetically"
|
||||||
|
)
|
||||||
|
|
||||||
var nullByte = []byte{0x00}
|
var nullByte = []byte{0x00}
|
||||||
|
|
||||||
@ -56,14 +59,13 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
|
|||||||
)
|
)
|
||||||
|
|
||||||
// we can not set orderBy to `models.SearchOrderByXxx`, because there may be a JOIN in the statement, different tables may have the same name columns
|
// we can not set orderBy to `models.SearchOrderByXxx`, because there may be a JOIN in the statement, different tables may have the same name columns
|
||||||
|
|
||||||
ctx.Data["SortType"] = ctx.FormString("sort")
|
ctx.Data["SortType"] = ctx.FormString("sort")
|
||||||
switch ctx.FormString("sort") {
|
switch ctx.FormString("sort") {
|
||||||
case "newest":
|
case "newest":
|
||||||
orderBy = "`user`.id DESC"
|
orderBy = "`user`.id DESC"
|
||||||
case "oldest":
|
case "oldest":
|
||||||
orderBy = "`user`.id ASC"
|
orderBy = "`user`.id ASC"
|
||||||
case "recentupdate":
|
|
||||||
orderBy = "`user`.updated_unix DESC"
|
|
||||||
case "leastupdate":
|
case "leastupdate":
|
||||||
orderBy = "`user`.updated_unix ASC"
|
orderBy = "`user`.updated_unix ASC"
|
||||||
case "reversealphabetically":
|
case "reversealphabetically":
|
||||||
@ -72,10 +74,14 @@ func RenderUserSearch(ctx *context.Context, opts *user_model.SearchUserOptions,
|
|||||||
orderBy = "`user`.last_login_unix ASC"
|
orderBy = "`user`.last_login_unix ASC"
|
||||||
case "reverselastlogin":
|
case "reverselastlogin":
|
||||||
orderBy = "`user`.last_login_unix DESC"
|
orderBy = "`user`.last_login_unix DESC"
|
||||||
case UserSearchDefaultSortType: // "alphabetically"
|
case "alphabetically":
|
||||||
default:
|
|
||||||
orderBy = "`user`.name ASC"
|
orderBy = "`user`.name ASC"
|
||||||
ctx.Data["SortType"] = UserSearchDefaultSortType
|
case "recentupdate":
|
||||||
|
fallthrough
|
||||||
|
default:
|
||||||
|
// in case the sortType is not valid, we set it to recentupdate
|
||||||
|
ctx.Data["SortType"] = "recentupdate"
|
||||||
|
orderBy = "`user`.updated_unix DESC"
|
||||||
}
|
}
|
||||||
|
|
||||||
opts.Keyword = ctx.FormTrim("q")
|
opts.Keyword = ctx.FormTrim("q")
|
||||||
@ -127,6 +133,10 @@ func Users(ctx *context.Context) {
|
|||||||
ctx.Data["PageIsExploreUsers"] = true
|
ctx.Data["PageIsExploreUsers"] = true
|
||||||
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
|
ctx.Data["IsRepoIndexerEnabled"] = setting.Indexer.RepoIndexerEnabled
|
||||||
|
|
||||||
|
if ctx.FormString("sort") == "" {
|
||||||
|
ctx.SetFormString("sort", UserSearchDefaultSortType)
|
||||||
|
}
|
||||||
|
|
||||||
RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
RenderUserSearch(ctx, &user_model.SearchUserOptions{
|
||||||
Actor: ctx.Doer,
|
Actor: ctx.Doer,
|
||||||
Type: user_model.UserTypeIndividual,
|
Type: user_model.UserTypeIndividual,
|
||||||
|
@ -536,6 +536,12 @@ func SettingsPost(ctx *context.Context) {
|
|||||||
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
|
deleteUnitTypes = append(deleteUnitTypes, unit_model.TypePullRequests)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if len(units) == 0 {
|
||||||
|
ctx.Flash.Error(ctx.Tr("repo.settings.update_settings_no_unit"))
|
||||||
|
ctx.Redirect(ctx.Repo.RepoLink + "/settings")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
|
if err := repo_model.UpdateRepositoryUnits(repo, units, deleteUnitTypes); err != nil {
|
||||||
ctx.ServerError("UpdateRepositoryUnits", err)
|
ctx.ServerError("UpdateRepositoryUnits", err)
|
||||||
return
|
return
|
||||||
|
@ -261,6 +261,27 @@ func registerRoutes(m *web.Route) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
reqUnitAccess := func(unitType unit.Type, accessMode perm.AccessMode) func(ctx *context.Context) {
|
||||||
|
return func(ctx *context.Context) {
|
||||||
|
if unitType.UnitGlobalDisabled() {
|
||||||
|
ctx.NotFound(unitType.String(), nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.ContextUser == nil {
|
||||||
|
ctx.NotFound(unitType.String(), nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
if ctx.ContextUser.IsOrganization() {
|
||||||
|
if ctx.Org.Organization.UnitPermission(ctx, ctx.Doer, unitType) < accessMode {
|
||||||
|
ctx.NotFound(unitType.String(), nil)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
addWebhookAddRoutes := func() {
|
addWebhookAddRoutes := func() {
|
||||||
m.Get("/{type}/new", repo.WebhooksNew)
|
m.Get("/{type}/new", repo.WebhooksNew)
|
||||||
m.Post("/gitea/new", web.Bind(forms.NewWebhookForm{}), repo.GiteaHooksNewPost)
|
m.Post("/gitea/new", web.Bind(forms.NewWebhookForm{}), repo.GiteaHooksNewPost)
|
||||||
@ -334,7 +355,7 @@ func registerRoutes(m *web.Route) {
|
|||||||
m.Get("/users", explore.Users)
|
m.Get("/users", explore.Users)
|
||||||
m.Get("/users/sitemap-{idx}.xml", sitemapEnabled, explore.Users)
|
m.Get("/users/sitemap-{idx}.xml", sitemapEnabled, explore.Users)
|
||||||
m.Get("/organizations", explore.Organizations)
|
m.Get("/organizations", explore.Organizations)
|
||||||
m.Get("/code", explore.Code)
|
m.Get("/code", reqUnitAccess(unit.TypeCode, perm.AccessModeRead), explore.Code)
|
||||||
m.Get("/topics/search", explore.TopicSearch)
|
m.Get("/topics/search", explore.TopicSearch)
|
||||||
}, ignExploreSignIn)
|
}, ignExploreSignIn)
|
||||||
m.Group("/issues", func() {
|
m.Group("/issues", func() {
|
||||||
@ -649,21 +670,6 @@ func registerRoutes(m *web.Route) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
reqUnitAccess := func(unitType unit.Type, accessMode perm.AccessMode) func(ctx *context.Context) {
|
|
||||||
return func(ctx *context.Context) {
|
|
||||||
if ctx.ContextUser == nil {
|
|
||||||
ctx.NotFound(unitType.String(), nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
if ctx.ContextUser.IsOrganization() {
|
|
||||||
if ctx.Org.Organization.UnitPermission(ctx, ctx.Doer, unitType) < accessMode {
|
|
||||||
ctx.NotFound(unitType.String(), nil)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// ***** START: Organization *****
|
// ***** START: Organization *****
|
||||||
m.Group("/org", func() {
|
m.Group("/org", func() {
|
||||||
m.Group("/{org}", func() {
|
m.Group("/{org}", func() {
|
||||||
|
@ -34,6 +34,9 @@ func TestUserTitleToWebPath(t *testing.T) {
|
|||||||
UserTitle string
|
UserTitle string
|
||||||
}
|
}
|
||||||
for _, test := range []test{
|
for _, test := range []test{
|
||||||
|
{"unnamed", ""},
|
||||||
|
{"unnamed", "."},
|
||||||
|
{"unnamed", ".."},
|
||||||
{"wiki-name", "wiki name"},
|
{"wiki-name", "wiki name"},
|
||||||
{"title.md.-", "title.md"},
|
{"title.md.-", "title.md"},
|
||||||
{"wiki-name.-", "wiki-name"},
|
{"wiki-name.-", "wiki-name"},
|
||||||
@ -118,7 +121,7 @@ func TestUserWebGitPathConsistency(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
userTitle := strings.TrimSpace(string(b[:l]))
|
userTitle := strings.TrimSpace(string(b[:l]))
|
||||||
if userTitle == "" || userTitle == "." {
|
if userTitle == "" || userTitle == "." || userTitle == ".." {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
webPath := UserTitleToWebPath("", userTitle)
|
webPath := UserTitleToWebPath("", userTitle)
|
||||||
|
@ -10,7 +10,7 @@
|
|||||||
<a class="{{if .PageIsExploreOrganizations}}active {{end}}item" href="{{AppSubUrl}}/explore/organizations">
|
<a class="{{if .PageIsExploreOrganizations}}active {{end}}item" href="{{AppSubUrl}}/explore/organizations">
|
||||||
{{svg "octicon-organization"}} {{.locale.Tr "explore.organizations"}}
|
{{svg "octicon-organization"}} {{.locale.Tr "explore.organizations"}}
|
||||||
</a>
|
</a>
|
||||||
{{if .IsRepoIndexerEnabled}}
|
{{if and (not $.UnitTypeCode.UnitGlobalDisabled) .IsRepoIndexerEnabled}}
|
||||||
<a class="{{if .PageIsExploreCode}}active {{end}}item" href="{{AppSubUrl}}/explore/code">
|
<a class="{{if .PageIsExploreCode}}active {{end}}item" href="{{AppSubUrl}}/explore/code">
|
||||||
{{svg "octicon-code"}} {{.locale.Tr "explore.code"}}
|
{{svg "octicon-code"}} {{.locale.Tr "explore.code"}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
{{svg "octicon-link"}}
|
{{svg "octicon-link"}}
|
||||||
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
|
<a href="{{.Website}}" rel="nofollow">{{.Website}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix}}
|
{{svg "octicon-clock"}} {{$.locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix) | Safe}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{{svg "octicon-mail"}}
|
{{svg "octicon-mail"}}
|
||||||
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
|
<a href="mailto:{{.Email}}" rel="nofollow">{{.Email}}</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix}}
|
{{svg "octicon-clock"}} {{$.locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix) | Safe}}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -60,7 +60,7 @@
|
|||||||
{{.Fingerprint}}
|
{{.Fingerprint}}
|
||||||
</div>
|
</div>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - <span>{{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}}</span></i>
|
<i>{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}} - <span>{{$.locale.Tr "settings.can_read_info"}}{{if not .IsReadOnly}} / {{$.locale.Tr "settings.can_write_info"}} {{end}}</span></i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -18,7 +18,7 @@
|
|||||||
{{else if .Location}}
|
{{else if .Location}}
|
||||||
{{svg "octicon-location"}} {{.Location}}
|
{{svg "octicon-location"}} {{.Location}}
|
||||||
{{else}}
|
{{else}}
|
||||||
{{svg "octicon-clock"}} {{$.locale.Tr "user.join_on"}} {{DateTime "short" .CreatedUnix}}
|
{{svg "octicon-clock"}} {{$.locale.Tr "user.joined_on" (DateTime "short" .CreatedUnix) | Safe}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
@ -44,8 +44,7 @@
|
|||||||
<div class="print meta">******</div>
|
<div class="print meta">******</div>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>
|
<i>
|
||||||
{{$.locale.Tr "settings.add_on"}}
|
{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}}
|
||||||
<span>{{.CreatedUnix.FormatShort}}</span>
|
|
||||||
</i>
|
</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,8 +20,8 @@
|
|||||||
{{avatar $.Context .SignedUser}}
|
{{avatar $.Context .SignedUser}}
|
||||||
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
|
<span class="truncated-item-name">{{.SignedUser.ShortName 40}}</span>
|
||||||
<span class="org-visibility">
|
<span class="org-visibility">
|
||||||
{{if .ContextUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
|
{{if .SignedUser.Visibility.IsLimited}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.limited_shortname"}}</div>{{end}}
|
||||||
{{if .ContextUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
|
{{if .SignedUser.Visibility.IsPrivate}}<div class="ui basic tiny horizontal label">{{$.locale.Tr "org.settings.visibility.private_shortname"}}</div>{{end}}
|
||||||
</span>
|
</span>
|
||||||
</a>
|
</a>
|
||||||
{{range .Orgs}}
|
{{range .Orgs}}
|
||||||
|
@ -35,6 +35,9 @@ const data = {
|
|||||||
|
|
||||||
textMyOrgs: {{.locale.Tr "home.my_orgs"}},
|
textMyOrgs: {{.locale.Tr "home.my_orgs"}},
|
||||||
textNewOrg: {{.locale.Tr "new_org"}},
|
textNewOrg: {{.locale.Tr "new_org"}},
|
||||||
|
|
||||||
|
textOrgVisibilityLimited: {{.locale.Tr "org.settings.visibility.limited_shortname"}},
|
||||||
|
textOrgVisibilityPrivate: {{.locale.Tr "org.settings.visibility.private_shortname"}},
|
||||||
};
|
};
|
||||||
|
|
||||||
{{if .Team}}
|
{{if .Team}}
|
||||||
@ -42,7 +45,7 @@ data.teamId = {{.Team.ID}};
|
|||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
{{if not .ContextUser.IsOrganization}}
|
{{if not .ContextUser.IsOrganization}}
|
||||||
data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}},{{end}}];
|
data.organizations = [{{range .Orgs}}{'name': {{.Name}}, 'num_repos': {{.NumRepos}}, 'org_visibility': {{.Visibility}}},{{end}}];
|
||||||
data.isOrganization = false;
|
data.isOrganization = false;
|
||||||
data.organizationsTotalCount = {{.UserOrgsCount}};
|
data.organizationsTotalCount = {{.UserOrgsCount}};
|
||||||
data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}};
|
data.canCreateOrganization = {{.SignedUser.CanCreateOrganization}};
|
||||||
|
@ -73,7 +73,7 @@
|
|||||||
</li>
|
</li>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.join_on"}} {{DateTime "short" .ContextUser.CreatedUnix}}</li>
|
<li>{{svg "octicon-clock"}} {{.locale.Tr "user.joined_on" (DateTime "short" .ContextUser.CreatedUnix) | Safe}}</li>
|
||||||
{{if and .Orgs .HasOrgsVisible}}
|
{{if and .Orgs .HasOrgsVisible}}
|
||||||
<li>
|
<li>
|
||||||
<ul class="user-orgs">
|
<ul class="user-orgs">
|
||||||
@ -135,7 +135,7 @@
|
|||||||
{{svg "octicon-package"}} {{.locale.Tr "packages.title"}}
|
{{svg "octicon-package"}} {{.locale.Tr "packages.title"}}
|
||||||
</a>
|
</a>
|
||||||
{{end}}
|
{{end}}
|
||||||
{{if .IsRepoIndexerEnabled}}
|
{{if and (not $.UnitTypeCode.UnitGlobalDisabled) .IsRepoIndexerEnabled}}
|
||||||
<a class='{{if eq .TabName "code"}}active {{end}}item' href="{{.ContextUser.HomeLink}}/-/code">
|
<a class='{{if eq .TabName "code"}}active {{end}}item' href="{{.ContextUser.HomeLink}}/-/code">
|
||||||
{{svg "octicon-code"}} {{.locale.Tr "user.code"}}
|
{{svg "octicon-code"}} {{.locale.Tr "user.code"}}
|
||||||
</a>
|
</a>
|
||||||
|
@ -29,7 +29,7 @@
|
|||||||
</ul>
|
</ul>
|
||||||
</details>
|
</details>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
<i>{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<strong>{{$grant.Application.Name}}</strong>
|
<strong>{{$grant.Application.Name}}</strong>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" $grant.CreatedUnix}}</span></i>
|
<i>{{$.locale.Tr "settings.added_on" (DateTime "short" $grant.CreatedUnix) | Safe}}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -68,9 +68,9 @@
|
|||||||
<b>{{$.locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}}
|
<b>{{$.locale.Tr "settings.subkeys"}}:</b> {{range .SubsKey}} {{.PaddedKeyID}} {{end}}
|
||||||
</div>
|
</div>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .AddedUnix}}</span></i>
|
<i>{{$.locale.Tr "settings.added_on" (DateTime "short" .AddedUnix) | Safe}}</i>
|
||||||
-
|
-
|
||||||
<i>{{if not .ExpiredUnix.IsZero}}{{$.locale.Tr "settings.valid_until"}} <span>{{DateTime "short" .ExpiredUnix}}</span>{{else}}{{$.locale.Tr "settings.valid_forever"}}{{end}}</i>
|
<i>{{if not .ExpiredUnix.IsZero}}{{$.locale.Tr "settings.valid_until_date" (DateTime "short" .ExpiredUnix) | Safe}}{{else}}{{$.locale.Tr "settings.valid_forever"}}{{end}}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -25,7 +25,7 @@
|
|||||||
<div class="content">
|
<div class="content">
|
||||||
<strong>{{.Name}}</strong>
|
<strong>{{.Name}}</strong>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix}}</span> — {{svg "octicon-info" 16}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
<i>{{$.locale.Tr "settings.added_on" (DateTime "short" .CreatedUnix) | Safe}} — {{svg "octicon-info" 16}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -59,7 +59,7 @@
|
|||||||
{{.Fingerprint}}
|
{{.Fingerprint}}
|
||||||
</div>
|
</div>
|
||||||
<div class="activity meta">
|
<div class="activity meta">
|
||||||
<i>{{$.locale.Tr "settings.add_on"}} <span>{{DateTime "short" .CreatedUnix}}</span> — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
<i>{{$.locale.Tr "settings.add_on" (DateTime "short" .CreatedUnix) | Safe}} — {{svg "octicon-info"}} {{if .HasUsed}}{{$.locale.Tr "settings.last_used"}} <span {{if .HasRecentActivity}}class="green"{{end}}>{{DateTime "short" .UpdatedUnix}}</span>{{else}}{{$.locale.Tr "settings.no_activity"}}{{end}}</i>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,7 +20,7 @@ func TestSettingShowUserEmailExplore(t *testing.T) {
|
|||||||
setting.UI.ShowUserEmail = true
|
setting.UI.ShowUserEmail = true
|
||||||
|
|
||||||
session := loginUser(t, "user2")
|
session := loginUser(t, "user2")
|
||||||
req := NewRequest(t, "GET", "/explore/users")
|
req := NewRequest(t, "GET", "/explore/users?sort=alphabetically")
|
||||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc := NewHTMLParser(t, resp.Body)
|
htmlDoc := NewHTMLParser(t, resp.Body)
|
||||||
assert.Contains(t,
|
assert.Contains(t,
|
||||||
@ -30,7 +30,7 @@ func TestSettingShowUserEmailExplore(t *testing.T) {
|
|||||||
|
|
||||||
setting.UI.ShowUserEmail = false
|
setting.UI.ShowUserEmail = false
|
||||||
|
|
||||||
req = NewRequest(t, "GET", "/explore/users")
|
req = NewRequest(t, "GET", "/explore/users?sort=alphabetically")
|
||||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||||
htmlDoc = NewHTMLParser(t, resp.Body)
|
htmlDoc = NewHTMLParser(t, resp.Body)
|
||||||
assert.NotContains(t,
|
assert.NotContains(t,
|
||||||
|
@ -131,6 +131,9 @@
|
|||||||
<div class="text truncate item-name gt-f1">
|
<div class="text truncate item-name gt-f1">
|
||||||
<svg-icon name="octicon-organization" :size="16" class-name="gt-mr-2"/>
|
<svg-icon name="octicon-organization" :size="16" class-name="gt-mr-2"/>
|
||||||
<strong>{{ org.name }}</strong>
|
<strong>{{ org.name }}</strong>
|
||||||
|
<span class="ui tiny basic label gt-ml-3" v-if="org.org_visibility !== 'public'">
|
||||||
|
{{ org.org_visibility === 'limited' ? textOrgVisibilityLimited: textOrgVisibilityPrivate }}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="text light grey gt-df gt-ac">
|
<div class="text light grey gt-df gt-ac">
|
||||||
{{ org.num_repos }}
|
{{ org.num_repos }}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user