From 2309dfc27caf7c6f7178a842e21e14f025aa248b Mon Sep 17 00:00:00 2001 From: gouqi11 <66834753+gouqi11@users.noreply.github.com> Date: Fri, 17 Nov 2023 15:37:08 +0800 Subject: [PATCH] fix(notify): fix webhook brand (#18723) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: 马鸿飞 --- pkg/notify/models/notification.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/pkg/notify/models/notification.go b/pkg/notify/models/notification.go index bd3b35b718..32af242b5b 100644 --- a/pkg/notify/models/notification.go +++ b/pkg/notify/models/notification.go @@ -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))