Merge branch 'fix/channel-getparticipant-left-member'
Some checks are pending
CI / Go tests (push) Waiting to run
CI / Admin web build (push) Waiting to run
CI / Grammy store bot (push) Waiting to run
CI / Docker main topology smoke (push) Waiting to run

This commit is contained in:
Astra 2026-09-16 14:35:19 +01:00
commit 6af4576fed

View file

@ -184,7 +184,12 @@ func (s *ChannelStore) GetParticipant(ctx context.Context, viewerUserID, channel
if errors.Is(err, domain.ErrChannelPrivate) { if errors.Is(err, domain.ErrChannelPrivate) {
return domain.ChannelMember{}, domain.ErrUserNotParticipant return domain.ChannelMember{}, domain.ErrUserNotParticipant
} }
if err == nil && participantUserID == viewerUserID && member.Status == domain.ChannelMemberLeft { // A stale row for a former member (left/kicked) is not a current
// participant for any caller, not just a self-check: channels.getParticipant
// on someone who has left must surface USER_NOT_PARTICIPANT like a missing
// row does, or callers get a "successful" ChannelParticipantLeft result for
// what protocol-wise is an absent participant.
if err == nil && member.Status != domain.ChannelMemberActive {
return domain.ChannelMember{}, domain.ErrUserNotParticipant return domain.ChannelMember{}, domain.ErrUserNotParticipant
} }
return member, err return member, err