( notification: GitifyNotification, settings: SettingsState, fetchedData?: unknown, )
| 225 | * @returns The enriched notification. |
| 226 | */ |
| 227 | export async function enrichNotification( |
| 228 | notification: GitifyNotification, |
| 229 | settings: SettingsState, |
| 230 | fetchedData?: unknown, |
| 231 | ): Promise<GitifyNotification> { |
| 232 | let additionalSubjectDetails: Partial<GitifySubject> = {}; |
| 233 | |
| 234 | try { |
| 235 | const handler = createNotificationHandler(notification); |
| 236 | additionalSubjectDetails = await handler.enrich( |
| 237 | notification, |
| 238 | settings, |
| 239 | fetchedData, |
| 240 | ); |
| 241 | } catch (err) { |
| 242 | rendererLogError( |
| 243 | 'enrichNotification', |
| 244 | 'failed to enrich notification details for', |
| 245 | toError(err), |
| 246 | notification, |
| 247 | ); |
| 248 | |
| 249 | rendererLogWarn( |
| 250 | 'enrichNotification', |
| 251 | 'Continuing with base notification details', |
| 252 | ); |
| 253 | } |
| 254 | |
| 255 | return { |
| 256 | ...notification, |
| 257 | subject: { |
| 258 | ...notification.subject, |
| 259 | ...additionalSubjectDetails, |
| 260 | }, |
| 261 | }; |
| 262 | } |
| 263 | |
| 264 | /** |
| 265 | * Assign an order property to each notification to stabilize how they are displayed |
no test coverage detected