fix slack notification processor attachment blocks
A `section` block requires that either a `text` or `fields` item be included. Since we were already defaulting the payload.description, this change simply ensures that the text portion of the block is specified (with tests updated accordingly). Signed-off-by: Brian Phillips <28457+brianphillips@users.noreply.github.com>
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
---
|
||||
'@backstage/plugin-notifications-backend-module-slack': patch
|
||||
---
|
||||
|
||||
Fix slack notification processor to handle a notification with an empty description
|
||||
@@ -158,6 +158,10 @@ describe('SlackNotificationProcessor', () => {
|
||||
blocks: [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
text: 'No description provided',
|
||||
type: 'mrkdwn',
|
||||
},
|
||||
accessory: {
|
||||
type: 'button',
|
||||
text: {
|
||||
@@ -229,6 +233,10 @@ describe('SlackNotificationProcessor', () => {
|
||||
blocks: [
|
||||
{
|
||||
type: 'section',
|
||||
text: {
|
||||
text: 'No description provided',
|
||||
type: 'mrkdwn',
|
||||
},
|
||||
accessory: {
|
||||
type: 'button',
|
||||
text: {
|
||||
|
||||
@@ -46,12 +46,10 @@ export function toSlackBlockKit(payload: NotificationPayload): KnownBlock[] {
|
||||
return [
|
||||
{
|
||||
type: 'section',
|
||||
...(description && {
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: description ?? 'No description provided',
|
||||
},
|
||||
}),
|
||||
text: {
|
||||
type: 'mrkdwn',
|
||||
text: description ?? 'No description provided',
|
||||
},
|
||||
accessory: {
|
||||
type: 'button',
|
||||
text: {
|
||||
|
||||
Reference in New Issue
Block a user