@@ -139,7 +139,7 @@ data WebhookEventPayload jwt = WebhookEventPayload
139139 -- | The topic of the notification event.
140140 topic :: NotificationTopic ,
141141 -- | The data associated with the notification event.
142- data_ :: HydratedEventPayload ,
142+ data_ :: HydratedEvent ,
143143 -- | A signed token containing all of the same data.
144144 jwt :: jwt
145145 }
@@ -176,7 +176,7 @@ instance FromJSON (WebhookEventPayload ()) where
176176 <*> pure ()
177177
178178tryWebhook ::
179- NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEventPayload ->
179+ NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEvent ->
180180 NotificationWebhookId ->
181181 Background (Maybe WebhookSendFailure )
182182tryWebhook event webhookId = UnliftIO. handleAny (\ someException -> pure $ Just $ InvalidRequest event. eventId webhookId someException) do
@@ -267,12 +267,12 @@ instance ToJSON (MessageContent 'Discord) where
267267 ]
268268 ]
269269
270- buildWebhookRequest :: NotificationWebhookId -> URI -> NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEventPayload -> WebhookEventPayload JWTParam -> Background (Either WebhookSendFailure HTTPClient. Request )
270+ buildWebhookRequest :: NotificationWebhookId -> URI -> NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEvent -> WebhookEventPayload JWTParam -> Background (Either WebhookSendFailure HTTPClient. Request )
271271buildWebhookRequest webhookId uri event defaultPayload = do
272272 if
273- | isSlackWebhook uri -> buildChatAppPayload (Proxy @ Slack ) uri
274- | isDiscordWebhook uri -> buildChatAppPayload (Proxy @ Discord ) uri
275- | otherwise -> pure $ buildDefaultPayload
273+ | isSlackWebhook uri -> buildChatAppPayload (Proxy @ Slack ) uri
274+ | isDiscordWebhook uri -> buildChatAppPayload (Proxy @ Discord ) uri
275+ | otherwise -> pure $ buildDefaultPayload
276276 where
277277 isSlackWebhook :: URI -> Bool
278278 isSlackWebhook uri =
@@ -307,18 +307,18 @@ buildWebhookRequest webhookId uri event defaultPayload = do
307307 actorAuthor = maybe " " (<> " " ) actorName <> actorHandle
308308 actorAvatarUrl = event. eventActor ^. DisplayInfo. avatarUrl_
309309 actorLink <- Links. userProfilePage (event. eventActor ^. DisplayInfo. handle_)
310- messageContent :: MessageContent provider <- case event. eventData of
310+ let mainLink = event. eventData. hydratedEventLink
311+ messageContent :: MessageContent provider <- case event. eventData. payload of
311312 HydratedProjectBranchUpdatedPayload payload -> do
312313 let pbShorthand = (projectBranchShortHandFromParts payload. projectInfo. projectShortHand payload. branchInfo. branchShortHand)
313314 title = " Branch " <> IDs. toText pbShorthand <> " was just updated."
314315 preText = title
315- link <- Links. notificationLink event. eventData
316316 pure $
317317 MessageContent
318318 { preText = preText,
319319 content = " Branch updated" ,
320320 title = title,
321- mainLink = link ,
321+ mainLink,
322322 authorName = actorAuthor,
323323 authorLink = actorLink,
324324 authorAvatarUrl = actorAvatarUrl,
@@ -330,13 +330,12 @@ buildWebhookRequest webhookId uri event defaultPayload = do
330330 title = payload. contributionInfo. contributionTitle
331331 description = fromMaybe " " $ payload. contributionInfo. contributionDescription
332332 preText = " New Contribution in " <> IDs. toText pbShorthand
333- link <- Links. notificationLink event. eventData
334333 pure $
335334 MessageContent
336335 { preText = preText,
337336 content = description,
338337 title = title,
339- mainLink = link ,
338+ mainLink,
340339 authorName = actorAuthor,
341340 authorLink = actorLink,
342341 authorAvatarUrl = actorAvatarUrl,
@@ -364,13 +363,13 @@ cutOffText maxLength text =
364363
365364attemptWebhookSend ::
366365 AuthZ. AuthZReceipt ->
367- (NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEventPayload -> NotificationWebhookId -> IO (Maybe WebhookSendFailure )) ->
366+ (NotificationEvent NotificationEventId UnifiedDisplayInfo UTCTime HydratedEvent -> NotificationWebhookId -> IO (Maybe WebhookSendFailure )) ->
368367 NotificationEventId ->
369368 NotificationWebhookId ->
370369 PG. Transaction e (Maybe WebhookSendFailure )
371370attemptWebhookSend _authZReceipt tryWebhookIO eventId webhookId = do
372371 event <- NQ. expectEvent eventId
373- hydratedEvent <- forOf eventData_ event NQ. hydrateEventData
372+ hydratedEvent <- forOf eventData_ event NQ. hydrateEventPayload
374373 populatedEvent <- hydratedEvent & DisplayInfoQ. unifiedDisplayInfoForUserOf eventUserInfo_
375374 PG. transactionUnsafeIO (tryWebhookIO populatedEvent webhookId) >>= \ case
376375 Just err -> do
0 commit comments