mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Don't include self in non-contacts
This commit is contained in:
parent
5a04346c1c
commit
5f2152e54c
@ -224,7 +224,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
|
||||
var hasFolders = false
|
||||
|
||||
for case let .filter(_, _, _, data) in filters {
|
||||
let predicate = chatListFilterPredicate(filter: data)
|
||||
let predicate = chatListFilterPredicate(filter: data, accountPeerId: context.account.peerId)
|
||||
if predicate.includes(peer: peer._asPeer(), groupId: .root, isRemovedFromTotalUnreadCount: isMuted, isUnread: isUnread, isContact: isContact, messageTagSummaryResult: false) {
|
||||
continue
|
||||
}
|
||||
@ -242,7 +242,7 @@ func chatContextMenuItems(context: AccountContext, peerId: PeerId, promoInfo: Ch
|
||||
|
||||
for filter in filters {
|
||||
if case let .filter(_, title, _, data) = filter {
|
||||
let predicate = chatListFilterPredicate(filter: data)
|
||||
let predicate = chatListFilterPredicate(filter: data, accountPeerId: context.account.peerId)
|
||||
if predicate.includes(peer: peer._asPeer(), groupId: .root, isRemovedFromTotalUnreadCount: isMuted, isUnread: isUnread, isContact: isContact, messageTagSummaryResult: false) {
|
||||
continue
|
||||
}
|
||||
|
@ -1469,7 +1469,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
return .single(nil)
|
||||
}
|
||||
|
||||
let filterPredicate: ChatListFilterPredicate = chatListFilterPredicate(filter: data)
|
||||
let filterPredicate: ChatListFilterPredicate = chatListFilterPredicate(filter: data, accountPeerId: context.account.peerId)
|
||||
return context.engine.peers.getChatListPeers(filterPredicate: filterPredicate)
|
||||
|> mapToSignal { peers -> Signal<(areMuted: Bool, peerIds: [EnginePeer.Id])?, NoError> in
|
||||
let peerIds = peers.map(\.id)
|
||||
@ -3703,7 +3703,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
private func readAllInFilter(id: Int32) {
|
||||
for filter in self.chatListDisplayNode.mainContainerNode.availableFilters {
|
||||
if case let .filter(filter) = filter, case let .filter(filterId, _, _, data) = filter, filterId == id {
|
||||
let filterPredicate = chatListFilterPredicate(filter: data)
|
||||
let filterPredicate = chatListFilterPredicate(filter: data, accountPeerId: self.context.account.peerId)
|
||||
var markItems: [(groupId: EngineChatList.Group, filterPredicate: ChatListFilterPredicate?)] = []
|
||||
markItems.append((.root, filterPredicate))
|
||||
for additionalGroupId in filterPredicate.includeAdditionalPeerGroupIds {
|
||||
@ -4461,7 +4461,7 @@ public class ChatListControllerImpl: TelegramBaseController, ChatListController
|
||||
} else if case let .chatList(groupId) = self.chatListDisplayNode.effectiveContainerNode.location {
|
||||
let filterPredicate: ChatListFilterPredicate?
|
||||
if let filter = self.chatListDisplayNode.effectiveContainerNode.currentItemNode.chatListFilter, case let .filter(_, _, _, data) = filter {
|
||||
filterPredicate = chatListFilterPredicate(filter: data)
|
||||
filterPredicate = chatListFilterPredicate(filter: data, accountPeerId: self.context.account.peerId)
|
||||
} else {
|
||||
filterPredicate = nil
|
||||
}
|
||||
|
@ -3961,7 +3961,7 @@ private func statusStringForPeerType(accountPeerId: EnginePeer.Id, strings: Pres
|
||||
if let chatListFilters = chatListFilters {
|
||||
var result = ""
|
||||
for case let .filter(_, title, _, data) in chatListFilters {
|
||||
let predicate = chatListFilterPredicate(filter: data)
|
||||
let predicate = chatListFilterPredicate(filter: data, accountPeerId: accountPeerId)
|
||||
if predicate.includes(peer: peer._asPeer(), groupId: .root, isRemovedFromTotalUnreadCount: isMuted, isUnread: isUnread, isContact: isContact, messageTagSummaryResult: hasUnseenMentions) {
|
||||
if !result.isEmpty {
|
||||
result.append(", ")
|
||||
|
@ -29,7 +29,7 @@ struct ChatListNodeViewUpdate {
|
||||
let scrollPosition: ChatListNodeViewScrollPosition?
|
||||
}
|
||||
|
||||
public func chatListFilterPredicate(filter: ChatListFilterData) -> ChatListFilterPredicate {
|
||||
public func chatListFilterPredicate(filter: ChatListFilterData, accountPeerId: EnginePeer.Id) -> ChatListFilterPredicate {
|
||||
var includePeers = Set(filter.includePeers.peers)
|
||||
var excludePeers = Set(filter.excludePeers)
|
||||
|
||||
@ -74,7 +74,7 @@ public func chatListFilterPredicate(filter: ChatListFilterData) -> ChatListFilte
|
||||
return false
|
||||
}
|
||||
}
|
||||
if !filter.categories.contains(.nonContacts) && !isContact {
|
||||
if !filter.categories.contains(.nonContacts) && (!isContact && peer.id != accountPeerId) {
|
||||
if let user = peer as? TelegramUser {
|
||||
if user.botInfo == nil {
|
||||
return false
|
||||
@ -115,7 +115,7 @@ func chatListViewForLocation(chatListLocation: ChatListControllerLocation, locat
|
||||
case let .chatList(groupId):
|
||||
let filterPredicate: ChatListFilterPredicate?
|
||||
if let filter = location.filter, case let .filter(_, _, _, data) = filter {
|
||||
filterPredicate = chatListFilterPredicate(filter: data)
|
||||
filterPredicate = chatListFilterPredicate(filter: data, accountPeerId: account.peerId)
|
||||
} else {
|
||||
filterPredicate = nil
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user