Don't try to translate ads

This commit is contained in:
Ilya Laktyushin 2024-04-17 21:20:51 +04:00
parent 8876026edb
commit 1870ebd097

View File

@ -2453,6 +2453,9 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
for i in (wideIndexRange.0 ... wideIndexRange.1) {
switch historyView.filteredEntries[i] {
case let .MessageEntry(message, _, _, _, _, _):
guard message.adAttribute == nil && message.id.namespace == Namespaces.Message.Cloud else {
continue
}
if !message.text.isEmpty && message.author?.id != self.context.account.peerId {
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
} else {
@ -2461,6 +2464,9 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
}
case let .MessageGroupEntry(_, messages, _):
for (message, _, _, _, _) in messages {
guard message.adAttribute && message.id.namespace == Namespaces.Message.Cloud == nil else {
continue
}
if !message.text.isEmpty && message.author?.id != self.context.account.peerId {
if let translation = message.attributes.first(where: { $0 is TranslationMessageAttribute }) as? TranslationMessageAttribute, translation.toLang == translateToLanguage {
} else {