1
0
Fork 0
mirror of https://codeberg.org/forgejo/forgejo.git synced 2024-12-21 12:44:49 -05:00
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"
MailAuthActivateEmail base.TplName = "auth/activate_email"
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"
MAIL_ISSUE_MENTION base.TplName = "issue/mention"
MailIssueComment base.TplName = "issue/comment"
MailIssueMention base.TplName = "issue/mention"
MAIL_NOTIFY_COLLABORATOR base.TplName = "notify/collaborator"
MailNotifyCollaborator base.TplName = "notify/collaborator"
)
type MailRender interface {
@ -109,7 +109,7 @@ func SendRegisterNotifyMail(c *macaron.Context, u *User) {
data := map[string]interface{}{
"Username": u.DisplayName(),
}
body, err := mailRender.HTMLString(string(MAIL_AUTH_REGISTER_NOTIFY), data)
body, err := mailRender.HTMLString(string(MailAuthRegisterNotify), data)
if err != nil {
log.Error(3, "HTMLString: %v", err)
return
@ -131,7 +131,7 @@ func SendCollaboratorMail(u, doer *User, repo *Repository) {
"RepoName": repoName,
"Link": repo.HTMLURL(),
}
body, err := mailRender.HTMLString(string(MAIL_NOTIFY_COLLABORATOR), data)
body, err := mailRender.HTMLString(string(MailNotifyCollaborator), data)
if err != nil {
log.Error(3, "HTMLString: %v", err)
return
@ -171,7 +171,7 @@ func SendIssueCommentMail(issue *Issue, doer *User, tos []string) {
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.
@ -179,5 +179,5 @@ func SendIssueMentionMail(issue *Issue, doer *User, tos []string) {
if len(tos) == 0 {
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()
const (
_MIRROR_UPDATE = "mirror_update"
_GIT_FSCK = "git_fsck"
_CHECK_REPOs = "check_repos"
mirrorUpdate = "mirror_update"
gitFsck = "git_fsck"
checkRepos = "check_repos"
)
// GitFsck calls 'git fsck' to check repository health.
func GitFsck() {
if taskStatusTable.IsRunning(_GIT_FSCK) {
if taskStatusTable.IsRunning(gitFsck) {
return
}
taskStatusTable.Start(_GIT_FSCK)
defer taskStatusTable.Stop(_GIT_FSCK)
taskStatusTable.Start(gitFsck)
defer taskStatusTable.Stop(gitFsck)
log.Trace("Doing: GitFsck")
@ -1686,11 +1686,11 @@ func repoStatsCheck(checker *repoChecker) {
}
func CheckRepoStats() {
if taskStatusTable.IsRunning(_CHECK_REPOs) {
if taskStatusTable.IsRunning(checkRepos) {
return
}
taskStatusTable.Start(_CHECK_REPOs)
defer taskStatusTable.Stop(_CHECK_REPOs)
taskStatusTable.Start(checkRepos)
defer taskStatusTable.Stop(checkRepos)
log.Trace("Doing: CheckRepoStats")

View file

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