Various improvements

This commit is contained in:
Isaac
2023-12-28 20:11:23 +04:00
parent d8e5ff4f58
commit 24b7482bf9
3 changed files with 12 additions and 6 deletions

View File

@@ -1645,8 +1645,11 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
if case .admin = authorRank {
} else if case .owner = authorRank {
} else if authorRank == nil {
if case let .replyThread(replyThreadMessage) = item.chatLocation, replyThreadMessage.peerId == item.context.account.peerId {
} else {
enableAutoRank = true
}
}
if enableAutoRank {
if let topicAuthorId = item.associatedData.topicAuthorId, topicAuthorId == message.author?.id {
authorRank = .custom(item.presentationData.strings.Chat_Message_TopicAuthorBadge)

View File

@@ -3023,7 +3023,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
}
if canReplyInChat(strongSelf.presentationInterfaceState) {
if canReplyInChat(strongSelf.presentationInterfaceState, accountPeerId: strongSelf.context.account.peerId) {
return .reply
} else if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info {
}
@@ -17475,7 +17475,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
}
if options.contains(.deleteLocally) {
var localOptionText = self.presentationData.strings.Conversation_DeleteMessagesForMe
if case .peer(self.context.account.peerId) = self.chatLocation {
if self.chatLocation.peerId == self.context.account.peerId {
//TODO:localize
localOptionText = "Remove from Saved Messages"
} else if case .scheduledMessages = self.presentationInterfaceState.subject {
@@ -18014,7 +18014,7 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G
)
)
if canReplyInChat(self.presentationInterfaceState) {
if canReplyInChat(self.presentationInterfaceState, accountPeerId: self.context.account.peerId) {
inputShortcuts.append(
KeyShortcut(
input: UIKeyCommand.inputUpArrow,

View File

@@ -249,7 +249,7 @@ private func canViewReadStats(message: Message, participantCount: Int?, isMessag
return true
}
func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) -> Bool {
func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, accountPeerId: PeerId) -> Bool {
guard let peer = chatPresentationInterfaceState.renderedPeer?.peer else {
return false
}
@@ -272,6 +272,9 @@ func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceS
default:
break
}
if case let .replyThread(replyThreadMessage) = chatPresentationInterfaceState.chatLocation, replyThreadMessage.peerId == accountPeerId {
return false
}
if let channel = peer as? TelegramChannel, channel.flags.contains(.isForum) {
if let threadData = chatPresentationInterfaceState.threadData {
@@ -611,7 +614,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState
}
}
var canReply = canReplyInChat(chatPresentationInterfaceState)
var canReply = canReplyInChat(chatPresentationInterfaceState, accountPeerId: context.account.peerId)
var canPin = false
let canSelect = !isAction