fix(notify): fix webhook brand (#18723)

Co-authored-by: 马鸿飞 <mahongfei@yunion.cn>
This commit is contained in:
gouqi11
2023-11-17 15:37:08 +08:00
committed by GitHub
co-authored by 马鸿飞
parent 7f3cc23f78
commit 2309dfc27c
+4 -2
View File
@@ -842,8 +842,10 @@ func (n *SNotification) GetTemplate(ctx context.Context, topicId, lang string, n
return out, errors.Wrapf(err, "unable to parse json from %q", no.Message)
}
msg := msgObj.(*jsonutils.JSONDict)
if info, _ := TemplateManager.GetCompanyInfo(ctx); len(info.Name) > 0 {
msg.Set("brand", jsonutils.NewString(info.Name))
if !msg.Contains("brand") {
if info, _ := TemplateManager.GetCompanyInfo(ctx); len(info.Name) > 0 {
msg.Set("brand", jsonutils.NewString(info.Name))
}
}
webhookMsg := jsonutils.NewDict()
webhookMsg.Set("resource_type", jsonutils.NewString(rtStr))