mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Various fixes
This commit is contained in:
@@ -547,6 +547,11 @@ private func channelPermissionsControllerEntries(context: AccountContext, presen
|
||||
var entries: [ChannelPermissionsEntry] = []
|
||||
|
||||
if let channel = view.peers[view.peerId] as? TelegramChannel, let participants = participants, let cachedData = view.cachedData as? CachedChannelData, let defaultBannedRights = channel.defaultBannedRights {
|
||||
var isDiscussion = false
|
||||
if case .group = channel.info, case let .known(peerId) = cachedData.linkedDiscussionPeerId, peerId != nil {
|
||||
isDiscussion = true
|
||||
}
|
||||
|
||||
let effectiveRightsFlags: TelegramChatBannedRightsFlags
|
||||
if let modifiedRightsFlags = state.modifiedRightsFlags {
|
||||
effectiveRightsFlags = modifiedRightsFlags
|
||||
@@ -558,7 +563,7 @@ private func channelPermissionsControllerEntries(context: AccountContext, presen
|
||||
var rightIndex: Int = 0
|
||||
for (rights, correspondingAdminRight) in allGroupPermissionList(peer: .channel(channel), expandMedia: false) {
|
||||
var enabled = true
|
||||
if channel.addressName != nil && publicGroupRestrictedPermissions.contains(rights) {
|
||||
if (channel.addressName != nil || channel.flags.contains(.hasGeo) || isDiscussion) && publicGroupRestrictedPermissions.contains(rights) {
|
||||
enabled = false
|
||||
}
|
||||
if !channel.hasPermission(.inviteMembers) {
|
||||
@@ -938,7 +943,17 @@ public func channelPermissionsController(context: AccountContext, updatedPresent
|
||||
} else if right.contains(.banAddMembers) {
|
||||
text = presentationData.strings.GroupPermission_AddMembersNotAvailable
|
||||
} else {
|
||||
text = presentationData.strings.GroupPermission_NotAvailableInPublicGroups
|
||||
var isDiscussion = false
|
||||
if case .group = channel.info, let cachedData = view.cachedData as? CachedChannelData, case let .known(peerId) = cachedData.linkedDiscussionPeerId, peerId != nil {
|
||||
isDiscussion = true
|
||||
}
|
||||
if channel.flags.contains(.hasGeo) {
|
||||
text = presentationData.strings.GroupPermission_NotAvailableInGeoGroups
|
||||
} else if isDiscussion {
|
||||
text = presentationData.strings.GroupPermission_NotAvailableInDiscussionGroups
|
||||
} else {
|
||||
text = presentationData.strings.GroupPermission_NotAvailableInPublicGroups
|
||||
}
|
||||
}
|
||||
presentControllerImpl?(textAlertController(context: context, updatedPresentationData: updatedPresentationData, title: nil, text: text, actions: [TextAlertAction(type: .defaultAction, title: presentationData.strings.Common_OK, action: {})]), nil)
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user