mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Renamed HandleEvent -> OnEvent
This commit is contained in:
parent
cad0da1d20
commit
38e5935d40
2 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ type EventRegistrationSpec<EventData, Subscriber> = {
|
||||||
|
|
||||||
const events: EventRegistrationSpec<unknown, unknown>[] = [];
|
const events: EventRegistrationSpec<unknown, unknown>[] = [];
|
||||||
|
|
||||||
export function HandleEvent<T>(Event: new (data: T, timestamp: Date) => IEvent<T>) {
|
export function OnEvent<T>(Event: new (data: T, timestamp: Date) => IEvent<T>) {
|
||||||
return function (target: object, methodName: string) {
|
return function (target: object, methodName: string) {
|
||||||
events.push({
|
events.push({
|
||||||
Event: Event as new (data: unknown, timestamp: Date) => IEvent<T>,
|
Event: Event as new (data: unknown, timestamp: Date) => IEvent<T>,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {MilestoneCreatedEvent} from '@tryghost/milestones';
|
import {MilestoneCreatedEvent} from '@tryghost/milestones';
|
||||||
import {SlackNotifications} from '@tryghost/slack-notifications';
|
import {SlackNotifications} from '@tryghost/slack-notifications';
|
||||||
import {HandleEvent} from '../common/handle-event.decorator';
|
import {OnEvent} from '../common/handle-event.decorator';
|
||||||
import {Inject} from '@nestjs/common';
|
import {Inject} from '@nestjs/common';
|
||||||
|
|
||||||
interface IConfig {
|
interface IConfig {
|
||||||
|
@ -18,7 +18,7 @@ export class SlackNotificationsListener {
|
||||||
this.enabled = hostSettings?.milestones?.url && hostSettings?.milestones?.enabled;
|
this.enabled = hostSettings?.milestones?.url && hostSettings?.milestones?.enabled;
|
||||||
}
|
}
|
||||||
|
|
||||||
@HandleEvent(MilestoneCreatedEvent)
|
@OnEvent(MilestoneCreatedEvent)
|
||||||
async notifyMilestones(event: typeof MilestoneCreatedEvent) {
|
async notifyMilestones(event: typeof MilestoneCreatedEvent) {
|
||||||
if (!this.enabled) {
|
if (!this.enabled) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Add table
Reference in a new issue