|
24 | 24 |
|
25 | 25 | if TYPE_CHECKING: |
26 | 26 | from sentry.integrations.discord.message_builder.base.base import DiscordMessage |
27 | | - from sentry.integrations.discord.message_builder.base.embed.field import ( |
28 | | - DiscordMessageEmbedField, |
29 | | - ) |
30 | 27 |
|
31 | 28 | # TODO(ecosystem): Proper typing - https://discord.com/developers/docs/resources/message#create-message |
32 | 29 | type DiscordRenderable = DiscordMessage |
@@ -65,7 +62,7 @@ def render[DataT: NotificationData]( |
65 | 62 | embeds.append( |
66 | 63 | DiscordMessageEmbed( |
67 | 64 | title=rendered_template.subject, |
68 | | - fields=body_blocks, |
| 65 | + description=body_blocks, |
69 | 66 | image=( |
70 | 67 | DiscordMessageEmbedImage(url=rendered_template.chart.url) |
71 | 68 | if rendered_template.chart |
@@ -94,28 +91,15 @@ def render[DataT: NotificationData]( |
94 | 91 | return builder.build() |
95 | 92 |
|
96 | 93 | @classmethod |
97 | | - def render_body_blocks( |
98 | | - cls, body: list[NotificationBodyFormattingBlock] |
99 | | - ) -> list[DiscordMessageEmbedField]: |
100 | | - from sentry.integrations.discord.message_builder.base.embed.field import ( |
101 | | - DiscordMessageEmbedField, |
102 | | - ) |
| 94 | + def render_body_blocks(cls, body: list[NotificationBodyFormattingBlock]) -> str: |
103 | 95 |
|
104 | | - fields = [] |
| 96 | + description = [] |
105 | 97 | for block in body: |
106 | 98 | if block.type == NotificationBodyFormattingBlockType.PARAGRAPH: |
107 | | - fields.append( |
108 | | - DiscordMessageEmbedField( |
109 | | - name=block.type.value, value=cls.render_text_blocks(block.blocks) |
110 | | - ) |
111 | | - ) |
| 99 | + description.append(f"\n{cls.render_text_blocks(block.blocks)}") |
112 | 100 | elif block.type == NotificationBodyFormattingBlockType.CODE_BLOCK: |
113 | | - fields.append( |
114 | | - DiscordMessageEmbedField( |
115 | | - name=block.type.value, value=f"```{cls.render_text_blocks(block.blocks)}```" |
116 | | - ) |
117 | | - ) |
118 | | - return fields |
| 101 | + description.append(f"\n```{cls.render_text_blocks(block.blocks)}```") |
| 102 | + return "".join(description) |
119 | 103 |
|
120 | 104 | @classmethod |
121 | 105 | def render_text_blocks(cls, blocks: list[NotificationBodyTextBlock]) -> str: |
|
0 commit comments