Move modules/forms to services/forms (#15305)
Forms are dependent on models and therefore should be in services. This PR also removes the old auth. aliasing Signed-off-by: Andrew Thornton <art27@cantab.net> Co-authored-by: 6543 <6543@obermui.de> Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com> Co-authored-by: techknowlogick <techknowlogick@gitea.io>
This commit is contained in:
@@ -13,7 +13,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/repofiles"
|
||||
@@ -21,6 +20,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
release_service "code.gitea.io/gitea/services/release"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
@@ -372,7 +372,7 @@ func getDeletedBranches(ctx *context.Context) ([]*Branch, error) {
|
||||
|
||||
// CreateBranch creates new branch in repository
|
||||
func CreateBranch(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewBranchForm)
|
||||
form := web.GetForm(ctx).(*forms.NewBranchForm)
|
||||
if !ctx.Repo.CanCreateBranch() {
|
||||
ctx.NotFound("CreateBranch", nil)
|
||||
return
|
||||
|
||||
@@ -15,7 +15,6 @@ import (
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/charset"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/repofiles"
|
||||
@@ -25,6 +24,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
|
||||
@@ -177,7 +177,7 @@ func NewFile(ctx *context.Context) {
|
||||
editFile(ctx, true)
|
||||
}
|
||||
|
||||
func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bool) {
|
||||
func editFilePost(ctx *context.Context, form forms.EditRepoFileForm, isNewFile bool) {
|
||||
canCommit := renderCommitRights(ctx)
|
||||
treeNames, treePaths := getParentTreeFields(form.TreePath)
|
||||
branchName := ctx.Repo.BranchName
|
||||
@@ -330,19 +330,19 @@ func editFilePost(ctx *context.Context, form auth.EditRepoFileForm, isNewFile bo
|
||||
|
||||
// EditFilePost response for editing file
|
||||
func EditFilePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditRepoFileForm)
|
||||
form := web.GetForm(ctx).(*forms.EditRepoFileForm)
|
||||
editFilePost(ctx, *form, false)
|
||||
}
|
||||
|
||||
// NewFilePost response for creating file
|
||||
func NewFilePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditRepoFileForm)
|
||||
form := web.GetForm(ctx).(*forms.EditRepoFileForm)
|
||||
editFilePost(ctx, *form, true)
|
||||
}
|
||||
|
||||
// DiffPreviewPost render preview diff page
|
||||
func DiffPreviewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditPreviewDiffForm)
|
||||
form := web.GetForm(ctx).(*forms.EditPreviewDiffForm)
|
||||
treePath := cleanUploadFileName(ctx.Repo.TreePath)
|
||||
if len(treePath) == 0 {
|
||||
ctx.Error(http.StatusInternalServerError, "file name to diff is invalid")
|
||||
@@ -402,7 +402,7 @@ func DeleteFile(ctx *context.Context) {
|
||||
|
||||
// DeleteFilePost response for deleting file
|
||||
func DeleteFilePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.DeleteRepoFileForm)
|
||||
form := web.GetForm(ctx).(*forms.DeleteRepoFileForm)
|
||||
canCommit := renderCommitRights(ctx)
|
||||
branchName := ctx.Repo.BranchName
|
||||
if form.CommitChoice == frmCommitChoiceNewBranch {
|
||||
@@ -566,7 +566,7 @@ func UploadFile(ctx *context.Context) {
|
||||
|
||||
// UploadFilePost response for uploading file
|
||||
func UploadFilePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.UploadRepoFileForm)
|
||||
form := web.GetForm(ctx).(*forms.UploadRepoFileForm)
|
||||
ctx.Data["PageIsUpload"] = true
|
||||
ctx.Data["RequireTribute"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
@@ -772,7 +772,7 @@ func UploadFileToServer(ctx *context.Context) {
|
||||
|
||||
// RemoveUploadFileFromServer remove file from server file dir
|
||||
func RemoveUploadFileFromServer(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.RemoveUploadFileForm)
|
||||
form := web.GetForm(ctx).(*forms.RemoveUploadFileForm)
|
||||
if len(form.File) == 0 {
|
||||
ctx.Status(204)
|
||||
return
|
||||
|
||||
@@ -19,7 +19,6 @@ import (
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
issue_indexer "code.gitea.io/gitea/modules/indexer/issues"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
@@ -31,6 +30,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
comment_service "code.gitea.io/gitea/services/comments"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
|
||||
@@ -836,7 +836,7 @@ func NewIssueChooseTemplate(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// ValidateRepoMetas check and returns repository's meta informations
|
||||
func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm, isPull bool) ([]int64, []int64, int64, int64) {
|
||||
func ValidateRepoMetas(ctx *context.Context, form forms.CreateIssueForm, isPull bool) ([]int64, []int64, int64, int64) {
|
||||
var (
|
||||
repo = ctx.Repo.Repository
|
||||
err error
|
||||
@@ -934,7 +934,7 @@ func ValidateRepoMetas(ctx *context.Context, form auth.CreateIssueForm, isPull b
|
||||
|
||||
// NewIssuePost response for creating new issue
|
||||
func NewIssuePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateIssueForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateIssueForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.issues.new")
|
||||
ctx.Data["PageIsIssueList"] = true
|
||||
ctx.Data["NewIssueChooseTemplate"] = len(ctx.IssueTemplatesFromDefaultBranch()) > 0
|
||||
@@ -1961,7 +1961,7 @@ func UpdateIssueStatus(ctx *context.Context) {
|
||||
|
||||
// NewComment create a comment for issue
|
||||
func NewComment(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateCommentForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateCommentForm)
|
||||
issue := GetActionIssue(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -2171,7 +2171,7 @@ func DeleteComment(ctx *context.Context) {
|
||||
|
||||
// ChangeIssueReaction create a reaction for issue
|
||||
func ChangeIssueReaction(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.ReactionForm)
|
||||
form := web.GetForm(ctx).(*forms.ReactionForm)
|
||||
issue := GetActionIssue(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -2267,7 +2267,7 @@ func ChangeIssueReaction(ctx *context.Context) {
|
||||
|
||||
// ChangeCommentReaction create a reaction for comment
|
||||
func ChangeCommentReaction(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.ReactionForm)
|
||||
form := web.GetForm(ctx).(*forms.ReactionForm)
|
||||
comment, err := models.GetCommentByID(ctx.ParamsInt64(":id"))
|
||||
if err != nil {
|
||||
ctx.NotFoundOrServerError("GetCommentByID", models.IsErrCommentNotExist, err)
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
issue_service "code.gitea.io/gitea/services/issue"
|
||||
)
|
||||
|
||||
@@ -33,7 +33,7 @@ func Labels(ctx *context.Context) {
|
||||
|
||||
// InitializeLabels init labels for a repository
|
||||
func InitializeLabels(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.InitializeLabelsForm)
|
||||
form := web.GetForm(ctx).(*forms.InitializeLabelsForm)
|
||||
if ctx.HasError() {
|
||||
ctx.Redirect(ctx.Repo.RepoLink + "/labels")
|
||||
return
|
||||
@@ -99,7 +99,7 @@ func RetrieveLabels(ctx *context.Context) {
|
||||
|
||||
// NewLabel create new label for repository
|
||||
func NewLabel(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateLabelForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateLabelForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.labels")
|
||||
ctx.Data["PageIsLabels"] = true
|
||||
|
||||
@@ -124,7 +124,7 @@ func NewLabel(ctx *context.Context) {
|
||||
|
||||
// UpdateLabel update a label's name and color
|
||||
func UpdateLabel(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateLabelForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateLabelForm)
|
||||
l, err := models.GetLabelInRepoByID(ctx.Repo.Repository.ID, form.ID)
|
||||
if err != nil {
|
||||
switch {
|
||||
|
||||
@@ -10,9 +10,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -33,7 +33,7 @@ func TestInitializeLabels(t *testing.T) {
|
||||
ctx := test.MockContext(t, "user2/repo1/labels/initialize")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 2)
|
||||
web.SetForm(ctx, &auth.InitializeLabelsForm{TemplateName: "Default"})
|
||||
web.SetForm(ctx, &forms.InitializeLabelsForm{TemplateName: "Default"})
|
||||
InitializeLabels(ctx)
|
||||
assert.EqualValues(t, http.StatusFound, ctx.Resp.Status())
|
||||
models.AssertExistsAndLoadBean(t, &models.Label{
|
||||
@@ -76,7 +76,7 @@ func TestNewLabel(t *testing.T) {
|
||||
ctx := test.MockContext(t, "user2/repo1/labels/edit")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &auth.CreateLabelForm{
|
||||
web.SetForm(ctx, &forms.CreateLabelForm{
|
||||
Title: "newlabel",
|
||||
Color: "#abcdef",
|
||||
})
|
||||
@@ -94,7 +94,7 @@ func TestUpdateLabel(t *testing.T) {
|
||||
ctx := test.MockContext(t, "user2/repo1/labels/edit")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &auth.CreateLabelForm{
|
||||
web.SetForm(ctx, &forms.CreateLabelForm{
|
||||
ID: 2,
|
||||
Title: "newnameforlabel",
|
||||
Color: "#abcdef",
|
||||
|
||||
@@ -9,14 +9,14 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
)
|
||||
|
||||
// LockIssue locks an issue. This would limit commenting abilities to
|
||||
// users with write access to the repo.
|
||||
func LockIssue(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.IssueLockForm)
|
||||
form := web.GetForm(ctx).(*forms.IssueLockForm)
|
||||
issue := GetActionIssue(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
|
||||
@@ -10,8 +10,8 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
)
|
||||
|
||||
// AddTimeManually tracks time manually
|
||||
|
||||
@@ -12,7 +12,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/migrations"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
@@ -20,6 +19,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/task"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -63,7 +63,7 @@ func Migrate(ctx *context.Context) {
|
||||
ctx.HTML(http.StatusOK, base.TplName("repo/migrate/"+serviceType.Name()))
|
||||
}
|
||||
|
||||
func handleMigrateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form *auth.MigrateRepoForm) {
|
||||
func handleMigrateError(ctx *context.Context, owner *models.User, err error, name string, tpl base.TplName, form *forms.MigrateRepoForm) {
|
||||
if setting.Repository.DisableMigrations {
|
||||
ctx.Error(http.StatusForbidden, "MigrateError: the site administrator has disabled migrations")
|
||||
return
|
||||
@@ -98,7 +98,7 @@ func handleMigrateError(ctx *context.Context, owner *models.User, err error, nam
|
||||
ctx.Data["Err_RepoName"] = true
|
||||
ctx.RenderWithErr(ctx.Tr("repo.form.name_pattern_not_allowed", err.(models.ErrNamePatternNotAllowed).Pattern), tpl, form)
|
||||
default:
|
||||
remoteAddr, _ := auth.ParseRemoteAddr(form.CloneAddr, form.AuthUsername, form.AuthPassword)
|
||||
remoteAddr, _ := forms.ParseRemoteAddr(form.CloneAddr, form.AuthUsername, form.AuthPassword)
|
||||
err = util.URLSanitizedError(err, remoteAddr)
|
||||
if strings.Contains(err.Error(), "Authentication failed") ||
|
||||
strings.Contains(err.Error(), "Bad credentials") ||
|
||||
@@ -116,7 +116,7 @@ func handleMigrateError(ctx *context.Context, owner *models.User, err error, nam
|
||||
|
||||
// MigratePost response for migrating from external git repository
|
||||
func MigratePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.MigrateRepoForm)
|
||||
form := web.GetForm(ctx).(*forms.MigrateRepoForm)
|
||||
if setting.Repository.DisableMigrations {
|
||||
ctx.Error(http.StatusForbidden, "MigratePost: the site administrator has disabled migrations")
|
||||
return
|
||||
@@ -139,7 +139,7 @@ func MigratePost(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
|
||||
remoteAddr, err := auth.ParseRemoteAddr(form.CloneAddr, form.AuthUsername, form.AuthPassword)
|
||||
remoteAddr, err := forms.ParseRemoteAddr(form.CloneAddr, form.AuthUsername, form.AuthPassword)
|
||||
if err == nil {
|
||||
err = migrations.IsMigrateURLAllowed(remoteAddr, ctx.User)
|
||||
}
|
||||
|
||||
@@ -11,13 +11,13 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
"xorm.io/builder"
|
||||
)
|
||||
@@ -109,7 +109,7 @@ func NewMilestone(ctx *context.Context) {
|
||||
|
||||
// NewMilestonePost response for creating milestone
|
||||
func NewMilestonePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateMilestoneForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateMilestoneForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.milestones.new")
|
||||
ctx.Data["PageIsIssueList"] = true
|
||||
ctx.Data["PageIsMilestones"] = true
|
||||
@@ -169,7 +169,7 @@ func EditMilestone(ctx *context.Context) {
|
||||
|
||||
// EditMilestonePost response for edting milestone
|
||||
func EditMilestonePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateMilestoneForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateMilestoneForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.milestones.edit")
|
||||
ctx.Data["PageIsMilestones"] = true
|
||||
ctx.Data["PageIsEditMilestone"] = true
|
||||
|
||||
@@ -12,11 +12,11 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
)
|
||||
|
||||
const (
|
||||
@@ -115,7 +115,7 @@ func NewProject(ctx *context.Context) {
|
||||
|
||||
// NewProjectPost creates a new project
|
||||
func NewProjectPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateProjectForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateProjectForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.projects.new")
|
||||
|
||||
if ctx.HasError() {
|
||||
@@ -221,7 +221,7 @@ func EditProject(ctx *context.Context) {
|
||||
|
||||
// EditProjectPost response for editing a project
|
||||
func EditProjectPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateProjectForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateProjectForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.projects.edit")
|
||||
ctx.Data["PageIsProjects"] = true
|
||||
ctx.Data["PageIsEditProjects"] = true
|
||||
@@ -404,7 +404,7 @@ func DeleteProjectBoard(ctx *context.Context) {
|
||||
|
||||
// AddBoardToProjectPost allows a new board to be added to a project.
|
||||
func AddBoardToProjectPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditProjectBoardForm)
|
||||
form := web.GetForm(ctx).(*forms.EditProjectBoardForm)
|
||||
if !ctx.Repo.IsOwner() && !ctx.Repo.IsAdmin() && !ctx.Repo.CanAccess(models.AccessModeWrite, models.UnitTypeProjects) {
|
||||
ctx.JSON(http.StatusForbidden, map[string]string{
|
||||
"message": "Only authorized users are allowed to perform this action.",
|
||||
@@ -484,7 +484,7 @@ func checkProjectBoardChangePermissions(ctx *context.Context) (*models.Project,
|
||||
|
||||
// EditProjectBoard allows a project board's to be updated
|
||||
func EditProjectBoard(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditProjectBoardForm)
|
||||
form := web.GetForm(ctx).(*forms.EditProjectBoardForm)
|
||||
_, board := checkProjectBoardChangePermissions(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -614,7 +614,7 @@ func CreateProject(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// CreateProjectPost creates an individual and/or organization project
|
||||
func CreateProjectPost(ctx *context.Context, form auth.UserCreateProjectForm) {
|
||||
func CreateProjectPost(ctx *context.Context, form forms.UserCreateProjectForm) {
|
||||
|
||||
user := checkContextUser(ctx, form.UID)
|
||||
if ctx.Written() {
|
||||
|
||||
@@ -18,7 +18,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/notification"
|
||||
@@ -30,6 +29,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/modules/web/middleware"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/gitdiff"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
@@ -172,7 +172,7 @@ func Fork(ctx *context.Context) {
|
||||
|
||||
// ForkPost response for forking a repository
|
||||
func ForkPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateRepoForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateRepoForm)
|
||||
ctx.Data["Title"] = ctx.Tr("new_fork")
|
||||
|
||||
ctxUser := checkContextUser(ctx, form.UID)
|
||||
@@ -764,7 +764,7 @@ func UpdatePullRequest(ctx *context.Context) {
|
||||
|
||||
// MergePullRequest response for merging pull request
|
||||
func MergePullRequest(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.MergePullRequestForm)
|
||||
form := web.GetForm(ctx).(*forms.MergePullRequestForm)
|
||||
issue := checkPullInfo(ctx)
|
||||
if ctx.Written() {
|
||||
return
|
||||
@@ -975,7 +975,7 @@ func stopTimerIfAvailable(user *models.User, issue *models.Issue) error {
|
||||
|
||||
// CompareAndPullRequestPost response for creating pull request
|
||||
func CompareAndPullRequestPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateIssueForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateIssueForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.pulls.compare_changes")
|
||||
ctx.Data["PageIsComparePull"] = true
|
||||
ctx.Data["IsDiffCompare"] = true
|
||||
|
||||
@@ -11,9 +11,9 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
)
|
||||
|
||||
@@ -47,7 +47,7 @@ func RenderNewCodeCommentForm(ctx *context.Context) {
|
||||
|
||||
// CreateCodeComment will create a code comment including an pending review if required
|
||||
func CreateCodeComment(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CodeCommentForm)
|
||||
form := web.GetForm(ctx).(*forms.CodeCommentForm)
|
||||
issue := GetActionIssue(ctx)
|
||||
if !issue.IsPull {
|
||||
return
|
||||
@@ -175,7 +175,7 @@ func renderConversation(ctx *context.Context, comment *models.Comment) {
|
||||
|
||||
// SubmitReview creates a review out of the existing pending review or creates a new one if no pending review exist
|
||||
func SubmitReview(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.SubmitReviewForm)
|
||||
form := web.GetForm(ctx).(*forms.SubmitReviewForm)
|
||||
issue := GetActionIssue(ctx)
|
||||
if !issue.IsPull {
|
||||
return
|
||||
@@ -227,7 +227,7 @@ func SubmitReview(ctx *context.Context) {
|
||||
|
||||
// DismissReview dismissing stale review by repo admin
|
||||
func DismissReview(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.DismissReviewForm)
|
||||
form := web.GetForm(ctx).(*forms.DismissReviewForm)
|
||||
comm, err := pull_service.DismissReview(form.ReviewID, form.Message, ctx.User, true)
|
||||
if err != nil {
|
||||
ctx.ServerError("pull_service.DismissReview", err)
|
||||
|
||||
@@ -14,12 +14,12 @@ import (
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup/markdown"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/upload"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
releaseservice "code.gitea.io/gitea/services/release"
|
||||
)
|
||||
|
||||
@@ -243,7 +243,7 @@ func NewRelease(ctx *context.Context) {
|
||||
|
||||
// NewReleasePost response for creating a release
|
||||
func NewReleasePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewReleaseForm)
|
||||
form := web.GetForm(ctx).(*forms.NewReleaseForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.new_release")
|
||||
ctx.Data["PageIsReleaseList"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
@@ -384,7 +384,7 @@ func EditRelease(ctx *context.Context) {
|
||||
|
||||
// EditReleasePost response for edit release
|
||||
func EditReleasePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.EditReleaseForm)
|
||||
form := web.GetForm(ctx).(*forms.EditReleaseForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.release.edit_release")
|
||||
ctx.Data["PageIsReleaseList"] = true
|
||||
ctx.Data["PageIsEditRelease"] = true
|
||||
|
||||
@@ -8,9 +8,9 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
)
|
||||
|
||||
func TestNewReleasePost(t *testing.T) {
|
||||
@@ -18,13 +18,13 @@ func TestNewReleasePost(t *testing.T) {
|
||||
RepoID int64
|
||||
UserID int64
|
||||
TagName string
|
||||
Form auth.NewReleaseForm
|
||||
Form forms.NewReleaseForm
|
||||
}{
|
||||
{
|
||||
RepoID: 1,
|
||||
UserID: 2,
|
||||
TagName: "v1.1", // pre-existing tag
|
||||
Form: auth.NewReleaseForm{
|
||||
Form: forms.NewReleaseForm{
|
||||
TagName: "newtag",
|
||||
Target: "master",
|
||||
Title: "title",
|
||||
@@ -35,7 +35,7 @@ func TestNewReleasePost(t *testing.T) {
|
||||
RepoID: 1,
|
||||
UserID: 2,
|
||||
TagName: "newtag",
|
||||
Form: auth.NewReleaseForm{
|
||||
Form: forms.NewReleaseForm{
|
||||
TagName: "newtag",
|
||||
Target: "master",
|
||||
Title: "title",
|
||||
|
||||
@@ -15,11 +15,11 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
archiver_service "code.gitea.io/gitea/services/archiver"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
)
|
||||
|
||||
@@ -185,7 +185,7 @@ func handleCreateError(ctx *context.Context, owner *models.User, err error, name
|
||||
|
||||
// CreatePost response for creating repository
|
||||
func CreatePost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.CreateRepoForm)
|
||||
form := web.GetForm(ctx).(*forms.CreateRepoForm)
|
||||
ctx.Data["Title"] = ctx.Tr("new_repo")
|
||||
|
||||
ctx.Data["Gitignores"] = models.Gitignores
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/migrations"
|
||||
@@ -27,6 +26,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/validation"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/routers/utils"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/mailer"
|
||||
mirror_service "code.gitea.io/gitea/services/mirror"
|
||||
repo_service "code.gitea.io/gitea/services/repository"
|
||||
@@ -57,7 +57,7 @@ func Settings(ctx *context.Context) {
|
||||
|
||||
// SettingsPost response for changes of a repository
|
||||
func SettingsPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.RepoSettingForm)
|
||||
form := web.GetForm(ctx).(*forms.RepoSettingForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsOptions"] = true
|
||||
|
||||
@@ -165,7 +165,7 @@ func SettingsPost(ctx *context.Context) {
|
||||
}
|
||||
}
|
||||
|
||||
address, err := auth.ParseRemoteAddr(form.MirrorAddress, form.MirrorUsername, form.MirrorPassword)
|
||||
address, err := forms.ParseRemoteAddr(form.MirrorAddress, form.MirrorUsername, form.MirrorPassword)
|
||||
if err == nil {
|
||||
err = migrations.IsMigrateURLAllowed(address, ctx.User)
|
||||
}
|
||||
@@ -883,7 +883,7 @@ func DeployKeys(ctx *context.Context) {
|
||||
|
||||
// DeployKeysPost response for adding a deploy key of a repository
|
||||
func DeployKeysPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.AddKeyForm)
|
||||
form := web.GetForm(ctx).(*forms.AddKeyForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.deploy_keys")
|
||||
ctx.Data["PageIsSettingsKeys"] = true
|
||||
|
||||
@@ -955,7 +955,7 @@ func DeleteDeployKey(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// UpdateAvatarSetting update repo's avatar
|
||||
func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm) error {
|
||||
func UpdateAvatarSetting(ctx *context.Context, form forms.AvatarForm) error {
|
||||
ctxRepo := ctx.Repo.Repository
|
||||
|
||||
if form.Avatar == nil {
|
||||
@@ -993,8 +993,8 @@ func UpdateAvatarSetting(ctx *context.Context, form auth.AvatarForm) error {
|
||||
|
||||
// SettingsAvatar save new POSTed repository avatar
|
||||
func SettingsAvatar(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.AvatarForm)
|
||||
form.Source = auth.AvatarLocal
|
||||
form := web.GetForm(ctx).(*forms.AvatarForm)
|
||||
form.Source = forms.AvatarLocal
|
||||
if err := UpdateAvatarSetting(ctx, *form); err != nil {
|
||||
ctx.Flash.Error(err.Error())
|
||||
} else {
|
||||
|
||||
@@ -13,11 +13,11 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
pull_service "code.gitea.io/gitea/services/pull"
|
||||
)
|
||||
|
||||
@@ -171,7 +171,7 @@ func SettingsProtectedBranch(c *context.Context) {
|
||||
|
||||
// SettingsProtectedBranchPost updates the protected branch settings
|
||||
func SettingsProtectedBranchPost(ctx *context.Context) {
|
||||
f := web.GetForm(ctx).(*auth.ProtectBranchForm)
|
||||
f := web.GetForm(ctx).(*forms.ProtectBranchForm)
|
||||
branch := ctx.Params("*")
|
||||
if !ctx.Repo.GitRepo.IsBranchExist(branch) {
|
||||
ctx.NotFound("IsBranchExist", nil)
|
||||
|
||||
@@ -11,11 +11,11 @@ import (
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
)
|
||||
@@ -49,7 +49,7 @@ func TestAddReadOnlyDeployKey(t *testing.T) {
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 2)
|
||||
|
||||
addKeyForm := auth.AddKeyForm{
|
||||
addKeyForm := forms.AddKeyForm{
|
||||
Title: "read-only",
|
||||
Content: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4cn+iXnA4KvcQYSV88vGn0Yi91vG47t1P7okprVmhNTkipNRIHWr6WdCO4VDr/cvsRkuVJAsLO2enwjGWWueOO6BodiBgyAOZ/5t5nJNMCNuLGT5UIo/RI1b0WRQwxEZTRjt6mFNw6lH14wRd8ulsr9toSWBPMOGWoYs1PDeDL0JuTjL+tr1SZi/EyxCngpYszKdXllJEHyI79KQgeD0Vt3pTrkbNVTOEcCNqZePSVmUH8X8Vhugz3bnE0/iE9Pb5fkWO9c4AnM1FgI/8Bvp27Fw2ShryIXuR6kKvUqhVMTuOSDHwu6A8jLE5Owt3GAYugDpDYuwTVNGrHLXKpPzrGGPE/jPmaLCMZcsdkec95dYeU3zKODEm8UQZFhmJmDeWVJ36nGrGZHL4J5aTTaeFUJmmXDaJYiJ+K2/ioKgXqnXvltu0A9R8/LGy4nrTJRr4JMLuJFoUXvGm1gXQ70w2LSpk6yl71RNC0hCtsBe8BP8IhYCM0EP5jh7eCMQZNvM= nocomment\n",
|
||||
}
|
||||
@@ -78,7 +78,7 @@ func TestAddReadWriteOnlyDeployKey(t *testing.T) {
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 2)
|
||||
|
||||
addKeyForm := auth.AddKeyForm{
|
||||
addKeyForm := forms.AddKeyForm{
|
||||
Title: "read-write",
|
||||
Content: "ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQC4cn+iXnA4KvcQYSV88vGn0Yi91vG47t1P7okprVmhNTkipNRIHWr6WdCO4VDr/cvsRkuVJAsLO2enwjGWWueOO6BodiBgyAOZ/5t5nJNMCNuLGT5UIo/RI1b0WRQwxEZTRjt6mFNw6lH14wRd8ulsr9toSWBPMOGWoYs1PDeDL0JuTjL+tr1SZi/EyxCngpYszKdXllJEHyI79KQgeD0Vt3pTrkbNVTOEcCNqZePSVmUH8X8Vhugz3bnE0/iE9Pb5fkWO9c4AnM1FgI/8Bvp27Fw2ShryIXuR6kKvUqhVMTuOSDHwu6A8jLE5Owt3GAYugDpDYuwTVNGrHLXKpPzrGGPE/jPmaLCMZcsdkec95dYeU3zKODEm8UQZFhmJmDeWVJ36nGrGZHL4J5aTTaeFUJmmXDaJYiJ+K2/ioKgXqnXvltu0A9R8/LGy4nrTJRr4JMLuJFoUXvGm1gXQ70w2LSpk6yl71RNC0hCtsBe8BP8IhYCM0EP5jh7eCMQZNvM= nocomment\n",
|
||||
IsWritable: true,
|
||||
|
||||
@@ -16,12 +16,12 @@ import (
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
"code.gitea.io/gitea/modules/convert"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/setting"
|
||||
api "code.gitea.io/gitea/modules/structs"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
"code.gitea.io/gitea/services/webhook"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
)
|
||||
@@ -153,7 +153,7 @@ func WebhooksNew(ctx *context.Context) {
|
||||
}
|
||||
|
||||
// ParseHookEvent convert web form content to models.HookEvent
|
||||
func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
|
||||
func ParseHookEvent(form forms.WebhookForm) *models.HookEvent {
|
||||
return &models.HookEvent{
|
||||
PushOnly: form.PushOnly(),
|
||||
SendEverything: form.SendEverything(),
|
||||
@@ -184,7 +184,7 @@ func ParseHookEvent(form auth.WebhookForm) *models.HookEvent {
|
||||
|
||||
// GiteaHooksNewPost response for creating Gitea webhook
|
||||
func GiteaHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewWebhookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewWebhookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -234,12 +234,12 @@ func GiteaHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// GogsHooksNewPost response for creating webhook
|
||||
func GogsHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewGogshookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewGogshookForm)
|
||||
newGogsWebhookPost(ctx, *form, models.GOGS)
|
||||
}
|
||||
|
||||
// newGogsWebhookPost response for creating gogs hook
|
||||
func newGogsWebhookPost(ctx *context.Context, form auth.NewGogshookForm, kind models.HookTaskType) {
|
||||
func newGogsWebhookPost(ctx *context.Context, form forms.NewGogshookForm, kind models.HookTaskType) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.add_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -288,7 +288,7 @@ func newGogsWebhookPost(ctx *context.Context, form auth.NewGogshookForm, kind mo
|
||||
|
||||
// DiscordHooksNewPost response for creating discord hook
|
||||
func DiscordHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewDiscordHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewDiscordHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -341,7 +341,7 @@ func DiscordHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// DingtalkHooksNewPost response for creating dingtalk hook
|
||||
func DingtalkHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewDingtalkHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewDingtalkHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -384,7 +384,7 @@ func DingtalkHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// TelegramHooksNewPost response for creating telegram hook
|
||||
func TelegramHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewTelegramHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewTelegramHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -437,7 +437,7 @@ func TelegramHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// MatrixHooksNewPost response for creating a Matrix hook
|
||||
func MatrixHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewMatrixHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewMatrixHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -493,7 +493,7 @@ func MatrixHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// MSTeamsHooksNewPost response for creating MS Teams hook
|
||||
func MSTeamsHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewMSTeamsHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewMSTeamsHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -536,7 +536,7 @@ func MSTeamsHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// SlackHooksNewPost response for creating slack hook
|
||||
func SlackHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewSlackHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewSlackHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -597,7 +597,7 @@ func SlackHooksNewPost(ctx *context.Context) {
|
||||
|
||||
// FeishuHooksNewPost response for creating feishu hook
|
||||
func FeishuHooksNewPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewFeishuHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewFeishuHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksNew"] = true
|
||||
@@ -701,7 +701,7 @@ func WebHooksEdit(ctx *context.Context) {
|
||||
|
||||
// WebHooksEditPost response for editing web hook
|
||||
func WebHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewWebhookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewWebhookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -742,7 +742,7 @@ func WebHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// GogsHooksEditPost response for editing gogs hook
|
||||
func GogsHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewGogshookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewGogshookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.update_webhook")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -782,7 +782,7 @@ func GogsHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// SlackHooksEditPost response for editing slack hook
|
||||
func SlackHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewSlackHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewSlackHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -834,7 +834,7 @@ func SlackHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// DiscordHooksEditPost response for editing discord hook
|
||||
func DiscordHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewDiscordHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewDiscordHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -878,7 +878,7 @@ func DiscordHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// DingtalkHooksEditPost response for editing discord hook
|
||||
func DingtalkHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewDingtalkHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewDingtalkHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -911,7 +911,7 @@ func DingtalkHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// TelegramHooksEditPost response for editing discord hook
|
||||
func TelegramHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewTelegramHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewTelegramHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -953,7 +953,7 @@ func TelegramHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// MatrixHooksEditPost response for editing a Matrix hook
|
||||
func MatrixHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewMatrixHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewMatrixHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -998,7 +998,7 @@ func MatrixHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// MSTeamsHooksEditPost response for editing MS Teams hook
|
||||
func MSTeamsHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewMSTeamsHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewMSTeamsHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
@@ -1031,7 +1031,7 @@ func MSTeamsHooksEditPost(ctx *context.Context) {
|
||||
|
||||
// FeishuHooksEditPost response for editing feishu hook
|
||||
func FeishuHooksEditPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewFeishuHookForm)
|
||||
form := web.GetForm(ctx).(*forms.NewFeishuHookForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings")
|
||||
ctx.Data["PageIsSettingsHooks"] = true
|
||||
ctx.Data["PageIsSettingsHooksEdit"] = true
|
||||
|
||||
@@ -16,7 +16,6 @@ import (
|
||||
"code.gitea.io/gitea/models"
|
||||
"code.gitea.io/gitea/modules/base"
|
||||
"code.gitea.io/gitea/modules/context"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/log"
|
||||
"code.gitea.io/gitea/modules/markup"
|
||||
@@ -24,6 +23,7 @@ import (
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
wiki_service "code.gitea.io/gitea/services/wiki"
|
||||
)
|
||||
|
||||
@@ -559,7 +559,7 @@ func NewWiki(ctx *context.Context) {
|
||||
|
||||
// NewWikiPost response for wiki create request
|
||||
func NewWikiPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewWikiForm)
|
||||
form := web.GetForm(ctx).(*forms.NewWikiForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
@@ -617,7 +617,7 @@ func EditWiki(ctx *context.Context) {
|
||||
|
||||
// EditWikiPost response for wiki modify request
|
||||
func EditWikiPost(ctx *context.Context) {
|
||||
form := web.GetForm(ctx).(*auth.NewWikiForm)
|
||||
form := web.GetForm(ctx).(*forms.NewWikiForm)
|
||||
ctx.Data["Title"] = ctx.Tr("repo.wiki.new_page")
|
||||
ctx.Data["PageIsWiki"] = true
|
||||
ctx.Data["RequireSimpleMDE"] = true
|
||||
|
||||
@@ -10,10 +10,10 @@ import (
|
||||
"testing"
|
||||
|
||||
"code.gitea.io/gitea/models"
|
||||
auth "code.gitea.io/gitea/modules/forms"
|
||||
"code.gitea.io/gitea/modules/git"
|
||||
"code.gitea.io/gitea/modules/test"
|
||||
"code.gitea.io/gitea/modules/web"
|
||||
"code.gitea.io/gitea/services/forms"
|
||||
wiki_service "code.gitea.io/gitea/services/wiki"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
@@ -115,7 +115,7 @@ func TestNewWikiPost(t *testing.T) {
|
||||
ctx := test.MockContext(t, "user2/repo1/wiki/_new")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &auth.NewWikiForm{
|
||||
web.SetForm(ctx, &forms.NewWikiForm{
|
||||
Title: title,
|
||||
Content: content,
|
||||
Message: message,
|
||||
@@ -133,7 +133,7 @@ func TestNewWikiPost_ReservedName(t *testing.T) {
|
||||
ctx := test.MockContext(t, "user2/repo1/wiki/_new")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &auth.NewWikiForm{
|
||||
web.SetForm(ctx, &forms.NewWikiForm{
|
||||
Title: "_edit",
|
||||
Content: content,
|
||||
Message: message,
|
||||
@@ -167,7 +167,7 @@ func TestEditWikiPost(t *testing.T) {
|
||||
ctx.SetParams(":page", "Home")
|
||||
test.LoadUser(t, ctx, 2)
|
||||
test.LoadRepo(t, ctx, 1)
|
||||
web.SetForm(ctx, &auth.NewWikiForm{
|
||||
web.SetForm(ctx, &forms.NewWikiForm{
|
||||
Title: title,
|
||||
Content: content,
|
||||
Message: message,
|
||||
|
||||
Reference in New Issue
Block a user