mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 22:55:00 +00:00
- fix groups forward.
This commit is contained in:
@@ -601,7 +601,7 @@ public final class AccountViewTracker {
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Void, NoError> in
|
||||
guard case let .messageViews(viewCounts, _) = result else {
|
||||
guard case let .messageViews(viewCounts, _)? = result else {
|
||||
return .complete()
|
||||
}
|
||||
|
||||
|
||||
@@ -301,20 +301,21 @@ func applyUpdateGroupMessages(postbox: Postbox, stateManager: AccountStateManage
|
||||
var sentStickers: [TelegramMediaFile] = []
|
||||
var sentGifs: [TelegramMediaFile] = []
|
||||
|
||||
var updatedGroupingKey: Int64?
|
||||
for (_, _, updatedMessage) in mapping {
|
||||
if let updatedGroupingKey = updatedGroupingKey {
|
||||
assert(updatedGroupingKey == updatedMessage.groupingKey)
|
||||
var updatedGroupingKey: [Int64 : [MessageId]] = [:]
|
||||
for (message, _, updatedMessage) in mapping {
|
||||
if let groupingKey = updatedMessage.groupingKey {
|
||||
var ids = updatedGroupingKey[groupingKey] ?? []
|
||||
ids.append(message.id)
|
||||
updatedGroupingKey[groupingKey] = ids
|
||||
}
|
||||
updatedGroupingKey = updatedMessage.groupingKey
|
||||
}
|
||||
|
||||
if let latestPreviousId = latestPreviousId, let latestIndex = mapping.last?.1 {
|
||||
transaction.offsetPendingMessagesTimestamps(lowerBound: latestPreviousId, excludeIds: Set(mapping.map { $0.0.id }), timestamp: latestIndex.timestamp)
|
||||
}
|
||||
|
||||
if let updatedGroupingKey = updatedGroupingKey {
|
||||
transaction.updateMessageGroupingKeysAtomically(mapping.map { $0.0.id }, groupingKey: updatedGroupingKey)
|
||||
for (key, ids) in updatedGroupingKey {
|
||||
transaction.updateMessageGroupingKeysAtomically(ids, groupingKey: key)
|
||||
}
|
||||
|
||||
for (message, _, updatedMessage) in mapping {
|
||||
|
||||
@@ -704,7 +704,7 @@ public final class PendingMessageManager {
|
||||
|
||||
let sendMessageRequest: Signal<Api.Updates, MTRpcError>
|
||||
if isForward {
|
||||
if !messages.contains(where: { $0.0.groupingKey == nil }) {
|
||||
if messages.contains(where: { $0.0.groupingKey != nil }) {
|
||||
flags |= (1 << 9)
|
||||
}
|
||||
|
||||
|
||||
@@ -9,7 +9,7 @@ import SyncCore
|
||||
public enum SearchMessagesLocation: Equatable {
|
||||
case general(tags: MessageTags?)
|
||||
case group(PeerGroupId)
|
||||
case peer(peerId: PeerId, fromId: PeerId?, tags: MessageTags?)
|
||||
case peer(peerId: PeerId, fromId: PeerId?, tags: MessageTags?, topMsgId: MessageId?)
|
||||
case publicForwards(messageId: MessageId, datacenterId: Int?)
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ private func mergedResult(_ state: SearchMessagesState) -> SearchMessagesResult
|
||||
public func searchMessages(account: Account, location: SearchMessagesLocation, query: String, state: SearchMessagesState?, limit: Int32 = 100) -> Signal<(SearchMessagesResult, SearchMessagesState), NoError> {
|
||||
let remoteSearchResult: Signal<(Api.messages.Messages?, Api.messages.Messages?), NoError>
|
||||
switch location {
|
||||
case let .peer(peerId, fromId, tags):
|
||||
case let .peer(peerId, fromId, tags, topMsgId):
|
||||
if peerId.namespace == Namespaces.Peer.SecretChat {
|
||||
return account.postbox.transaction { transaction -> (SearchMessagesResult, SearchMessagesState) in
|
||||
var readStates: [PeerId: CombinedPeerReadState] = [:]
|
||||
|
||||
Reference in New Issue
Block a user