|
- // Copyright 2019 The Gitea Authors. All rights reserved.
- // Use of this source code is governed by a MIT-style
- // license that can be found in the LICENSE file.
-
- package mail
-
- import (
- "code.gitea.io/gitea/models"
- "code.gitea.io/gitea/modules/auth/wechat"
- "code.gitea.io/gitea/modules/notification/base"
- "time"
- )
-
- type wechatNotifier struct {
- base.NullNotifier
- }
-
- var (
- _ base.Notifier = &wechatNotifier{}
- )
-
- // NewNotifier create a new wechatNotifier notifier
- func NewNotifier() base.Notifier {
- return &wechatNotifier{}
- }
-
- func (*wechatNotifier) NotifyChangeCloudbrainStatus(cloudbrain *models.Cloudbrain, oldStatus string) {
- operateType := wechat.GetJobOperateTypeFromCloudbrainStatus(cloudbrain)
- if operateType == "" {
- return
- }
- switch operateType {
- case wechat.JobOperateTypeStart:
- if cloudbrain.JobType == string(models.JobTypeDebug) {
- go wechat.SendCloudbrainStartedMsg(operateType, *cloudbrain, time.Unix(int64(cloudbrain.StartTime), 0))
- }
- }
- }
|