diff --git a/src/renderer/components/notifications/NotificationFooter.tsx b/src/renderer/components/notifications/NotificationFooter.tsx index b3f2c40b5..673e9f302 100644 --- a/src/renderer/components/notifications/NotificationFooter.tsx +++ b/src/renderer/components/notifications/NotificationFooter.tsx @@ -5,6 +5,7 @@ import { RelativeTime, Stack, Text } from '@primer/react'; import { type GitifyNotification, Opacity, Size } from '../../types'; import { cn } from '../../utils/cn'; import { openUserProfile } from '../../utils/links'; +import { createNotificationHandler } from '../../utils/notifications/handlers'; import { AvatarWithFallback } from '../avatars/AvatarWithFallback'; import { MetricGroup } from '../metrics/MetricGroup'; @@ -15,6 +16,8 @@ interface NotificationFooterProps { export const NotificationFooter: FC = ({ notification, }: NotificationFooterProps) => { + const handler = createNotificationHandler(notification); + return ( = ({ ) : ( )} diff --git a/src/renderer/utils/notifications/handlers/default.ts b/src/renderer/utils/notifications/handlers/default.ts index a4750a3e1..07356f89c 100644 --- a/src/renderer/utils/notifications/handlers/default.ts +++ b/src/renderer/utils/notifications/handlers/default.ts @@ -10,6 +10,7 @@ import { type Link, type SettingsState, type SubjectType, + type UserType, } from '../../../types'; import type { NotificationTypeHandler } from './types'; import { formatForDisplay } from './utils'; @@ -61,6 +62,10 @@ export class DefaultHandler implements NotificationTypeHandler { defaultUrl(notification: GitifyNotification): Link { return notification.repository.htmlUrl; } + + defaultUserType(): UserType { + return 'User'; + } } export const defaultHandler = new DefaultHandler(); diff --git a/src/renderer/utils/notifications/handlers/repositoryDependabotAlertsThread.ts b/src/renderer/utils/notifications/handlers/repositoryDependabotAlertsThread.ts index 6457acb3b..eff9d18f0 100644 --- a/src/renderer/utils/notifications/handlers/repositoryDependabotAlertsThread.ts +++ b/src/renderer/utils/notifications/handlers/repositoryDependabotAlertsThread.ts @@ -3,7 +3,7 @@ import type { FC } from 'react'; import type { OcticonProps } from '@primer/octicons-react'; import { AlertIcon } from '@primer/octicons-react'; -import type { GitifyNotification, Link } from '../../../types'; +import type { GitifyNotification, Link, UserType } from '../../../types'; import { DefaultHandler, defaultHandler } from './default'; class RepositoryDependabotAlertsThreadHandler extends DefaultHandler { @@ -18,6 +18,10 @@ class RepositoryDependabotAlertsThreadHandler extends DefaultHandler { url.pathname += '/security/dependabot'; return url.href as Link; } + + defaultUserType(): UserType { + return 'Bot'; + } } export const repositoryDependabotAlertsThreadHandler = diff --git a/src/renderer/utils/notifications/handlers/repositoryVulnerabilityAlert.ts b/src/renderer/utils/notifications/handlers/repositoryVulnerabilityAlert.ts index c868f92ea..899c56935 100644 --- a/src/renderer/utils/notifications/handlers/repositoryVulnerabilityAlert.ts +++ b/src/renderer/utils/notifications/handlers/repositoryVulnerabilityAlert.ts @@ -2,7 +2,7 @@ import type { FC } from 'react'; import { AlertIcon, type OcticonProps } from '@primer/octicons-react'; -import type { GitifyNotification } from '../../../types'; +import type { GitifyNotification, UserType } from '../../../types'; import { DefaultHandler } from './default'; class RepositoryVulnerabilityAlertHandler extends DefaultHandler { @@ -11,6 +11,10 @@ class RepositoryVulnerabilityAlertHandler extends DefaultHandler { iconType(_notification: GitifyNotification): FC { return AlertIcon; } + + defaultUserType(): UserType { + return 'Bot'; + } } export const repositoryVulnerabilityAlertHandler = diff --git a/src/renderer/utils/notifications/handlers/types.ts b/src/renderer/utils/notifications/handlers/types.ts index 96d6e17b0..5893747b4 100644 --- a/src/renderer/utils/notifications/handlers/types.ts +++ b/src/renderer/utils/notifications/handlers/types.ts @@ -8,6 +8,7 @@ import type { Link, SettingsState, SubjectType, + UserType, } from '../../../types'; export interface NotificationTypeHandler { @@ -60,4 +61,9 @@ export interface NotificationTypeHandler { * Default url for notification type. */ defaultUrl(notification: GitifyNotification): Link; + + /** + * Default user type for notification type. + */ + defaultUserType(): UserType; }