mirror of
https://github.com/matrix-org/matrix-hookshot.git
synced 2025-03-10 21:19:13 +00:00
Alert on all notifs
This commit is contained in:
parent
14981a2430
commit
3ba86461b4
@ -119,11 +119,7 @@ export class NotificationProcessor {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private async handleUserNotification(roomId: string, notif: UserNotification) {
|
private formatIssueOrPullRequest(roomId: string, notif: UserNotification) {
|
||||||
log.info("New notification event:", notif);
|
|
||||||
if (notif.reason === "security_alert") {
|
|
||||||
return this.matrixSender.sendMatrixMessage(roomId, this.formatSecurityAlert(notif));
|
|
||||||
}
|
|
||||||
const issueNumber = notif.subject.url_data?.number.toString();
|
const issueNumber = notif.subject.url_data?.number.toString();
|
||||||
let diff = null;
|
let diff = null;
|
||||||
if (issueNumber) {
|
if (issueNumber) {
|
||||||
@ -165,4 +161,21 @@ export class NotificationProcessor {
|
|||||||
}
|
}
|
||||||
return this.matrixSender.sendMatrixMessage(roomId, body);
|
return this.matrixSender.sendMatrixMessage(roomId, body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async handleUserNotification(roomId: string, notif: UserNotification) {
|
||||||
|
log.info("New notification event:", notif);
|
||||||
|
if (notif.subject.type === "RepositoryVulnerabilityAlert") {
|
||||||
|
return this.matrixSender.sendMatrixMessage(roomId, this.formatSecurityAlert(notif));
|
||||||
|
} else if (notif.subject.type !== "Issue" && notif.subject.type !== "PullRequest") {
|
||||||
|
return this.formatIssueOrPullRequest(roomId, notif);
|
||||||
|
}
|
||||||
|
// We don't understand this type yet
|
||||||
|
const genericNotif = NotificationProcessor.formatNotification(notif, null, false);
|
||||||
|
return this.matrixSender.sendMatrixMessage(roomId, {
|
||||||
|
msgtype: "m.text",
|
||||||
|
body: genericNotif.plain,
|
||||||
|
formatted_body: genericNotif.html,
|
||||||
|
format: "org.matrix.custom.html",
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user