bridgev2/portal: run post handle even if chat resync is short-circuited

This commit is contained in:
Tulir Asokan 2024-11-06 15:56:47 +01:00
commit 449de115ff
2 changed files with 10 additions and 2 deletions

View file

@ -1628,6 +1628,10 @@ func (portal *Portal) handleRemoteEvent(ctx context.Context, source *UserLogin,
}
if evtType == RemoteEventChatResync {
log.Debug().Msg("Not handling chat resync event further as portal was created by it")
postHandler, ok := evt.(RemotePostHandler)
if ok {
postHandler.PostHandle(ctx, portal)
}
return
}
}

View file

@ -80,11 +80,15 @@ func (evt *EventMeta) ShouldCreatePortal() bool {
}
func (evt *EventMeta) PreHandle(ctx context.Context, portal *bridgev2.Portal) {
evt.PreHandleFunc(ctx, portal)
if evt.PreHandleFunc != nil {
evt.PreHandleFunc(ctx, portal)
}
}
func (evt *EventMeta) PostHandle(ctx context.Context, portal *bridgev2.Portal) {
evt.PostHandleFunc(ctx, portal)
if evt.PostHandleFunc != nil {
evt.PostHandleFunc(ctx, portal)
}
}
func (evt EventMeta) WithType(t bridgev2.RemoteEventType) EventMeta {