diff options
author | Unknown <joe2010xtmf@163.com> | 2014-03-23 19:09:11 -0400 |
---|---|---|
committer | Unknown <joe2010xtmf@163.com> | 2014-03-23 19:09:11 -0400 |
commit | b9b82cfe477bcbfd3541adfc969ff20210d56549 (patch) | |
tree | 36020ddd1605414d1f11d1e0201d1ab05afe2880 | |
parent | 003298ef1d53e1d9837bcac5aadb2e9e159a7497 (diff) | |
download | gitea-b9b82cfe477bcbfd3541adfc969ff20210d56549.tar.gz gitea-b9b82cfe477bcbfd3541adfc969ff20210d56549.zip |
Mirror updates
-rw-r--r-- | .gobuild.yml | 3 | ||||
-rw-r--r-- | conf/app.ini | 2 | ||||
-rw-r--r-- | models/issue.go | 19 | ||||
-rw-r--r-- | modules/base/conf.go | 13 | ||||
-rw-r--r-- | routers/repo/issue.go | 40 | ||||
-rw-r--r-- | templates/admin/config.tmpl | 1 | ||||
-rw-r--r-- | templates/user/dashboard.tmpl | 2 | ||||
-rw-r--r-- | templates/user/profile.tmpl | 2 | ||||
-rw-r--r-- | web.go | 3 |
9 files changed, 76 insertions, 9 deletions
diff --git a/.gobuild.yml b/.gobuild.yml index d667c93082..78a38f2d31 100644 --- a/.gobuild.yml +++ b/.gobuild.yml @@ -4,4 +4,5 @@ filesets: - public - conf - LICENSE - - README.md
\ No newline at end of file + - README.md + - README_ZH.md
\ No newline at end of file diff --git a/conf/app.ini b/conf/app.ini index ee44dd408e..809ea61c07 100644 --- a/conf/app.ini +++ b/conf/app.ini @@ -52,6 +52,8 @@ DISENABLE_REGISTERATION = false REQUIRE_SIGNIN_VIEW = false ; Cache avatar as picture ENABLE_CACHE_AVATAR = false +; Mail notification +ENABLE_NOTIFY_MAIL = false [mailer] ENABLED = false diff --git a/models/issue.go b/models/issue.go index 929567b1b7..fe43a94b59 100644 --- a/models/issue.go +++ b/models/issue.go @@ -58,6 +58,7 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co Content: content, } _, err = orm.Insert(issue) + // TODO: newIssueAction return issue, err } @@ -67,9 +68,9 @@ func GetIssueCount(repoId int64) (int64, error) { } // GetIssueById returns issue object by given id. -func GetIssueById(id int64) (*Issue, error) { - issue := new(Issue) - has, err := orm.Id(id).Get(issue) +func GetIssueByIndex(repoId, index int64) (*Issue, error) { + issue := &Issue{RepoId: repoId, Index: index} + has, err := orm.Get(issue) if err != nil { return nil, err } else if !has { @@ -126,6 +127,18 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed, return issues, err } +// UpdateIssue updates information of issue. +func UpdateIssue(issue *Issue) error { + _, err := orm.Update(issue, &Issue{RepoId: issue.RepoId, Index: issue.Index}) + return err +} + +func CloseIssue() { +} + +func ReopenIssue() { +} + // Label represents a list of labels of repository for issues. type Label struct { Id int64 diff --git a/modules/base/conf.go b/modules/base/conf.go index b243a6ad58..2bf529d9d1 100644 --- a/modules/base/conf.go +++ b/modules/base/conf.go @@ -66,6 +66,7 @@ var Service struct { DisenableRegisteration bool RequireSignInView bool EnableCacheAvatar bool + NotifyMail bool ActiveCodeLives int ResetPwdCodeLives int } @@ -230,6 +231,17 @@ func newRegisterMailService() { log.Info("Register Mail Service Enabled") } +func newNotifyMailService() { + if !Cfg.MustBool("service", "ENABLE_NOTIFY_MAIL") { + return + } else if MailService == nil { + log.Warn("Notify Mail Service: Mail Service is not enabled") + return + } + Service.NotifyMail = true + log.Info("Notify Mail Service Enabled") +} + func NewConfigContext() { var err error workDir, err := exeDir() @@ -284,4 +296,5 @@ func NewServices() { newSessionService() newMailService() newRegisterMailService() + newNotifyMailService() } diff --git a/routers/repo/issue.go b/routers/repo/issue.go index a9d8799314..e03f115e24 100644 --- a/routers/repo/issue.go +++ b/routers/repo/issue.go @@ -67,13 +67,13 @@ func CreateIssue(ctx *middleware.Context, params martini.Params, form auth.Creat } func ViewIssue(ctx *middleware.Context, params martini.Params) { - issueid, err := base.StrTo(params["issueid"]).Int() + index, err := base.StrTo(params["index"]).Int() if err != nil { ctx.Handle(404, "issue.ViewIssue", err) return } - issue, err := models.GetIssueById(int64(issueid)) + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) if err != nil { if err == models.ErrIssueNotExist { ctx.Handle(404, "issue.ViewIssue", err) @@ -87,3 +87,39 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) { ctx.Data["Issue"] = issue ctx.HTML(200, "issue/view") } + +func UpdateIssue(ctx *middleware.Context, params martini.Params, form auth.CreateIssueForm) { + if !ctx.Repo.IsOwner { + ctx.Handle(404, "issue.UpdateIssue", nil) + return + } + + index, err := base.StrTo(params["index"]).Int() + if err != nil { + ctx.Handle(404, "issue.UpdateIssue", err) + return + } + + issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index)) + if err != nil { + if err == models.ErrIssueNotExist { + ctx.Handle(404, "issue.UpdateIssue", err) + } else { + ctx.Handle(200, "issue.UpdateIssue", err) + } + return + } + + issue.Name = form.IssueName + issue.MilestoneId = form.MilestoneId + issue.AssigneeId = form.AssigneeId + issue.Labels = form.Labels + issue.Content = form.Content + if err = models.UpdateIssue(issue); err != nil { + ctx.Handle(200, "issue.UpdateIssue", err) + return + } + + ctx.Data["Title"] = issue.Name + ctx.Data["Issue"] = issue +} diff --git a/templates/admin/config.tmpl b/templates/admin/config.tmpl index d33a07cc3f..1e26304602 100644 --- a/templates/admin/config.tmpl +++ b/templates/admin/config.tmpl @@ -46,6 +46,7 @@ <div><b>Register Email Confirmation:</b> <i class="fa fa{{if .Service.RegisterEmailConfirm}}-check{{end}}-square-o"></i></div> <div><b>Disenable Registeration:</b> <i class="fa fa{{if .Service.DisenableRegisteration}}-check{{end}}-square-o"></i></div> <div><b>Require Sign In View:</b> <i class="fa fa{{if .Service.RequireSignInView}}-check{{end}}-square-o"></i></div> + <div><b>Mail Notification:</b> <i class="fa fa{{if .Service.NotifyMail}}-check{{end}}-square-o"></i></div> <div><b>Enable Cache Avatar:</b> <i class="fa fa{{if .Service.EnableCacheAvatar}}-check{{end}}-square-o"></i></div> <hr/> <div><b>Active Code Lives:</b> {{.Service.ActiveCodeLives}} minutes</div> diff --git a/templates/user/dashboard.tmpl b/templates/user/dashboard.tmpl index 6594e54591..ca5fecf268 100644 --- a/templates/user/dashboard.tmpl +++ b/templates/user/dashboard.tmpl @@ -34,7 +34,7 @@ <div class="panel-body"> <ul class="list-group">{{range .MyRepos}} <li class="list-group-item"><a href="/{{$.SignedUserName}}/{{.Name}}"> - <span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span> + <!-- <span class="stars pull-right"><i class="fa fa-star"></i>{{.NumStars}}</span> --> <i class="fa fa-book"></i>{{.Name}}</a> </li>{{end}} </ul> diff --git a/templates/user/profile.tmpl b/templates/user/profile.tmpl index 2d76d9bf01..3422361474 100644 --- a/templates/user/profile.tmpl +++ b/templates/user/profile.tmpl @@ -50,7 +50,7 @@ <ul class="list-unstyled repo-list"> {{range .Repos}} <li> - <div class="meta pull-right"><i class="fa fa-star"></i> {{.NumStars}} <i class="fa fa-code-fork"></i> {{.NumForks}}</div> + <div class="meta pull-right"><!-- <i class="fa fa-star"></i> {{.NumStars}} --> <i class="fa fa-code-fork"></i> {{.NumForks}}</div> <h4> <a href="/{{$owner.Name}}/{{.LowerName}}">{{.LowerName}}</a> </h4> @@ -145,7 +145,8 @@ func runWeb(*cli.Context) { r.Get("/commits/:branchname", repo.Commits) r.Get("/issues", repo.Issues) r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue) - r.Get("/issues/:issueid", repo.ViewIssue) + r.Get("/issues/:index", repo.ViewIssue) + r.Post("/issues/:index", binding.BindIgnErr(auth.CreateIssueForm{}), repo.UpdateIssue) r.Get("/pulls", repo.Pulls) r.Get("/branches", repo.Branches) r.Get("/src/:branchname", repo.Single) |