From 449de115ffad2d547109fd369d2ccd0d0cdd251a Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Wed, 6 Nov 2024 15:56:47 +0100 Subject: [PATCH] bridgev2/portal: run post handle even if chat resync is short-circuited --- bridgev2/portal.go | 4 ++++ bridgev2/simplevent/meta.go | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/bridgev2/portal.go b/bridgev2/portal.go index 6ada8918..f3adddd9 100644 --- a/bridgev2/portal.go +++ b/bridgev2/portal.go @@ -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 } } diff --git a/bridgev2/simplevent/meta.go b/bridgev2/simplevent/meta.go index f9a1ea6a..8aa91866 100644 --- a/bridgev2/simplevent/meta.go +++ b/bridgev2/simplevent/meta.go @@ -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 {