channels: clear stale banned rights when promoting a member to admin

EditChannelAdmin reactivates a previously kicked/banned member to Active
status but left BannedRights.ViewMessages set from the old ban, an
Active+banned-from-viewing state nothing else in the codebase expects.
TransferChannelOwnership's participant check trips on it and rejects the
transfer with PARTICIPANT_MISSING, even though the target is now a
visibly active admin.
This commit is contained in:
Astra 2026-09-15 12:11:04 +01:00
parent fde4db01fa
commit 2b3f417b24
2 changed files with 12 additions and 0 deletions

View file

@ -100,6 +100,13 @@ func (s *ChannelStore) EditChannelAdmin(ctx context.Context, req domain.EditChan
member.InviterUserID = req.UserID
member.Status = domain.ChannelMemberActive
member.LeftAt = 0
// A kicked/banned member carries BannedRights.ViewMessages=true (see
// EditChannelBanned above); editAdmin unconditionally reactivates them
// to Active, so any lingering ban must be lifted too -- otherwise the
// contradictory Active+ViewMessages-banned state trips later checks
// (e.g. TransferChannelOwnership's participant check) that never
// expect an active member to be ban-restricted from viewing messages.
member.BannedRights = domain.ChannelBannedRights{}
if req.HasRank() {
member.Rank = req.Rank
}