diff --git a/models/repo.go b/models/repo.go index 3a5362d6a..df9f015eb 100644 --- a/models/repo.go +++ b/models/repo.go @@ -2223,7 +2223,7 @@ func (repo *Repository) CheckoutNewBranch(oldBranchName, newBranchName string) e func checkoutNewBranch(repoPath, localPath, oldBranch, newBranch string) error { if !com.IsExist(localPath) { - if err := updateLocalCopy(repoPath, localPath, oldBranch); error != nil { + if err := updateLocalCopy(repoPath, localPath, oldBranch); err != nil { return err } } diff --git a/modules/auth/repo_form.go b/modules/auth/repo_form.go index 6f6285b2d..8321c6131 100644 --- a/modules/auth/repo_form.go +++ b/modules/auth/repo_form.go @@ -323,7 +323,7 @@ type RemoveUploadFileForm struct { File string `binding:"Required;MaxSize(50)"` } -func (f *UploadRemoveFileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { +func (f *RemoveUploadFileForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors { return validate(errs, ctx.Data, f, ctx.Locale) } diff --git a/modules/setting/setting.go b/modules/setting/setting.go index 6e6761da4..406b27f2f 100644 --- a/modules/setting/setting.go +++ b/modules/setting/setting.go @@ -116,8 +116,8 @@ var ( // Repo editor settings Editor struct { - LineWrapExtensions []string - PreviewTabApis []string + LineWrapExtensions []string + PreviewTabApis []string } // UI settings @@ -164,11 +164,11 @@ var ( AttachmentEnabled bool // Repo Upload settings - UploadTempPath string - UploadAllowedTypes string - UploadMaxSize int64 - UploadMaxFiles int - UploadEnabled bool + UploadTempPath string + UploadAllowedTypes string + UploadMaxSize int64 + UploadMaxFiles int + UploadEnabled bool // Time settings TimeFormat string @@ -469,20 +469,6 @@ func NewContext() { UploadMaxFiles = sec.Key("UPLOAD_MAX_FILES").MustInt(10) UploadEnabled = sec.Key("ENABLE_UPLOADS").MustBool(true) - // UI settings. - sec = Cfg.Section("ui") - ExplorePagingNum = sec.Key("EXPLORE_PAGING_NUM").MustInt(20) - IssuePagingNum = sec.Key("ISSUE_PAGING_NUM").MustInt(10) - FeedMaxCommitNum = sec.Key("FEED_MAX_COMMIT_NUM").MustInt(5) - MaxDisplayFileSize = sec.Key("MAX_DISPLAY_FILE_SIZE").MustInt64(8388608) - - sec = Cfg.Section("ui.admin") - AdminUserPagingNum = sec.Key("USER_PAGING_NUM").MustInt(50) - AdminRepoPagingNum = sec.Key("REPO_PAGING_NUM").MustInt(50) - AdminNoticePagingNum = sec.Key("NOTICE_PAGING_NUM").MustInt(50) - AdminOrgPagingNum = sec.Key("ORG_PAGING_NUM").MustInt(50) - ThemeColorMetaTag = sec.Key("THEME_COLOR_META_TAG").MustString("#ff5343") - sec = Cfg.Section("picture") AvatarUploadPath = sec.Key("AVATAR_UPLOAD_PATH").MustString(path.Join(AppDataPath, "avatars")) forcePathSeparator(AvatarUploadPath) diff --git a/routers/repo/branch.go b/routers/repo/branch.go index 371191902..453df3745 100644 --- a/routers/repo/branch.go +++ b/routers/repo/branch.go @@ -74,7 +74,7 @@ func NewBranchPost(ctx *context.Context, form auth.NewBranchForm) { } oldCommitID := "0000000000000000000000000000000000000000" // New Branch so we use all 0s newCommitID := commit.ID.String() - if err := models.CommitRepoAction(ctx.User.Id, ctx.Repo.Owner.Id, ctx.User.LowerName, ctx.Repo.Owner.Email, + if err := models.CommitRepoAction(ctx.User.ID, ctx.Repo.Owner.ID, ctx.User.LowerName, ctx.Repo.Owner.Email, ctx.Repo.Repository.ID, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.Name, "refs/heads/"+branchName, pc, oldCommitID, newCommitID); err != nil { log.Error(4, "models.CommitRepoAction(branch = %s): %v", branchName, err) diff --git a/routers/repo/delete.go b/routers/repo/delete.go index 1ae4a88a2..0aec7f1a1 100644 --- a/routers/repo/delete.go +++ b/routers/repo/delete.go @@ -42,7 +42,7 @@ func DeleteFilePost(ctx *context.Context, form auth.DeleteRepoFileForm) { } oldCommitID := ctx.Repo.CommitID newCommitID := commit.ID.String() - if err := models.CommitRepoAction(ctx.User.Id, ctx.Repo.Owner.Id, ctx.User.LowerName, ctx.Repo.Owner.Email, + if err := models.CommitRepoAction(ctx.User.ID, ctx.Repo.Owner.ID, ctx.User.LowerName, ctx.Repo.Owner.Email, ctx.Repo.Repository.ID, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.Name, "refs/heads/"+branchName, pc, oldCommitID, newCommitID); err != nil { log.Error(4, "models.CommitRepoAction(branch = %s): %v", branchName, err) diff --git a/routers/repo/edit.go b/routers/repo/edit.go index bda94d60b..d0cacd360 100644 --- a/routers/repo/edit.go +++ b/routers/repo/edit.go @@ -124,7 +124,7 @@ func editFile(ctx *context.Context, isNewFile bool) { ctx.HTML(200, EDIT) } -func FilePost(ctx *context.Context, form auth.EditRepoFileForm) { +func EditFilePost(ctx *context.Context, form auth.EditRepoFileForm) { editFilePost(ctx, form, false) } @@ -306,7 +306,7 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo if branchName != oldBranchName { oldCommitID = "0000000000000000000000000000000000000000" // New Branch so we use all 0s } - if err := models.CommitRepoAction(ctx.User.Id, ctx.Repo.Owner.Id, ctx.User.LowerName, ctx.Repo.Owner.Email, + if err := models.CommitRepoAction(ctx.User.ID, ctx.Repo.Owner.ID, ctx.User.LowerName, ctx.Repo.Owner.Email, ctx.Repo.Repository.ID, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.Name, "refs/heads/"+branchName, pc, oldCommitID, newCommitID); err != nil { log.Error(4, "models.CommitRepoAction(branch = %s): %v", branchName, err) diff --git a/routers/repo/upload.go b/routers/repo/upload.go index 286094ae6..fedf4064d 100644 --- a/routers/repo/upload.go +++ b/routers/repo/upload.go @@ -167,7 +167,7 @@ func UploadFilePost(ctx *context.Context, form auth.UploadRepoFileForm) { if branchName != oldBranchName { oldCommitID = "0000000000000000000000000000000000000000" // New Branch so we use all 0s } - if err := models.CommitRepoAction(ctx.User.Id, ctx.Repo.Owner.Id, ctx.User.LowerName, ctx.Repo.Owner.Email, + if err := models.CommitRepoAction(ctx.User.ID, ctx.Repo.Owner.ID, ctx.User.LowerName, ctx.Repo.Owner.Email, ctx.Repo.Repository.ID, ctx.Repo.Owner.LowerName, ctx.Repo.Repository.Name, "refs/heads/"+branchName, pc, oldCommitID, newCommitID); err != nil { log.Error(4, "models.CommitRepoAction(branch = %s): %v", branchName, err) @@ -220,7 +220,7 @@ func UploadFileToServer(ctx *context.Context) { } } - up, err := models.NewUpload(header.Filename, buf, file, ctx.User.Id, ctx.Repo.Repository.ID) + up, err := models.NewUpload(header.Filename, buf, file, ctx.User.ID, ctx.Repo.Repository.ID) if err != nil { ctx.Error(500, fmt.Sprintf("NewUpload: %v", err)) return @@ -245,7 +245,7 @@ func RemoveUploadFileFromServer(ctx *context.Context, form auth.RemoveUploadFile uuid := form.File - if err := models.RemoveUpload(uuid, ctx.User.Id, ctx.Repo.Repository.ID); err != nil { + if err := models.RemoveUpload(uuid, ctx.User.ID, ctx.Repo.Repository.ID); err != nil { ctx.Error(500, fmt.Sprintf("RemoveUpload: %v", err)) return }