fix: update to 1.14.3

mj-v1.14.3
domi41 3 years ago
parent e7eb1acca9
commit 9bbcc8ae23

@ -1,8 +1,12 @@
package auth // not sure why this is in package auth?
package forms
import (
"gitea.com/macaron/binding"
"gitea.com/macaron/macaron"
"net/http"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/web/middleware"
"gitea.com/go-chi/binding"
)
// Form for creating a poll
@ -11,7 +15,8 @@ type CreatePollForm struct {
Description string
}
// Validate validates the form fields
func (f *CreatePollForm) Validate(ctx *macaron.Context, errs binding.Errors) binding.Errors {
return validate(errs, ctx.Data, f, ctx.Locale)
// Validate the form fields
func (f *CreatePollForm) Validate(req *http.Request, errs binding.Errors) binding.Errors {
ctx := context.GetContext(req)
return middleware.Validate(errs, ctx.Data, f, ctx.Locale)
}

@ -6,10 +6,11 @@ package repo
import (
"code.gitea.io/gitea/models"
"code.gitea.io/gitea/modules/auth"
"code.gitea.io/gitea/modules/base"
"code.gitea.io/gitea/modules/context"
"code.gitea.io/gitea/modules/forms"
"code.gitea.io/gitea/modules/markup/markdown"
"code.gitea.io/gitea/modules/web"
//"code.gitea.io/gitea/modules/setting"
//"code.gitea.io/gitea/modules/timeutil"
//"time"
@ -57,7 +58,8 @@ func NewPoll(ctx *context.Context) {
}
// NewPollPost processes the "new poll" form and redirects
func NewPollPost(ctx *context.Context, form auth.CreatePollForm) {
func NewPollPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.CreatePollForm)
ctx.Data["Title"] = ctx.Tr("repo.polls.new")
ctx.Data["PageIsPolls"] = true
if ctx.HasError() {
@ -123,7 +125,8 @@ func EditPoll(ctx *context.Context) {
}
// EditPollPost response for edting poll
func EditPollPost(ctx *context.Context, form auth.CreatePollForm) {
func EditPollPost(ctx *context.Context) {
form := web.GetForm(ctx).(*forms.CreatePollForm)
ctx.Data["Title"] = ctx.Tr("repo.polls.edit")
ctx.Data["PageIsPolls"] = true
ctx.Data["PageIsEditPoll"] = true

@ -722,6 +722,10 @@ func RegisterRoutes(m *web.Route) {
m.Combo("/compare/*", repo.MustBeNotEmpty, reqRepoCodeReader, repo.SetEditorconfigIfExists).
Get(ignSignIn, repo.SetDiffViewStyle, repo.SetWhitespaceBehavior, repo.CompareDiff).
Post(reqSignIn, context.RepoMustNotBeArchived(), reqRepoPullsReader, repo.MustAllowPulls, bindIgnErr(auth.CreateIssueForm{}), repo.SetWhitespaceBehavior, repo.CompareAndPullRequestPost)
m.Group("/polls", func() {
m.Get("", repo.IndexPolls)
m.Get("/{id}", repo.ViewPoll)
}, context.RepoAssignment, context.RepoRef())
}, context.RepoAssignment, context.UnitTypes())
// Grouping for those endpoints that do require authentication
@ -800,6 +804,17 @@ func RegisterRoutes(m *web.Route) {
m.Post("/{index}/target_branch", repo.UpdatePullRequestTarget)
}, context.RepoMustNotBeArchived())
m.Group("/polls", func() {
m.Combo("/new").
Get(repo.NewPoll).
Post(bindIgnErr(auth.CreatePollForm{}), repo.NewPollPost)
m.Get("/{id}/edit", repo.EditPoll)
m.Post("/{id}/edit", bindIgnErr(auth.CreatePollForm{}), repo.EditPollPost)
m.Post("/{id}/delete", repo.DeletePoll)
m.Post("/{id}/judgments", repo.EmitJudgment)
//m.Delete("/{id}/judgments", repo.DeleteJudgment)
}, context.RepoMustNotBeArchived())
m.Group("", func() {
m.Group("", func() {
m.Combo("/_edit/*").Get(repo.EditFile).

@ -72,6 +72,7 @@ Research notes:
display: inline-block;
left: -9px;
opacity: 1.0;
padding-left: 1em;
}
.judgment-forms {
@ -137,12 +138,13 @@ Research notes:
content: "×";
pointer-events: none;
position: absolute;
top: 0.05em;
left: 0.05em;
top: 0;
left: 0;
color: darkred;
opacity: 0.8;
font-size: 3em;
z-index: 3;
line-height: 62%;
}
.judgment-form input.emote:hover,

Loading…
Cancel
Save