Skip to content

Commit

Permalink
add notification text
Browse files Browse the repository at this point in the history
  • Loading branch information
hipstersmoothie committed Mar 9, 2021
1 parent 624dde5 commit f494c7a
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
10 changes: 10 additions & 0 deletions plugins/slack/__tests__/__snapshots__/slack.test.ts.snap
Expand Up @@ -316,6 +316,7 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
Expand Down Expand Up @@ -363,6 +364,7 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
Expand Down Expand Up @@ -416,6 +418,7 @@ Object {
},
],
"link_names": true,
"text": "New Release: :tada:",
}
`;
Expand Down Expand Up @@ -462,6 +465,7 @@ Object {
},
],
"link_names": true,
"text": "New Release: :tada:",
}
`;
Expand Down Expand Up @@ -508,6 +512,7 @@ Object {
},
],
"link_names": true,
"text": "New Release: :tada:",
}
`;
Expand Down Expand Up @@ -554,6 +559,7 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
Expand Down Expand Up @@ -600,6 +606,7 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
Expand Down Expand Up @@ -646,6 +653,7 @@ Object {
},
],
"link_names": true,
"text": "New Release: :tada:",
}
`;
Expand Down Expand Up @@ -692,6 +700,7 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
Expand Down Expand Up @@ -743,5 +752,6 @@ Object {
},
],
"link_names": true,
"text": "New Releases: 1.0.0 :tada:",
}
`;
4 changes: 3 additions & 1 deletion plugins/slack/src/index.ts
Expand Up @@ -371,13 +371,14 @@ export default class SlackPlugin implements IPlugin {
await last;

if (Array.isArray(message)) {
await channels.reduce(async (lastMessage, channel) => {
await channels.reduce(async (lastMessage, channel, index) => {
await lastMessage;
await fetch("https://slack.com/api/chat.postMessage", {
method: "POST",
body: JSON.stringify({
...userPostMessageOptions,
channel,
text: index === 0 ? `${header} :tada:` : undefined,
blocks: message,
link_names: true,
}),
Expand Down Expand Up @@ -414,6 +415,7 @@ export default class SlackPlugin implements IPlugin {
body: JSON.stringify({
...userPostMessageOptions,
link_names: true,
text: `${header} :tada:`,
// If not in app auth only one message is constructed
blocks: messages[0],
}),
Expand Down

0 comments on commit f494c7a

Please sign in to comment.