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,7 +1645,10 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
if case .admin = authorRank { if case .admin = authorRank {
} else if case .owner = authorRank { } else if case .owner = authorRank {
} else if authorRank == nil { } else if authorRank == nil {
enableAutoRank = true if case let .replyThread(replyThreadMessage) = item.chatLocation, replyThreadMessage.peerId == item.context.account.peerId {
} else {
enableAutoRank = true
}
} }
if enableAutoRank { if enableAutoRank {
if let topicAuthorId = item.associatedData.topicAuthorId, topicAuthorId == message.author?.id { if let topicAuthorId = item.associatedData.topicAuthorId, topicAuthorId == message.author?.id {

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 return .reply
} else if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info { } 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) { if options.contains(.deleteLocally) {
var localOptionText = self.presentationData.strings.Conversation_DeleteMessagesForMe 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 //TODO:localize
localOptionText = "Remove from Saved Messages" localOptionText = "Remove from Saved Messages"
} else if case .scheduledMessages = self.presentationInterfaceState.subject { } 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( inputShortcuts.append(
KeyShortcut( KeyShortcut(
input: UIKeyCommand.inputUpArrow, input: UIKeyCommand.inputUpArrow,

View File

@@ -249,7 +249,7 @@ private func canViewReadStats(message: Message, participantCount: Int?, isMessag
return true return true
} }
func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState) -> Bool { func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceState, accountPeerId: PeerId) -> Bool {
guard let peer = chatPresentationInterfaceState.renderedPeer?.peer else { guard let peer = chatPresentationInterfaceState.renderedPeer?.peer else {
return false return false
} }
@@ -272,6 +272,9 @@ func canReplyInChat(_ chatPresentationInterfaceState: ChatPresentationInterfaceS
default: default:
break 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 channel = peer as? TelegramChannel, channel.flags.contains(.isForum) {
if let threadData = chatPresentationInterfaceState.threadData { 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 var canPin = false
let canSelect = !isAction let canSelect = !isAction