Render unknown for a zero CreatedAt in Slack/Mattermost messages (closes #298)
All checks were successful
check / check (push) Successful in 3m9s
All checks were successful
check / check (push) Successful in 3m9s
FormatSlackMessage rendered the Timestamp line unconditionally, so a reaped-row fallback delivery carried "0001-01-01T00:00:00Z" -- the exact string #257 was filed against, indistinguishable from that regression. When event.CreatedAt.IsZero(), render "unknown" instead; a real CreatedAt still renders as RFC3339.
This commit is contained in:
@@ -231,10 +231,15 @@ func FormatSlackMessage(
|
||||
event.ContentType,
|
||||
)
|
||||
|
||||
timestamp := "unknown"
|
||||
if !event.CreatedAt.IsZero() {
|
||||
timestamp = event.CreatedAt.UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
fmt.Fprintf(
|
||||
&b,
|
||||
"*Timestamp:* `%s`\n",
|
||||
event.CreatedAt.UTC().Format(time.RFC3339),
|
||||
timestamp,
|
||||
)
|
||||
|
||||
fmt.Fprintf(
|
||||
|
||||
Reference in New Issue
Block a user