You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dolphinscheduler.apache.org by GitBox <gi...@apache.org> on 2022/01/12 06:30:36 UTC

[GitHub] [dolphinscheduler] caishunfeng commented on a change in pull request #7805: [Feature-7804][Task] DingTalk alert plugin adds signature.

caishunfeng commented on a change in pull request #7805:
URL: https://github.com/apache/dolphinscheduler/pull/7805#discussion_r782740820



##########
File path: dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkParamsConstants.java
##########
@@ -27,6 +27,9 @@
     static final String DING_TALK_KEYWORD = "$t('keyword')";
     static final String NAME_DING_TALK_KEYWORD = "Keyword";
 
+    static final String DING_TALK_SECRET = "$t('secret')";
+    static final String NAME_DING_TALK_SECRET = "secret";

Review comment:
       ```suggestion
       static final String NAME_DING_TALK_SECRET = "Secret";
   ```

##########
File path: dolphinscheduler-alert/dolphinscheduler-alert-plugins/dolphinscheduler-alert-dingtalk/src/main/java/org/apache/dolphinscheduler/plugin/alert/dingtalk/DingTalkSender.java
##########
@@ -145,8 +159,18 @@ public AlertResult sendDingTalkMsg(String title, String content) {
 
     private String sendMsg(String title, String content) throws IOException {
 
-        String msgToJson = textToJsonString(title + content + "#" + keyword);
-        HttpPost httpPost = constructHttpPost(url, msgToJson);
+        StringBuilder text = new StringBuilder();
+        if (org.apache.dolphinscheduler.spi.utils.StringUtils.isNotBlank(keyword)) {
+            text.append(keyword);
+            text.append(":");
+        }
+        text.append(title);
+        text.append("\n");
+        text.append(content);
+
+        String msgToJson = textToJsonString(text.toString());

Review comment:
       Does the order make a difference?




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@dolphinscheduler.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org