mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-06 22:33:10 +00:00
Fix Send Media permission exception
This commit is contained in:
parent
39d961bc53
commit
09780bc0a4
@ -466,14 +466,41 @@ public func channelBannedMemberController(context: AccountContext, updatedPresen
|
|||||||
} else {
|
} else {
|
||||||
effectiveRightsFlags = defaultBannedRightsFlags
|
effectiveRightsFlags = defaultBannedRightsFlags
|
||||||
}
|
}
|
||||||
if value {
|
|
||||||
effectiveRightsFlags.remove(rights)
|
|
||||||
effectiveRightsFlags = effectiveRightsFlags.subtracting(groupPermissionDependencies(rights))
|
if rights == .banSendMedia {
|
||||||
|
if value {
|
||||||
|
effectiveRightsFlags.remove(rights)
|
||||||
|
for item in banSendMediaSubList() {
|
||||||
|
effectiveRightsFlags.remove(item.0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
effectiveRightsFlags.insert(rights)
|
||||||
|
for (right, _) in allGroupPermissionList(peer: EnginePeer(peer), expandMedia: false) {
|
||||||
|
if groupPermissionDependencies(right).contains(rights) {
|
||||||
|
effectiveRightsFlags.insert(right)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for item in banSendMediaSubList() {
|
||||||
|
effectiveRightsFlags.insert(item.0)
|
||||||
|
for (right, _) in allGroupPermissionList(peer: EnginePeer(peer), expandMedia: false) {
|
||||||
|
if groupPermissionDependencies(right).contains(item.0) {
|
||||||
|
effectiveRightsFlags.insert(right)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
effectiveRightsFlags.insert(rights)
|
if value {
|
||||||
for (right, _) in allGroupPermissionList(peer: EnginePeer(peer), expandMedia: false) {
|
effectiveRightsFlags.remove(rights)
|
||||||
if groupPermissionDependencies(right).contains(rights) {
|
effectiveRightsFlags = effectiveRightsFlags.subtracting(groupPermissionDependencies(rights))
|
||||||
effectiveRightsFlags.insert(right)
|
} else {
|
||||||
|
effectiveRightsFlags.insert(rights)
|
||||||
|
for (right, _) in allGroupPermissionList(peer: EnginePeer(peer), expandMedia: false) {
|
||||||
|
if groupPermissionDependencies(right).contains(rights) {
|
||||||
|
effectiveRightsFlags.insert(right)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -826,8 +826,12 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
|||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo {
|
if let banInfo = banInfo {
|
||||||
var exceptionsString = ""
|
var exceptionsString = ""
|
||||||
|
let sendMediaRights = banSendMediaSubList().map { $0.0 }
|
||||||
for (rights, _) in allGroupPermissionList(peer: .channel(channel), expandMedia: true) {
|
for (rights, _) in allGroupPermissionList(peer: .channel(channel), expandMedia: true) {
|
||||||
if banInfo.rights.flags.contains(rights) {
|
if banInfo.rights.flags.contains(rights) {
|
||||||
|
if banInfo.rights.flags.contains(.banSendMedia) && sendMediaRights.contains(rights) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if !exceptionsString.isEmpty {
|
if !exceptionsString.isEmpty {
|
||||||
exceptionsString.append(", ")
|
exceptionsString.append(", ")
|
||||||
}
|
}
|
||||||
@ -1086,8 +1090,12 @@ public final class ChannelMembersSearchContainerNode: SearchDisplayControllerCon
|
|||||||
case let .member(_, _, _, banInfo, _):
|
case let .member(_, _, _, banInfo, _):
|
||||||
if let banInfo = banInfo {
|
if let banInfo = banInfo {
|
||||||
var exceptionsString = ""
|
var exceptionsString = ""
|
||||||
|
let sendMediaRights = banSendMediaSubList().map { $0.0 }
|
||||||
for (rights, _) in allGroupPermissionList(peer: .legacyGroup(group), expandMedia: true) {
|
for (rights, _) in allGroupPermissionList(peer: .legacyGroup(group), expandMedia: true) {
|
||||||
if banInfo.rights.flags.contains(rights) {
|
if banInfo.rights.flags.contains(rights) {
|
||||||
|
if banInfo.rights.flags.contains(.banSendMedia) && sendMediaRights.contains(rights) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
if !exceptionsString.isEmpty {
|
if !exceptionsString.isEmpty {
|
||||||
exceptionsString.append(", ")
|
exceptionsString.append(", ")
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
import Foundation
|
import Foundation
|
||||||
import Foundation
|
|
||||||
import UIKit
|
import UIKit
|
||||||
import Display
|
import Display
|
||||||
import AsyncDisplayKit
|
import AsyncDisplayKit
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user