Mirror updates

tokarchuk/v1.17
Unknown 11 years ago
parent 003298ef1d
commit b9b82cfe47
  1. 3
      .gobuild.yml
  2. 2
      conf/app.ini
  3. 19
      models/issue.go
  4. 13
      modules/base/conf.go
  5. 40
      routers/repo/issue.go
  6. 1
      templates/admin/config.tmpl
  7. 2
      templates/user/dashboard.tmpl
  8. 2
      templates/user/profile.tmpl
  9. 3
      web.go

@ -4,4 +4,5 @@ filesets:
- public
- conf
- LICENSE
- README.md
- README.md
- README_ZH.md

@ -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

@ -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

@ -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()
}

@ -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
}

@ -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>

@ -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>

@ -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)

Loading…
Cancel
Save