Merge branch 'fix/channel-admin-clear-banned-rights'
This commit is contained in:
commit
97711c9d2e
2 changed files with 12 additions and 0 deletions
|
|
@ -347,6 +347,11 @@ func (s *ChannelStore) EditChannelAdmin(_ context.Context, req domain.EditChanne
|
|||
member.InviterUserID = req.UserID
|
||||
member.Status = domain.ChannelMemberActive
|
||||
member.LeftAt = 0
|
||||
// See the postgres EditChannelAdmin implementation for why this is
|
||||
// needed: a kicked/banned member carries BannedRights.ViewMessages=true,
|
||||
// and editAdmin unconditionally reactivates them to Active, so any
|
||||
// lingering ban must be lifted too.
|
||||
member.BannedRights = domain.ChannelBannedRights{}
|
||||
if previous.Status != domain.ChannelMemberActive {
|
||||
if minPts := channelInitialAvailableMinPts(channel); minPts > member.AvailableMinPts {
|
||||
member.AvailableMinPts = minPts
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue