Skip to content

Commit

Permalink
Create a seam for sending a message to Sciety
Browse files Browse the repository at this point in the history
Refs #645
  • Loading branch information
thewilkybarkid committed Nov 28, 2024
1 parent 73926e5 commit 9eaaf24
Showing 1 changed file with 21 additions and 13 deletions.
34 changes: 21 additions & 13 deletions src/Router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -132,20 +132,26 @@ export const Router = HttpRouter.empty.pipe(

const prereview = yield* HttpServerRequest.schemaBodyJson(NewPrereviewSchema)

yield* Slack.chatPostMessage({
channel: yield* SlackShareChannelId,
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: slackifyMarkdown(`${prereview.author.name} has published a PREreview: <${prereview.url.href}>`),
},
},
yield* Effect.all(
[
Slack.chatPostMessage({
channel: yield* SlackShareChannelId,
blocks: [
{
type: 'section',
text: {
type: 'mrkdwn',
text: slackifyMarkdown(`${prereview.author.name} has published a PREreview: <${prereview.url.href}>`),
},
},
],
unfurlLinks: true,
unfurlMedia: false,
}),
notifyScietyCoarInbox,
],
unfurlLinks: true,
unfurlMedia: false,
})
{ concurrency: 'unbounded' },
)

return yield* HttpServerResponse.empty({ status: StatusCodes.CREATED })
}),
Expand Down Expand Up @@ -216,4 +222,6 @@ const RequestsSchema = Schema.Array(
}),
)

const notifyScietyCoarInbox = Effect.void

const md5 = (content: string) => createHash('md5').update(content).digest('hex')

0 comments on commit 9eaaf24

Please sign in to comment.