Merge commit '2c364e913f0452ae65160146dfcdcb480027e377'

This commit is contained in:
Ali 2020-09-24 00:42:52 +04:00
commit 483bcedad0
5 changed files with 20 additions and 16 deletions

View File

@ -162,7 +162,7 @@ func mergeChannel(lhs: TelegramChannel?, rhs: TelegramChannel) -> TelegramChanne
return rhs return rhs
} }
if case .personal = rhs.accessHash { if case .personal? = rhs.accessHash {
return rhs return rhs
} }
@ -185,9 +185,9 @@ func mergeChannel(lhs: TelegramChannel?, rhs: TelegramChannel) -> TelegramChanne
if let rhsAccessHashValue = lhs.accessHash, case .personal = rhsAccessHashValue { if let rhsAccessHashValue = lhs.accessHash, case .personal = rhsAccessHashValue {
accessHash = rhsAccessHashValue accessHash = rhsAccessHashValue
} else { } else {
accessHash = lhs.accessHash ?? rhs.accessHash accessHash = rhs.accessHash ?? lhs.accessHash
} }
return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: lhs.creationDate, version: lhs.version, participationStatus: lhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: lhs.restrictionInfo, adminRights: lhs.adminRights, bannedRights: lhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights) return TelegramChannel(id: lhs.id, accessHash: accessHash, title: rhs.title, username: rhs.username, photo: rhs.photo, creationDate: rhs.creationDate, version: rhs.version, participationStatus: rhs.participationStatus, info: info, flags: channelFlags, restrictionInfo: rhs.restrictionInfo, adminRights: rhs.adminRights, bannedRights: rhs.bannedRights, defaultBannedRights: rhs.defaultBannedRights)
} }

View File

@ -219,6 +219,7 @@ public final class BlockedPeersContext {
} }
|> mapToSignal { value in |> mapToSignal { value in
return postbox.transaction { transaction -> Peer? in return postbox.transaction { transaction -> Peer? in
if peerId.namespace == Namespaces.Peer.CloudUser {
transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in transaction.updatePeerCachedData(peerIds: Set([peerId]), update: { _, current in
let previous: CachedUserData let previous: CachedUserData
if let current = current as? CachedUserData { if let current = current as? CachedUserData {
@ -228,6 +229,7 @@ public final class BlockedPeersContext {
} }
return previous.withUpdatedIsBlocked(false) return previous.withUpdatedIsBlocked(false)
}) })
}
return transaction.getPeer(peerId) return transaction.getPeer(peerId)
} }
|> castError(BlockedPeersContextRemoveError.self) |> castError(BlockedPeersContextRemoveError.self)

View File

@ -574,6 +574,8 @@ private final class CallSessionManagerContext {
self.ringingStatesUpdated() self.ringingStatesUpdated()
} }
} }
} else {
self.contextUpdated(internalId: internalId)
} }
} }

View File

@ -143,7 +143,7 @@ extension TelegramUser {
guard let lhs = lhs else { guard let lhs = lhs else {
return rhs return rhs
} }
if case .personal = rhs.accessHash { if case .personal? = rhs.accessHash {
return rhs return rhs
} else { } else {
var userFlags: UserInfoFlags = [] var userFlags: UserInfoFlags = []

View File

@ -85,14 +85,14 @@ private func updateMessageThreadStatsInternal(transaction: Transaction, threadMe
let count = max(0, attribute.count + countDifference) let count = max(0, attribute.count + countDifference)
var maxMessageId = attribute.maxMessageId var maxMessageId = attribute.maxMessageId
var maxReadMessageId = attribute.maxReadMessageId var maxReadMessageId = attribute.maxReadMessageId
if let maxAddedId = addedMessagePeers.map(\.messageId.id).max() { if let maxAddedId = addedMessagePeers.map({ $0.messageId.id }).max() {
if let currentMaxMessageId = maxMessageId { if let currentMaxMessageId = maxMessageId {
maxMessageId = max(currentMaxMessageId, maxAddedId) maxMessageId = max(currentMaxMessageId, maxAddedId)
} else { } else {
maxMessageId = maxAddedId maxMessageId = maxAddedId
} }
} }
if let maxAddedReadId = addedMessagePeers.filter(\.isOutgoing).map(\.messageId.id).max() { if let maxAddedReadId = addedMessagePeers.filter({ $0.isOutgoing }).map({ $0.messageId.id }).max() {
if let currentMaxMessageId = maxReadMessageId { if let currentMaxMessageId = maxReadMessageId {
maxReadMessageId = max(currentMaxMessageId, maxAddedReadId) maxReadMessageId = max(currentMaxMessageId, maxAddedReadId)
} else { } else {
@ -100,7 +100,7 @@ private func updateMessageThreadStatsInternal(transaction: Transaction, threadMe
} }
} }
attributes[j] = ReplyThreadMessageAttribute(count: count, latestUsers: mergeLatestUsers(current: attribute.latestUsers, added: addedMessagePeers.map(\.id), isGroup: isGroup, isEmpty: count == 0), commentsPeerId: attribute.commentsPeerId, maxMessageId: maxMessageId, maxReadMessageId: maxReadMessageId) attributes[j] = ReplyThreadMessageAttribute(count: count, latestUsers: mergeLatestUsers(current: attribute.latestUsers, added: addedMessagePeers.map({ $0.id }), isGroup: isGroup, isEmpty: count == 0), commentsPeerId: attribute.commentsPeerId, maxMessageId: maxMessageId, maxReadMessageId: maxReadMessageId)
} else if let attribute = attributes[j] as? SourceReferenceMessageAttribute { } else if let attribute = attributes[j] as? SourceReferenceMessageAttribute {
channelThreadMessageId = attribute.messageId channelThreadMessageId = attribute.messageId
} }