(context webhook.Context)
| 223 | } |
| 224 | |
| 225 | func getMessageCard(context webhook.Context) *WebhookCard { |
| 226 | var markdownBuf strings.Builder |
| 227 | |
| 228 | if context.Description != "" { |
| 229 | _, _ = fmt.Fprintf(&markdownBuf, "%s\n", context.Description) |
| 230 | } |
| 231 | |
| 232 | for _, meta := range context.GetMetaList() { |
| 233 | _, _ = fmt.Fprintf(&markdownBuf, "**%s**: %s\n", meta.Name, meta.Value) |
| 234 | } |
| 235 | |
| 236 | if context.ActorName != "" { |
| 237 | _, _ = fmt.Fprintf(&markdownBuf, "**Actor**: %s (%s)\n", context.ActorName, context.ActorEmail) |
| 238 | } |
| 239 | _, _ = fmt.Fprintf(&markdownBuf, "[View in Bytebase](%s)", context.Link) |
| 240 | |
| 241 | return &WebhookCard{ |
| 242 | Config: WebhookCardConfig{ |
| 243 | WideScreenMode: true, |
| 244 | EnableForward: true, |
| 245 | }, |
| 246 | Header: WebhookCardHeader{ |
| 247 | Title: WebhookCardHeaderTitle{ |
| 248 | Content: context.Title, |
| 249 | Tag: "plain_text", |
| 250 | }, |
| 251 | }, |
| 252 | I18nElements: WebhookCardI18nElements{ |
| 253 | English: []WebhookMarkdownSection{ |
| 254 | { |
| 255 | Tag: "markdown", |
| 256 | Content: markdownBuf.String(), |
| 257 | }, |
| 258 | }, |
| 259 | }, |
| 260 | } |
| 261 | } |
no test coverage detected