Web editor: improve code quality
This commit is contained in:
parent
67fb0fe6a5
commit
f8a48ffaad
19 changed files with 75 additions and 81 deletions
|
@ -278,7 +278,7 @@ func (f *NewWikiForm) Validate(ctx *macaron.Context, errs binding.Errors) bindin
|
|||
// \/ \/
|
||||
|
||||
type EditRepoFileForm struct {
|
||||
TreeName string `binding:"Required;MaxSize(500)"`
|
||||
TreePath string `binding:"Required;MaxSize(500)"`
|
||||
Content string `binding:"Required"`
|
||||
CommitSummary string `binding:"MaxSize(100)`
|
||||
CommitMessage string
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -41,14 +41,14 @@ type Repository struct {
|
|||
GitRepo *git.Repository
|
||||
BranchName string
|
||||
TagName string
|
||||
TreeName string
|
||||
TreePath string
|
||||
CommitID string
|
||||
RepoLink string
|
||||
CloneLink models.CloneLink
|
||||
CommitsCount int64
|
||||
Mirror *models.Mirror
|
||||
|
||||
PullRequest *PullRequest
|
||||
PullRequest *PullRequest
|
||||
}
|
||||
|
||||
// IsOwner returns true if current user is the owner of repository.
|
||||
|
@ -384,7 +384,7 @@ func RepoRef() macaron.Handler {
|
|||
if ctx.Repo.GitRepo.IsBranchExist(refName) ||
|
||||
ctx.Repo.GitRepo.IsTagExist(refName) {
|
||||
if i < len(parts)-1 {
|
||||
ctx.Repo.TreeName = strings.Join(parts[i+1:], "/")
|
||||
ctx.Repo.TreePath = strings.Join(parts[i+1:], "/")
|
||||
}
|
||||
hasMatched = true
|
||||
break
|
||||
|
@ -392,7 +392,7 @@ func RepoRef() macaron.Handler {
|
|||
}
|
||||
if !hasMatched && len(parts[0]) == 40 {
|
||||
refName = parts[0]
|
||||
ctx.Repo.TreeName = strings.Join(parts[1:], "/")
|
||||
ctx.Repo.TreePath = strings.Join(parts[1:], "/")
|
||||
}
|
||||
|
||||
if ctx.Repo.GitRepo.IsBranchExist(refName) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue