mirror of
https://github.com/yunionio/cloudpods.git
synced 2026-09-24 16:03:43 +08:00
Merge pull request #17041 from gouqi11/fixNotifyTemplateTranslate
fix(notify): add some template translate
This commit is contained in:
@@ -193,7 +193,15 @@ func (lt *SLocalTemplateManager) fillWithTemplate(ctx context.Context, titleOrCo
|
||||
err error
|
||||
)
|
||||
actionResultStr := event.ActionWithResult("_")
|
||||
for _, topic := range []string{specTopic(event), event.StringWithDeli("_"), actionResultStr, "common"} {
|
||||
topics := []string{specTopic(event), event.StringWithDeli("_"), actionResultStr}
|
||||
if event.Result() == api.ResultFailed {
|
||||
tempActionResourceArr := strings.Split(actionResultStr, "_")
|
||||
if len(tempActionResourceArr) > 1 {
|
||||
topics = append(topics, strings.Join(tempActionResourceArr[:len(tempActionResourceArr)-1], "_"))
|
||||
}
|
||||
}
|
||||
topics = append(topics, "common")
|
||||
for _, topic := range topics {
|
||||
if topic == "" {
|
||||
continue
|
||||
}
|
||||
@@ -574,11 +582,20 @@ func init() {
|
||||
"added to the recycle bin",
|
||||
"加入回收站",
|
||||
},
|
||||
|
||||
sI18nElme{
|
||||
string(api.ActionSyncUpdate),
|
||||
"sync_create",
|
||||
"同步新建",
|
||||
},
|
||||
sI18nElme{
|
||||
string(api.ActionSyncUpdate),
|
||||
"sync_update",
|
||||
"同步",
|
||||
"同步更新",
|
||||
},
|
||||
sI18nElme{
|
||||
string(api.ActionSyncUpdate),
|
||||
"sync_delete",
|
||||
"同步删除",
|
||||
},
|
||||
sI18nElme{
|
||||
string(api.ActionMigrate),
|
||||
|
||||
@@ -328,7 +328,7 @@ func (sm *STopicManager) InitializeData() error {
|
||||
notify.ActionOffline,
|
||||
)
|
||||
t.Type = notify.TOPIC_TYPE_RESOURCE
|
||||
t.Results = tristate.True
|
||||
t.Results = tristate.False
|
||||
case DefaultChecksumTestFailed:
|
||||
t.addResources(
|
||||
notify.TOPIC_RESOURCE_DB_TABLE_RECORD,
|
||||
|
||||
@@ -53,6 +53,9 @@ func (feishuSender *SFeishuSender) Send(args api.SendParams) error {
|
||||
if err == nil {
|
||||
return nil
|
||||
}
|
||||
if rep == nil {
|
||||
return errors.Wrap(err, "feishu.sendRequest")
|
||||
}
|
||||
// 发送通知失败的情况
|
||||
code, err := rep.GetString("code")
|
||||
if err != nil {
|
||||
|
||||
@@ -47,9 +47,9 @@ func sendRequest(url string, method httputils.THttpMethod, header http.Header, p
|
||||
if params != nil {
|
||||
url += params.Encode()
|
||||
}
|
||||
_, req, err := httputils.JSONRequest(cli, ctx, method, url, header, body, options.Options.DebugRequest)
|
||||
_, resp, err := httputils.JSONRequest(cli, ctx, method, url, header, body, options.Options.DebugRequest)
|
||||
if err != nil {
|
||||
return nil, utilerr.Wrap(err, "http request")
|
||||
return resp, utilerr.Wrap(err, "http request")
|
||||
}
|
||||
return req, nil
|
||||
return resp, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user