0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Fixed slack notifications handler

This commit is contained in:
Fabien "egg" O'Carroll 2023-12-06 13:56:56 +07:00
parent fdbfbfa985
commit edc89d4b3d

View file

@ -12,7 +12,7 @@ interface IConfig {
export class SlackNotificationsHandler {
service: typeof SlackNotifications;
private readonly enabled: boolean;
constructor(service: typeof SlackNotifications, @Inject('config') config: IConfig) {
constructor(@Inject('SlackNotifications') service: typeof SlackNotifications, @Inject('config') config: IConfig) {
this.service = service;
const hostSettings = config.get('hostSettings');
this.enabled = hostSettings?.milestones?.url && hostSettings?.milestones?.enabled;
@ -21,7 +21,7 @@ export class SlackNotificationsHandler {
@HandleEvent(MilestoneCreatedEvent)
async notifyMilestones(event: typeof MilestoneCreatedEvent) {
if (!this.enabled) {
return;
}
try {
await this.service.notifyMilestoneReceived(event.data);