diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 4ac08046aa..2e8addd742 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -14623,7 +14623,7 @@ Sorry for the inconvenience."; "VoiceOver.SuggestPost" = "Suggest Post"; "Chat.ContextMenu.SuggestedPost.EditMessage" = "Edit Message"; -"Chat.ContextMenu.SuggestedPost.EditPrice" = "Edit Prive"; +"Chat.ContextMenu.SuggestedPost.EditPrice" = "Edit Price"; "Chat.ContextMenu.SuggestedPost.EditTime" = "Edit Time"; "Chat.ContextMenu.SuggestedPost.Create" = "Suggest Post"; diff --git a/submodules/TelegramUI/Sources/Chat/ChatMessageActionOptions.swift b/submodules/TelegramUI/Sources/Chat/ChatMessageActionOptions.swift index 4db78b786f..410da4a718 100644 --- a/submodules/TelegramUI/Sources/Chat/ChatMessageActionOptions.swift +++ b/submodules/TelegramUI/Sources/Chat/ChatMessageActionOptions.swift @@ -989,27 +989,64 @@ extension ChatControllerImpl { let subject: StarsWithdrawalScreenSubject if postSuggestionState.editingOriginalMessageId != nil { - subject = .postSuggestionModification(current: postSuggestionState.price ?? CurrencyAmount(amount: .zero, currency: .stars), timestamp: postSuggestionState.timestamp, completion: { [weak self] price, timestamp in - guard let self else { - return + var isFromAdmin = false + if let channel = self.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum { + if let linkedMonoforumId = channel.linkedMonoforumId, let mainChannel = self.presentationInterfaceState.renderedPeer?.peers[linkedMonoforumId] as? TelegramChannel, mainChannel.hasPermission(.manageDirect) { + isFromAdmin = true } - - let price: CurrencyAmount? = price.amount == .zero ? nil : price - - self.updateChatPresentationInterfaceState(interactive: true, { state in - var state = state - state = state.updatedInterfaceState { interfaceState in - var interfaceState = interfaceState - interfaceState = interfaceState.withUpdatedPostSuggestionState(ChatInterfaceState.PostSuggestionState( - editingOriginalMessageId: interfaceState.postSuggestionState?.editingOriginalMessageId, - price: price, - timestamp: timestamp - )) - return interfaceState + } + + if isFromAdmin { + subject = .postSuggestionModification(current: postSuggestionState.price ?? CurrencyAmount(amount: .zero, currency: .stars), timestamp: postSuggestionState.timestamp, completion: { [weak self] price, timestamp in + guard let self else { + return } - return state + + let price: CurrencyAmount? = price.amount == .zero ? nil : price + + self.updateChatPresentationInterfaceState(interactive: true, { state in + var state = state + state = state.updatedInterfaceState { interfaceState in + var interfaceState = interfaceState + interfaceState = interfaceState.withUpdatedPostSuggestionState(ChatInterfaceState.PostSuggestionState( + editingOriginalMessageId: interfaceState.postSuggestionState?.editingOriginalMessageId, + price: price, + timestamp: timestamp + )) + return interfaceState + } + return state + }) }) - }) + } else { + subject = .postSuggestion( + channel: .channel(channel), + isFromAdmin: false, + current: postSuggestionState.price ?? CurrencyAmount(amount: .zero, currency: .stars), + timestamp: postSuggestionState.timestamp, + completion: { [weak self] price, timestamp in + guard let self else { + return + } + + let price: CurrencyAmount? = price.amount == .zero ? nil : price + + self.updateChatPresentationInterfaceState(interactive: true, { state in + var state = state + state = state.updatedInterfaceState { interfaceState in + var interfaceState = interfaceState + interfaceState = interfaceState.withUpdatedPostSuggestionState(ChatInterfaceState.PostSuggestionState( + editingOriginalMessageId: interfaceState.postSuggestionState?.editingOriginalMessageId, + price: price, + timestamp: timestamp + )) + return interfaceState + } + return state + }) + } + ) + } } else { var isFromAdmin = false if let channel = self.presentationInterfaceState.renderedPeer?.peer as? TelegramChannel, channel.isMonoForum {