This commit is contained in:
Sandro Santilli 2016-11-07 17:41:28 +01:00
parent 05fd9d3f09
commit b3828e38a5
3 changed files with 20 additions and 20 deletions

View File

@ -23,12 +23,12 @@ const (
MailAuthActivate base.TplName = "auth/activate" MailAuthActivate base.TplName = "auth/activate"
MailAuthActivateEmail base.TplName = "auth/activate_email" MailAuthActivateEmail base.TplName = "auth/activate_email"
MailAuthResetPassword base.TplName = "auth/reset_passwd" MailAuthResetPassword base.TplName = "auth/reset_passwd"
MAIL_AUTH_REGISTER_NOTIFY base.TplName = "auth/register_notify" MailAuthRegisterNotify base.TplName = "auth/register_notify"
MAIL_ISSUE_COMMENT base.TplName = "issue/comment" MailIssueComment base.TplName = "issue/comment"
MAIL_ISSUE_MENTION base.TplName = "issue/mention" MailIssueMention base.TplName = "issue/mention"
MAIL_NOTIFY_COLLABORATOR base.TplName = "notify/collaborator" MailNotifyCollaborator base.TplName = "notify/collaborator"
) )
type MailRender interface { type MailRender interface {
@ -109,7 +109,7 @@ func SendRegisterNotifyMail(c *macaron.Context, u *User) {
data := map[string]interface{}{ data := map[string]interface{}{
"Username": u.DisplayName(), "Username": u.DisplayName(),
} }
body, err := mailRender.HTMLString(string(MAIL_AUTH_REGISTER_NOTIFY), data) body, err := mailRender.HTMLString(string(MailAuthRegisterNotify), data)
if err != nil { if err != nil {
log.Error(3, "HTMLString: %v", err) log.Error(3, "HTMLString: %v", err)
return return
@ -131,7 +131,7 @@ func SendCollaboratorMail(u, doer *User, repo *Repository) {
"RepoName": repoName, "RepoName": repoName,
"Link": repo.HTMLURL(), "Link": repo.HTMLURL(),
} }
body, err := mailRender.HTMLString(string(MAIL_NOTIFY_COLLABORATOR), data) body, err := mailRender.HTMLString(string(MailNotifyCollaborator), data)
if err != nil { if err != nil {
log.Error(3, "HTMLString: %v", err) log.Error(3, "HTMLString: %v", err)
return return
@ -171,7 +171,7 @@ func SendIssueCommentMail(issue *Issue, doer *User, tos []string) {
return return
} }
mailer.SendAsync(composeIssueMessage(issue, doer, MAIL_ISSUE_COMMENT, tos, "issue comment")) mailer.SendAsync(composeIssueMessage(issue, doer, MailIssueComment, tos, "issue comment"))
} }
// SendIssueMentionMail composes and sends issue mention emails to target receivers. // SendIssueMentionMail composes and sends issue mention emails to target receivers.
@ -179,5 +179,5 @@ func SendIssueMentionMail(issue *Issue, doer *User, tos []string) {
if len(tos) == 0 { if len(tos) == 0 {
return return
} }
mailer.SendAsync(composeIssueMessage(issue, doer, MAIL_ISSUE_MENTION, tos, "issue mention")) mailer.SendAsync(composeIssueMessage(issue, doer, MailIssueMention, tos, "issue mention"))
} }

View File

@ -1613,18 +1613,18 @@ func RewriteRepositoryUpdateHook() error {
var taskStatusTable = sync.NewStatusTable() var taskStatusTable = sync.NewStatusTable()
const ( const (
_MIRROR_UPDATE = "mirror_update" mirrorUpdate = "mirror_update"
_GIT_FSCK = "git_fsck" gitFsck = "git_fsck"
_CHECK_REPOs = "check_repos" checkRepos = "check_repos"
) )
// GitFsck calls 'git fsck' to check repository health. // GitFsck calls 'git fsck' to check repository health.
func GitFsck() { func GitFsck() {
if taskStatusTable.IsRunning(_GIT_FSCK) { if taskStatusTable.IsRunning(gitFsck) {
return return
} }
taskStatusTable.Start(_GIT_FSCK) taskStatusTable.Start(gitFsck)
defer taskStatusTable.Stop(_GIT_FSCK) defer taskStatusTable.Stop(gitFsck)
log.Trace("Doing: GitFsck") log.Trace("Doing: GitFsck")
@ -1686,11 +1686,11 @@ func repoStatsCheck(checker *repoChecker) {
} }
func CheckRepoStats() { func CheckRepoStats() {
if taskStatusTable.IsRunning(_CHECK_REPOs) { if taskStatusTable.IsRunning(checkRepos) {
return return
} }
taskStatusTable.Start(_CHECK_REPOs) taskStatusTable.Start(checkRepos)
defer taskStatusTable.Stop(_CHECK_REPOs) defer taskStatusTable.Stop(checkRepos)
log.Trace("Doing: CheckRepoStats") log.Trace("Doing: CheckRepoStats")

View File

@ -191,11 +191,11 @@ func DeleteMirrorByRepoID(repoID int64) error {
// MirrorUpdate checks and updates mirror repositories. // MirrorUpdate checks and updates mirror repositories.
func MirrorUpdate() { func MirrorUpdate() {
if taskStatusTable.IsRunning(_MIRROR_UPDATE) { if taskStatusTable.IsRunning(mirrorUpdate) {
return return
} }
taskStatusTable.Start(_MIRROR_UPDATE) taskStatusTable.Start(mirrorUpdate)
defer taskStatusTable.Stop(_MIRROR_UPDATE) defer taskStatusTable.Stop(mirrorUpdate)
log.Trace("Doing: MirrorUpdate") log.Trace("Doing: MirrorUpdate")