Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update appearance of admins when changing moderators. #2654

Merged
merged 2 commits into from
Apr 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion ElementX.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7324,7 +7324,7 @@
repositoryURL = "https://github.com/element-hq/compound-ios";
requirement = {
kind = revision;
revision = 19bc4c5cf9c69b7b7aeb9ac8c937c2c81a83e8b1;
revision = 6d42477c54a1dae128e0cb3645e3d00a53a5736c;
};
};
F76A08D0EA29A07A54F4EB4D /* XCRemoteSwiftPackageReference "swift-collections" */ = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"kind" : "remoteSourceControl",
"location" : "https://github.com/element-hq/compound-ios",
"state" : {
"revision" : "19bc4c5cf9c69b7b7aeb9ac8c937c2c81a83e8b1"
"revision" : "6d42477c54a1dae128e0cb3645e3d00a53a5736c"
}
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,7 @@
"screen_room_change_role_confirm_demote_self_description" = "You will not be able to undo this change as you are demoting yourself, if you are the last privileged user in the room it will be impossible to regain privileges.";
"screen_room_change_role_confirm_demote_self_title" = "Demote yourself?";
"screen_room_change_role_invited_member_name" = "%1$@ (Pending)";
"screen_room_change_role_moderators_admin_section_footer" = "Admins automatically have moderator privileges";
"screen_room_change_role_moderators_title" = "Edit Moderators";
"screen_room_change_role_unsaved_changes_description" = "You have unsaved changes.";
"screen_room_change_role_unsaved_changes_title" = "Save changes?";
Expand Down
2 changes: 2 additions & 0 deletions ElementX/Sources/Generated/Strings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1287,6 +1287,8 @@ internal enum L10n {
internal static func screenRoomChangeRoleInvitedMemberName(_ p1: Any) -> String {
return L10n.tr("Localizable", "screen_room_change_role_invited_member_name", String(describing: p1))
}
/// Admins automatically have moderator privileges
internal static var screenRoomChangeRoleModeratorsAdminSectionFooter: String { return L10n.tr("Localizable", "screen_room_change_role_moderators_admin_section_footer") }
/// Edit Moderators
internal static var screenRoomChangeRoleModeratorsTitle: String { return L10n.tr("Localizable", "screen_room_change_role_moderators_title") }
/// Admins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ struct RoomChangeRolesScreen: View {

RoomChangeRolesScreenSection(members: context.viewState.administrators,
title: L10n.screenRoomChangeRoleSectionAdministrators,
isAdministratorsSection: true,
context: context)
RoomChangeRolesScreenSection(members: context.viewState.moderators,
title: L10n.screenRoomChangeRoleSectionModerators,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import SwiftUI
struct RoomChangeRolesScreenSection: View {
let members: [RoomMemberDetails]
let title: String
var isAdministratorsSection = false

@ObservedObject var context: RoomChangeRolesScreenViewModel.Context

Expand All @@ -29,15 +30,25 @@ struct RoomChangeRolesScreenSection: View {
ForEach(members, id: \.id) { member in
RoomChangeRolesScreenRow(member: member,
imageProvider: context.imageProvider,
isSelected: context.viewState.isMemberSelected(member)) {
isSelected: isMemberSelected(member)) {
context.send(viewAction: .toggleMember(member))
}
.disabled(member.role == .administrator)
}
} header: {
Text(title)
.compoundListSectionHeader()
} footer: {
if isAdministratorsSection, context.viewState.mode == .moderator {
Text(L10n.screenRoomChangeRoleModeratorsAdminSectionFooter)
.compoundListSectionFooter()
}
}
}
}

private func isMemberSelected(_ member: RoomMemberDetails) -> Bool {
// We always show administrators as selected, even on the moderators screen.
member.role == .administrator || context.viewState.isMemberSelected(member)
}
}
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ packages:
# path: ../matrix-rust-sdk
Compound:
url: https://github.com/element-hq/compound-ios
revision: 19bc4c5cf9c69b7b7aeb9ac8c937c2c81a83e8b1
revision: 6d42477c54a1dae128e0cb3645e3d00a53a5736c
# path: ../compound-ios
AnalyticsEvents:
url: https://github.com/matrix-org/matrix-analytics-events
Expand Down