mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 19:44:05 +00:00
Fix various bugs in the moderation feature. (#2608)
* Fix search field string. * Show your own user as an Admin when changing roles. * Also show invited users when changing roles. * Don't allow admin's to kick/ban other admins or themselves. * Fix a bug when left members were counted as admins/moderators. * Show when a member is pending. * Add sections to the change role screen.
This commit is contained in:
+43
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Copyright 2024 New Vector Ltd
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct RoomChangeRolesScreenSection: View {
|
||||
let members: [RoomMemberDetails]
|
||||
let title: String
|
||||
|
||||
@ObservedObject var context: RoomChangeRolesScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
if !members.isEmpty {
|
||||
Section {
|
||||
ForEach(members, id: \.id) { member in
|
||||
RoomChangeRolesScreenRow(member: member,
|
||||
imageProvider: context.imageProvider,
|
||||
isSelected: context.viewState.isMemberSelected(member)) {
|
||||
context.send(viewAction: .toggleMember(member))
|
||||
}
|
||||
.disabled(member.role == .administrator)
|
||||
}
|
||||
} header: {
|
||||
Text(title)
|
||||
.compoundListSectionHeader()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user