mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix Permissions and Admins visibility in basic groups
This commit is contained in:
parent
409ba24f2c
commit
47677b65ca
@ -1399,6 +1399,8 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr
|
|||||||
let ItemAdmins = 105
|
let ItemAdmins = 105
|
||||||
let ItemAutoremove = 106
|
let ItemAutoremove = 106
|
||||||
|
|
||||||
|
var canViewAdminsAndBanned = false
|
||||||
|
|
||||||
if case .creator = group.role {
|
if case .creator = group.role {
|
||||||
if let cachedData = data.cachedData as? CachedGroupData {
|
if let cachedData = data.cachedData as? CachedGroupData {
|
||||||
if cachedData.flags.contains(.canChangeUsername) {
|
if cachedData.flags.contains(.canChangeUsername) {
|
||||||
@ -1425,24 +1427,25 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr
|
|||||||
interaction.editingOpenPreHistorySetup()
|
interaction.editingOpenPreHistorySetup()
|
||||||
}))
|
}))
|
||||||
|
|
||||||
/*let canChangeInfo = true
|
canViewAdminsAndBanned = true
|
||||||
if canChangeInfo {
|
} else if case let .admin(rights, _) = group.role {
|
||||||
let timeoutString: String
|
if rights.rights.contains(.canInviteUsers) {
|
||||||
if case let .known(value) = (data.cachedData as? CachedGroupData)?.autoremoveTimeout {
|
let invitesText: String
|
||||||
if let value = value?.value {
|
if let count = data.invitations?.count, count > 0 {
|
||||||
timeoutString = timeIntervalString(strings: presentationData.strings, value: value)
|
invitesText = "\(count)"
|
||||||
} else {
|
} else {
|
||||||
timeoutString = presentationData.strings.PeerInfo_AutoremoveMessagesDisabled
|
invitesText = ""
|
||||||
}
|
|
||||||
} else {
|
|
||||||
timeoutString = ""
|
|
||||||
}
|
}
|
||||||
|
|
||||||
items[.peerPublicSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemAutoremove, label: .text(timeoutString), text: presentationData.strings.PeerInfo_AutoremoveMessages, action: {
|
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemInviteLinks, label: .text(invitesText), text: presentationData.strings.GroupInfo_InviteLinks, icon: UIImage(bundleImageName: "Chat/Info/GroupLinksIcon"), action: {
|
||||||
interaction.editingOpenAutoremoveMesages()
|
interaction.editingOpenInviteLinksSetup()
|
||||||
}))
|
}))
|
||||||
}*/
|
}
|
||||||
|
|
||||||
|
canViewAdminsAndBanned = true
|
||||||
|
}
|
||||||
|
|
||||||
|
if canViewAdminsAndBanned {
|
||||||
var activePermissionCount: Int?
|
var activePermissionCount: Int?
|
||||||
if let defaultBannedRights = group.defaultBannedRights {
|
if let defaultBannedRights = group.defaultBannedRights {
|
||||||
var count = 0
|
var count = 0
|
||||||
@ -1461,19 +1464,6 @@ private func editingItems(data: PeerInfoScreenData?, context: AccountContext, pr
|
|||||||
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemAdmins, text: presentationData.strings.GroupInfo_Administrators, icon: UIImage(bundleImageName: "Chat/Info/GroupAdminsIcon"), action: {
|
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemAdmins, text: presentationData.strings.GroupInfo_Administrators, icon: UIImage(bundleImageName: "Chat/Info/GroupAdminsIcon"), action: {
|
||||||
interaction.openParticipantsSection(.admins)
|
interaction.openParticipantsSection(.admins)
|
||||||
}))
|
}))
|
||||||
} else if case let .admin(rights, _) = group.role {
|
|
||||||
if rights.rights.contains(.canInviteUsers) {
|
|
||||||
let invitesText: String
|
|
||||||
if let count = data.invitations?.count, count > 0 {
|
|
||||||
invitesText = "\(count)"
|
|
||||||
} else {
|
|
||||||
invitesText = ""
|
|
||||||
}
|
|
||||||
|
|
||||||
items[.peerSettings]!.append(PeerInfoScreenDisclosureItem(id: ItemInviteLinks, label: .text(invitesText), text: presentationData.strings.GroupInfo_InviteLinks, icon: UIImage(bundleImageName: "Chat/Info/GroupLinksIcon"), action: {
|
|
||||||
interaction.editingOpenInviteLinksSetup()
|
|
||||||
}))
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user