diff --git a/pkg/services/alerting/notifiers/dingding.go b/pkg/services/alerting/notifiers/dingding.go
index 3514554a1db..a3934903bd6 100644
--- a/pkg/services/alerting/notifiers/dingding.go
+++ b/pkg/services/alerting/notifiers/dingding.go
@@ -22,11 +22,6 @@ const DingdingOptionsTemplate = `
MessageType
-
- OpenInBrowser
-
- Open the message url in browser instead of inside of Dingding
-
`
func init() {
@@ -47,23 +42,20 @@ func NewDingDingNotifier(model *m.AlertNotification) (alerting.Notifier, error)
}
msgType := model.Settings.Get("msgType").MustString(DefaultDingdingMsgType)
- openInBrowser := model.Settings.Get("openInBrowser").MustBool(true)
return &DingDingNotifier{
- NotifierBase: NewNotifierBase(model),
- OpenInBrowser: openInBrowser,
- MsgType: msgType,
- Url: url,
- log: log.New("alerting.notifier.dingding"),
+ NotifierBase: NewNotifierBase(model),
+ MsgType: msgType,
+ Url: url,
+ log: log.New("alerting.notifier.dingding"),
}, nil
}
type DingDingNotifier struct {
NotifierBase
- MsgType string
- OpenInBrowser bool //Set whether the message url will open outside of Dingding
- Url string
- log log.Logger
+ MsgType string
+ Url string
+ log log.Logger
}
func (this *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
@@ -75,17 +67,15 @@ func (this *DingDingNotifier) Notify(evalContext *alerting.EvalContext) error {
messageUrl = ""
}
- if this.OpenInBrowser {
- q := url.Values{
- "pc_slide": {"false"},
- "url": {messageUrl},
- }
-
- // Use special link to auto open the message url outside of Dingding
- // Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=385&articleId=104972&docType=1#s9
- messageUrl = "dingtalk://dingtalkclient/page/link?" + q.Encode()
+ q := url.Values{
+ "pc_slide": {"false"},
+ "url": {messageUrl},
}
+ // Use special link to auto open the message url outside of Dingding
+ // Refer: https://open-doc.dingtalk.com/docs/doc.htm?treeId=385&articleId=104972&docType=1#s9
+ messageUrl = "dingtalk://dingtalkclient/page/link?" + q.Encode()
+
this.log.Info("messageUrl:" + messageUrl)
message := evalContext.Rule.Message