Mirror updates
This commit is contained in:
parent
003298ef1d
commit
b9b82cfe47
9 changed files with 76 additions and 9 deletions
|
@ -4,4 +4,5 @@ filesets:
|
||||||
- public
|
- public
|
||||||
- conf
|
- conf
|
||||||
- LICENSE
|
- LICENSE
|
||||||
- README.md
|
- README.md
|
||||||
|
- README_ZH.md
|
|
@ -52,6 +52,8 @@ DISENABLE_REGISTERATION = false
|
||||||
REQUIRE_SIGNIN_VIEW = false
|
REQUIRE_SIGNIN_VIEW = false
|
||||||
; Cache avatar as picture
|
; Cache avatar as picture
|
||||||
ENABLE_CACHE_AVATAR = false
|
ENABLE_CACHE_AVATAR = false
|
||||||
|
; Mail notification
|
||||||
|
ENABLE_NOTIFY_MAIL = false
|
||||||
|
|
||||||
[mailer]
|
[mailer]
|
||||||
ENABLED = false
|
ENABLED = false
|
||||||
|
|
|
@ -58,6 +58,7 @@ func CreateIssue(userId, repoId, milestoneId, assigneeId int64, name, labels, co
|
||||||
Content: content,
|
Content: content,
|
||||||
}
|
}
|
||||||
_, err = orm.Insert(issue)
|
_, err = orm.Insert(issue)
|
||||||
|
// TODO: newIssueAction
|
||||||
return issue, err
|
return issue, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -67,9 +68,9 @@ func GetIssueCount(repoId int64) (int64, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// GetIssueById returns issue object by given id.
|
// GetIssueById returns issue object by given id.
|
||||||
func GetIssueById(id int64) (*Issue, error) {
|
func GetIssueByIndex(repoId, index int64) (*Issue, error) {
|
||||||
issue := new(Issue)
|
issue := &Issue{RepoId: repoId, Index: index}
|
||||||
has, err := orm.Id(id).Get(issue)
|
has, err := orm.Get(issue)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
} else if !has {
|
} else if !has {
|
||||||
|
@ -126,6 +127,18 @@ func GetIssues(userId, repoId, posterId, milestoneId int64, page int, isClosed,
|
||||||
return issues, err
|
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.
|
// Label represents a list of labels of repository for issues.
|
||||||
type Label struct {
|
type Label struct {
|
||||||
Id int64
|
Id int64
|
||||||
|
|
|
@ -66,6 +66,7 @@ var Service struct {
|
||||||
DisenableRegisteration bool
|
DisenableRegisteration bool
|
||||||
RequireSignInView bool
|
RequireSignInView bool
|
||||||
EnableCacheAvatar bool
|
EnableCacheAvatar bool
|
||||||
|
NotifyMail bool
|
||||||
ActiveCodeLives int
|
ActiveCodeLives int
|
||||||
ResetPwdCodeLives int
|
ResetPwdCodeLives int
|
||||||
}
|
}
|
||||||
|
@ -230,6 +231,17 @@ func newRegisterMailService() {
|
||||||
log.Info("Register Mail Service Enabled")
|
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() {
|
func NewConfigContext() {
|
||||||
var err error
|
var err error
|
||||||
workDir, err := exeDir()
|
workDir, err := exeDir()
|
||||||
|
@ -284,4 +296,5 @@ func NewServices() {
|
||||||
newSessionService()
|
newSessionService()
|
||||||
newMailService()
|
newMailService()
|
||||||
newRegisterMailService()
|
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) {
|
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 {
|
if err != nil {
|
||||||
ctx.Handle(404, "issue.ViewIssue", err)
|
ctx.Handle(404, "issue.ViewIssue", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
issue, err := models.GetIssueById(int64(issueid))
|
issue, err := models.GetIssueByIndex(ctx.Repo.Repository.Id, int64(index))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
if err == models.ErrIssueNotExist {
|
if err == models.ErrIssueNotExist {
|
||||||
ctx.Handle(404, "issue.ViewIssue", err)
|
ctx.Handle(404, "issue.ViewIssue", err)
|
||||||
|
@ -87,3 +87,39 @@ func ViewIssue(ctx *middleware.Context, params martini.Params) {
|
||||||
ctx.Data["Issue"] = issue
|
ctx.Data["Issue"] = issue
|
||||||
ctx.HTML(200, "issue/view")
|
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>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>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>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>
|
<div><b>Enable Cache Avatar:</b> <i class="fa fa{{if .Service.EnableCacheAvatar}}-check{{end}}-square-o"></i></div>
|
||||||
<hr/>
|
<hr/>
|
||||||
<div><b>Active Code Lives:</b> {{.Service.ActiveCodeLives}} minutes</div>
|
<div><b>Active Code Lives:</b> {{.Service.ActiveCodeLives}} minutes</div>
|
||||||
|
|
|
@ -34,7 +34,7 @@
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<ul class="list-group">{{range .MyRepos}}
|
<ul class="list-group">{{range .MyRepos}}
|
||||||
<li class="list-group-item"><a href="/{{$.SignedUserName}}/{{.Name}}">
|
<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>
|
<i class="fa fa-book"></i>{{.Name}}</a>
|
||||||
</li>{{end}}
|
</li>{{end}}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -50,7 +50,7 @@
|
||||||
<ul class="list-unstyled repo-list">
|
<ul class="list-unstyled repo-list">
|
||||||
{{range .Repos}}
|
{{range .Repos}}
|
||||||
<li>
|
<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>
|
<h4>
|
||||||
<a href="/{{$owner.Name}}/{{.LowerName}}">{{.LowerName}}</a>
|
<a href="/{{$owner.Name}}/{{.LowerName}}">{{.LowerName}}</a>
|
||||||
</h4>
|
</h4>
|
||||||
|
|
3
web.go
3
web.go
|
@ -145,7 +145,8 @@ func runWeb(*cli.Context) {
|
||||||
r.Get("/commits/:branchname", repo.Commits)
|
r.Get("/commits/:branchname", repo.Commits)
|
||||||
r.Get("/issues", repo.Issues)
|
r.Get("/issues", repo.Issues)
|
||||||
r.Any("/issues/new", binding.BindIgnErr(auth.CreateIssueForm{}), repo.CreateIssue)
|
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("/pulls", repo.Pulls)
|
||||||
r.Get("/branches", repo.Branches)
|
r.Get("/branches", repo.Branches)
|
||||||
r.Get("/src/:branchname", repo.Single)
|
r.Get("/src/:branchname", repo.Single)
|
||||||
|
|
Loading…
Reference in a new issue