Skip to content

Commit 3121483

Browse files
setchyadufr
authored andcommitted
feat: add security_advisory_credit reason (gitify-app#807)
* feat: add security_advisory_credit reason
1 parent 405a371 commit 3121483

File tree

4 files changed

+16
-4
lines changed

4 files changed

+16
-4
lines changed

src/typesGithub.ts

+1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ export type Reason =
88
| 'member_feature_requested'
99
| 'mention'
1010
| 'review_requested'
11+
| 'security_advisory_credit'
1112
| 'security_alert'
1213
| 'state_change'
1314
| 'subscribed'

src/utils/__snapshots__/github-api.test.ts.snap

+11-4
Original file line numberDiff line numberDiff line change
@@ -80,34 +80,41 @@ exports[`./utils/github-api.ts should format the notification reason 9`] = `
8080
`;
8181

8282
exports[`./utils/github-api.ts should format the notification reason 10`] = `
83+
{
84+
"description": "You were credited for contributing to a security advisory.",
85+
"type": "Security Advisory Credit",
86+
}
87+
`;
88+
89+
exports[`./utils/github-api.ts should format the notification reason 11`] = `
8390
{
8491
"description": "GitHub discovered a security vulnerability in your repository.",
8592
"type": "Security Alert",
8693
}
8794
`;
8895

89-
exports[`./utils/github-api.ts should format the notification reason 11`] = `
96+
exports[`./utils/github-api.ts should format the notification reason 12`] = `
9097
{
9198
"description": "You changed the thread state (for example, closing an issue or merging a pull request).",
9299
"type": "State Change",
93100
}
94101
`;
95102

96-
exports[`./utils/github-api.ts should format the notification reason 12`] = `
103+
exports[`./utils/github-api.ts should format the notification reason 13`] = `
97104
{
98105
"description": "You're watching the repository.",
99106
"type": "Subscribed",
100107
}
101108
`;
102109

103-
exports[`./utils/github-api.ts should format the notification reason 13`] = `
110+
exports[`./utils/github-api.ts should format the notification reason 14`] = `
104111
{
105112
"description": "You were on a team that was mentioned.",
106113
"type": "Team Mention",
107114
}
108115
`;
109116

110-
exports[`./utils/github-api.ts should format the notification reason 14`] = `
117+
exports[`./utils/github-api.ts should format the notification reason 15`] = `
111118
{
112119
"description": "The reason for this notification is not supported by the app.",
113120
"type": "Unknown",

src/utils/github-api.test.ts

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ describe('./utils/github-api.ts', () => {
1616
expect(formatReason('member_feature_requested')).toMatchSnapshot();
1717
expect(formatReason('mention')).toMatchSnapshot();
1818
expect(formatReason('review_requested')).toMatchSnapshot();
19+
expect(formatReason('security_advisory_credit')).toMatchSnapshot();
1920
expect(formatReason('security_alert')).toMatchSnapshot();
2021
expect(formatReason('state_change')).toMatchSnapshot();
2122
expect(formatReason('subscribed')).toMatchSnapshot();

src/utils/github-api.ts

+3
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ const DESCRIPTIONS = {
2828
MEMBER_FEATURE_REQUESTED: 'Organization members have requested to enable a feature such as Draft Pull Requests or CoPilot.',
2929
MENTION: 'You were specifically @mentioned in the content.',
3030
REVIEW_REQUESTED: "You, or a team you're a member of, were requested to review a pull request.",
31+
SECURITY_ADVISORY_CREDIT: "You were credited for contributing to a security advisory.",
3132
SECURITY_ALERT: 'GitHub discovered a security vulnerability in your repository.',
3233
STATE_CHANGE: 'You changed the thread state (for example, closing an issue or merging a pull request).',
3334
SUBSCRIBED: "You're watching the repository.",
@@ -58,6 +59,8 @@ export function formatReason(reason: Reason): {
5859
return { type: 'Mention', description: DESCRIPTIONS['MENTION'] };
5960
case 'review_requested':
6061
return { type: 'Review Requested', description: DESCRIPTIONS['REVIEW_REQUESTED'] };
62+
case 'security_advisory_credit':
63+
return { type: 'Security Advisory Credit', description: DESCRIPTIONS['SECURITY_ADVISORY_CREDIT'] };
6164
case 'security_alert':
6265
return { type: 'Security Alert', description: DESCRIPTIONS['SECURITY_ALERT'] };
6366
case 'state_change':

0 commit comments

Comments
 (0)