@@ -12,8 +12,14 @@ import {
1212import { singleton } from 'tsyringe' ;
1313import { ConfigService } from './config.service' ;
1414import { EventAuthorizationService } from './event-authorization.service' ;
15+ import { EventEmitterService } from './event-emitter.service' ;
16+ import { EventService } from './event.service' ;
1517import { FederationService } from './federation.service' ;
16- import { StateService , UnknownRoomError } from './state.service' ;
18+ import {
19+ RoomInfoNotReadyError ,
20+ StateService ,
21+ UnknownRoomError ,
22+ } from './state.service' ;
1723// TODO: Have better (detailed/specific) event input type
1824export type ProcessInviteEvent = {
1925 event : EventBase ;
@@ -37,6 +43,7 @@ export class InviteService {
3743 private readonly stateService : StateService ,
3844 private readonly configService : ConfigService ,
3945 private readonly eventAuthorizationService : EventAuthorizationService ,
46+ private readonly emitterService : EventEmitterService ,
4047 ) { }
4148
4249 /**
@@ -103,6 +110,11 @@ export class InviteService {
103110 // without it join events will not be processed if /event/{eventId} causes problems
104111 void federationService . sendEventToAllServersInRoom ( inviteEvent ) ;
105112
113+ this . emitterService . emit ( 'homeserver.matrix.membership' , {
114+ event_id : inviteEvent . eventId ,
115+ event : inviteEvent . event ,
116+ } ) ;
117+
106118 return {
107119 event_id : inviteEvent . eventId ,
108120 event : PersistentEventFactory . createFromRawEvent (
@@ -133,6 +145,11 @@ export class InviteService {
133145 // let everyone know
134146 void federationService . sendEventToAllServersInRoom ( inviteEvent ) ;
135147
148+ this . emitterService . emit ( 'homeserver.matrix.membership' , {
149+ event_id : inviteEvent . eventId ,
150+ event : inviteEvent . event ,
151+ } ) ;
152+
136153 return {
137154 event_id : inviteEvent . eventId ,
138155 event : PersistentEventFactory . createFromRawEvent (
@@ -226,6 +243,11 @@ export class InviteService {
226243
227244 // we do not send transaction here
228245 // the asking server will handle the transactions
246+
247+ this . emitterService . emit ( 'homeserver.matrix.membership' , {
248+ event_id : inviteEvent . eventId ,
249+ event : inviteEvent . event ,
250+ } ) ;
229251 }
230252
231253 // we are not the host of the server
0 commit comments