Skip to content

Database governance built for humans and agents — controlling changes and access across every major database.

chore: remove the timestamp text from webhook (#2367)

Danny Xu1d4c6386388c
diff --git a/plugin/webhook/dingtalk.go b/plugin/webhook/dingtalk.go
index 6547e9d0bf..f9b8b89e20 100644
--- a/plugin/webhook/dingtalk.go
+++ b/plugin/webhook/dingtalk.go
@@ -7,7 +7,6 @@ import (
"io"
"net/http"
"strings"
- "time"
"github.com/pkg/errors"
)
@@ -44,7 +43,6 @@ func (*DingTalkReceiver) post(context Context) error {
metaStrList = append(metaStrList, fmt.Sprintf("##### **%s:** %s", meta.Name, meta.Value))
}
metaStrList = append(metaStrList, fmt.Sprintf("##### **By:** %s (%s)", context.CreatorName, context.CreatorEmail))
- metaStrList = append(metaStrList, fmt.Sprintf("##### **At:** %s", time.Unix(context.CreatedTs, 0).Format(timeFormat)))
text := fmt.Sprintf("# %s\n%s\n##### [View in Bytebase](%s)", context.Title, strings.Join(metaStrList, "\n"), context.Link)
if context.Description != "" {
diff --git a/plugin/webhook/discord.go b/plugin/webhook/discord.go
index f991009f64..ac8624f354 100644
--- a/plugin/webhook/discord.go
+++ b/plugin/webhook/discord.go
@@ -6,7 +6,6 @@ import (
"fmt"
"io"
"net/http"
- "time"
"github.com/pkg/errors"
)
@@ -74,7 +73,6 @@ func (*DiscordReceiver) post(context Context) error {
Type: "rich",
Description: context.Description,
URL: context.Link,
- Timestamp: time.Unix(context.CreatedTs, 0).Format(timeFormat),
Author: DiscordWebhookEmbedAuthor{
Name: fmt.Sprintf("%s (%s)", context.CreatorName, context.CreatorEmail),
},
diff --git a/plugin/webhook/feishu.go b/plugin/webhook/feishu.go
index c113c98ccd..9de215c825 100644
--- a/plugin/webhook/feishu.go
+++ b/plugin/webhook/feishu.go
@@ -6,7 +6,6 @@ import (
"fmt"
"io"
"net/http"
- "time"
"github.com/pkg/errors"
)
@@ -95,15 +94,6 @@ func (*FeishuReceiver) post(context Context) error {
contentList = append(contentList, sectionList)
}
- {
- sectionList := []FeishuWebhookPostSection{}
- sectionList = append(sectionList, FeishuWebhookPostSection{
- Tag: "text",
- Text: fmt.Sprintf("At: %s", time.Unix(context.CreatedTs, 0).Format(timeFormat)),
- })
- contentList = append(contentList, sectionList)
- }
-
{
sectionList := []FeishuWebhookPostSection{}
sectionList = append(sectionList, FeishuWebhookPostSection{
diff --git a/plugin/webhook/slack.go b/plugin/webhook/slack.go
index 655bee89f3..a1e4b51185 100644
--- a/plugin/webhook/slack.go
+++ b/plugin/webhook/slack.go
@@ -6,7 +6,6 @@ import (
"fmt"
"io"
"net/http"
- "time"
"github.com/pkg/errors"
)
@@ -99,14 +98,6 @@ func (*SlackReceiver) post(context Context) error {
},
})
- blockList = append(blockList, SlackWebhookBlock{
- Type: "section",
- Text: &SlackWebhookBlockMarkdown{
- Type: "mrkdwn",
- Text: fmt.Sprintf("At: %s", time.Unix(context.CreatedTs, 0).Format(timeFormat)),
- },
- })
-
blockList = append(blockList, SlackWebhookBlock{
Type: "actions",
ElementList: []SlackWebhookElement{
diff --git a/plugin/webhook/teams.go b/plugin/webhook/teams.go
index 736f3edf64..5b85da8b3a 100644
--- a/plugin/webhook/teams.go
+++ b/plugin/webhook/teams.go
@@ -6,7 +6,6 @@ import (
"fmt"
"io"
"net/http"
- "time"
"github.com/pkg/errors"
)
@@ -73,10 +72,9 @@ func (*TeamsReceiver) post(context Context) error {
Title: context.Title,
SectionList: []TeamsWebhookSection{
{
- ActivityTitle: fmt.Sprintf("%s (%s)", context.CreatorName, context.CreatorEmail),
- ActivitySubtitle: time.Unix(context.CreatedTs, 0).Format(timeFormat),
- FactList: factList,
- Text: context.Description,
+ ActivityTitle: fmt.Sprintf("%s (%s)", context.CreatorName, context.CreatorEmail),
+ FactList: factList,
+ Text: context.Description,
},
},
ActionList: []TeamsWebhookAction{
diff --git a/plugin/webhook/webhook.go b/plugin/webhook/webhook.go
index 00f24d1fce..933ab872f0 100644
--- a/plugin/webhook/webhook.go
+++ b/plugin/webhook/webhook.go
@@ -11,8 +11,7 @@ var (
receiverMu sync.RWMutex
receivers = make(map[string]Receiver)
// Based on the local test, Teams sometimes cannot finish the request in 1 second, so use 3s.
- timeout = 3 * time.Second
- timeFormat = "2006-01-02 15:04:05"
+ timeout = 3 * time.Second
)
// meta is the webhook metadata.
diff --git a/plugin/webhook/wecom.go b/plugin/webhook/wecom.go
index 7f153b3f9e..302e8fec62 100644
--- a/plugin/webhook/wecom.go
+++ b/plugin/webhook/wecom.go
@@ -7,7 +7,6 @@ import (
"io"
"net/http"
"strings"
- "time"
"github.com/pkg/errors"
)
@@ -43,7 +42,6 @@ func (*WeComReceiver) post(context Context) error {
metaStrList = append(metaStrList, fmt.Sprintf("%s: <font color=\"comment\">%s</font>", meta.Name, meta.Value))
}
metaStrList = append(metaStrList, fmt.Sprintf("By: <font color=\"comment\">%s (%s)</font>", context.CreatorName, context.CreatorEmail))
- metaStrList = append(metaStrList, fmt.Sprintf("At: <font color=\"comment\">%s</font>", time.Unix(context.CreatedTs, 0).Format(timeFormat)))
status := ""
switch context.Level {