Browse Source

Merge branch 'dev_mirocod' of git.mirocod.ru:Bezborodov/gitea into user_coordinate #2

pull/13/head
Gitea 3 years ago
parent
commit
1f55588e64
  1. 4
      models/org_team.go
  2. 4
      models/repo.go
  3. 2
      models/user/user.go
  4. 4
      modules/structs/org.go
  5. 4
      modules/structs/org_team.go
  6. 8
      modules/structs/repo.go
  7. 2
      modules/structs/user.go
  8. 2
      services/forms/org.go
  9. 2
      services/forms/repo_form.go
  10. 4
      services/forms/user_form.go

4
models/org_team.go

@ -691,8 +691,8 @@ func UpdateTeam(t *Team, authChanged, includeAllChanged bool) (err error) {
return errors.New("empty team name")
}
if len(t.Description) > 255 {
t.Description = t.Description[:255]
if len(t.Description) > 1024 {
t.Description = t.Description[:1024]
}
ctx, committer, err := db.TxContext()

4
models/repo.go

@ -635,8 +635,8 @@ func DecrementRepoForkNum(ctx context.Context, repoID int64) error {
func updateRepository(ctx context.Context, repo *repo_model.Repository, visibilityChanged bool) (err error) {
repo.LowerName = strings.ToLower(repo.Name)
if utf8.RuneCountInString(repo.Description) > 255 {
repo.Description = string([]rune(repo.Description)[:255])
if utf8.RuneCountInString(repo.Description) > 1024 {
repo.Description = string([]rune(repo.Description)[:1024])
}
if utf8.RuneCountInString(repo.Website) > 255 {
repo.Website = string([]rune(repo.Website)[:255])

2
models/user/user.go

@ -190,7 +190,7 @@ func (u *User) BeforeUpdate() {
u.Location = base.TruncateString(u.Location, 255)
u.LocationCoordinate = base.TruncateString(u.LocationCoordinate, 255)
u.Website = base.TruncateString(u.Website, 255)
u.Description = base.TruncateString(u.Description, 255)
u.Description = base.TruncateString(u.Description, 1024)
}
// AfterLoad is invoked from XORM after filling all the fields of this object.

4
modules/structs/org.go

@ -32,7 +32,7 @@ type CreateOrgOption struct {
// required: true
UserName string `json:"username" binding:"Required"`
FullName string `json:"full_name"`
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
LocationCoordinate string `json:"location_coordinate" binding:"MaxSize(255)"`
@ -47,7 +47,7 @@ type CreateOrgOption struct {
// EditOrgOption options for editing an organization
type EditOrgOption struct {
FullName string `json:"full_name"`
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
Website string `json:"website" binding:"ValidUrl;MaxSize(255)"`
Location string `json:"location" binding:"MaxSize(50)"`
LocationCoordinate string `json:"location_coordinate" binding:"MaxSize(255)"`

4
modules/structs/org_team.go

@ -26,7 +26,7 @@ type Team struct {
type CreateTeamOption struct {
// required: true
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(30)"`
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
IncludesAllRepositories bool `json:"includes_all_repositories"`
// enum: read,write,admin
Permission string `json:"permission"`
@ -42,7 +42,7 @@ type CreateTeamOption struct {
type EditTeamOption struct {
// required: true
Name string `json:"name" binding:"AlphaDashDot;MaxSize(30)"`
Description *string `json:"description" binding:"MaxSize(255)"`
Description *string `json:"description" binding:"MaxSize(1024)"`
IncludesAllRepositories *bool `json:"includes_all_repositories"`
// enum: read,write,admin
Permission string `json:"permission"`

8
modules/structs/repo.go

@ -107,7 +107,7 @@ type CreateRepoOption struct {
// unique: true
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
// Description of the repository to create
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
// Whether the repository is private
Private bool `json:"private"`
// Label-Set to use
@ -136,7 +136,7 @@ type EditRepoOption struct {
// unique: true
Name *string `json:"name,omitempty" binding:"OmitEmpty;AlphaDashDot;MaxSize(100);"`
// a short description of the repository.
Description *string `json:"description,omitempty" binding:"MaxSize(255)"`
Description *string `json:"description,omitempty" binding:"MaxSize(1024)"`
// a URL with more information about the repository.
Website *string `json:"website,omitempty" binding:"MaxSize(255)"`
// either `true` to make the repository private or `false` to make it public.
@ -200,7 +200,7 @@ type GenerateRepoOption struct {
// unique: true
Name string `json:"name" binding:"Required;AlphaDashDot;MaxSize(100)"`
// Description of the repository to create
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
// Whether the repository is private
Private bool `json:"private"`
// include git content of default branch in template repo
@ -309,7 +309,7 @@ type MigrateRepoOptions struct {
LFS bool `json:"lfs"`
LFSEndpoint string `json:"lfs_endpoint"`
Private bool `json:"private"`
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
Wiki bool `json:"wiki"`
Milestones bool `json:"milestones"`
Labels bool `json:"labels"`

2
modules/structs/user.go

@ -85,7 +85,7 @@ type UserSettings struct {
type UserSettingsOptions struct {
FullName *string `json:"full_name" binding:"MaxSize(100)"`
Website *string `json:"website" binding:"OmitEmpty;ValidUrl;MaxSize(255)"`
Description *string `json:"description" binding:"MaxSize(255)"`
Description *string `json:"description" binding:"MaxSize(1024)"`
Location *string `json:"location" binding:"MaxSize(50)"`
LocationCoordinate *string `json:"location_coordinate" binding:"MaxSize(255)"`
Language *string `json:"language"`

2
services/forms/org.go

@ -39,7 +39,7 @@ func (f *CreateOrgForm) Validate(req *http.Request, errs binding.Errors) binding
type UpdateOrgSettingForm struct {
Name string `binding:"Required;AlphaDashDot;MaxSize(40)" locale:"org.org_name_holder"`
FullName string `binding:"MaxSize(100)"`
Description string `binding:"MaxSize(255)"`
Description string `binding:"MaxSize(1024)"`
Website string `binding:"ValidUrl;MaxSize(255)"`
Location string `binding:"MaxSize(50)"`
LocationCoordinate string `binding:"MaxSize(255)"`

2
services/forms/repo_form.go

@ -74,7 +74,7 @@ type MigrateRepoForm struct {
LFS bool `json:"lfs"`
LFSEndpoint string `json:"lfs_endpoint"`
Private bool `json:"private"`
Description string `json:"description" binding:"MaxSize(255)"`
Description string `json:"description" binding:"MaxSize(1024)"`
Wiki bool `json:"wiki"`
Milestones bool `json:"milestones"`
Labels bool `json:"labels"`

4
services/forms/user_form.go

@ -246,7 +246,7 @@ type UpdateProfileForm struct {
Website string `binding:"ValidSiteUrl;MaxSize(255)"`
Location string `binding:"MaxSize(50)"`
LocationCoordinate string `binding:"MaxSize(255)"`
Description string `binding:"MaxSize(255)"`
Description string `binding:"MaxSize(1024)"`
Visibility structs.VisibleType
KeepActivityPrivate bool
}
@ -274,7 +274,7 @@ const (
AvatarByMail string = "bymail"
)
// AvatarForm form for changing avatar
// AvatarForm form for changing avDescriptionatar
type AvatarForm struct {
Source string
Avatar *multipart.FileHeader

Loading…
Cancel
Save