Add banning from reaction report

This commit is contained in:
Ilya Laktyushin 2024-04-21 15:48:48 +04:00
parent d39317aa4c
commit e6881a78dc
2 changed files with 40 additions and 8 deletions

View File

@ -12104,3 +12104,9 @@ Sorry for the inconvenience.";
"Channel.AdminLog.MessageManyDeleted.HideAll" = "hide all";
"Shortcut.AppIcon" = "Edit App Icon";
"ReportPeer.BanAndReport" = "Ban and Report";
"ReportPeer.ReportReaction.Text" = "Are you sure you want to report reactions from this user?";
"ReportPeer.ReportReaction.BanAndReport" = "Ban and Report";
"ReportPeer.ReportReaction.Report" = "Report Reaction";

View File

@ -1370,7 +1370,7 @@ private func infoItems(data: PeerInfoScreenData?, context: AccountContext, prese
interaction.openChat(nil)
}))
items[.peerInfo]!.append(PeerInfoScreenActionItem(id: 4, text: presentationData.strings.ReportPeer_ReportReaction, color: .destructive, action: {
items[.peerInfo]!.append(PeerInfoScreenActionItem(id: 4, text: presentationData.strings.ReportPeer_BanAndReport, color: .destructive, action: {
interaction.openReport(.reaction(reactionSourceMessageId))
}))
} else if let _ = nearbyPeerDistance {
@ -8004,6 +8004,27 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
switch type {
case let .reaction(sourceMessageId):
let presentationData = self.presentationData
let actionSheet = ActionSheetController(presentationData: presentationData)
let dismissAction: () -> Void = { [weak actionSheet] in
actionSheet?.dismissAnimated()
}
actionSheet.setItemGroups([
ActionSheetItemGroup(items: [
ActionSheetTextItem(title: presentationData.strings.ReportPeer_ReportReaction_Text),
ActionSheetButtonItem(title: presentationData.strings.ReportPeer_ReportReaction_BanAndReport, color: .destructive, action: { [weak self] in
dismissAction()
guard let self else {
return
}
self.activeActionDisposable.set(self.context.engine.privacy.requestUpdatePeerIsBlocked(peerId: self.peerId, isBlocked: true).startStrict())
self.controller?.present(UndoOverlayController(presentationData: self.presentationData, content: .emoji(name: "PoliceCar", text: self.presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), in: .current)
}),
ActionSheetButtonItem(title: presentationData.strings.ReportPeer_ReportReaction_Report, action: { [weak self] in
dismissAction()
guard let self else {
return
}
let _ = (self.context.engine.peers.reportPeerReaction(authorId: self.peerId, messageId: sourceMessageId)
|> deliverOnMainQueue).startStandalone(completed: { [weak self] in
guard let strongSelf = self else {
@ -8011,6 +8032,11 @@ final class PeerInfoScreenNode: ViewControllerTracingNode, PeerInfoScreenNodePro
}
strongSelf.controller?.present(UndoOverlayController(presentationData: strongSelf.presentationData, content: .emoji(name: "PoliceCar", text: strongSelf.presentationData.strings.Report_Succeed), elevatedLayout: false, action: { _ in return false }), in: .current)
})
})
]),
ActionSheetItemGroup(items: [ActionSheetButtonItem(title: presentationData.strings.Common_Cancel, action: { dismissAction() })])
])
self.controller?.present(actionSheet, in: .window(.root))
default:
let options: [PeerReportOption]
if case .user = type {