Skip to content

Commit 09f75af

Browse files
authored
Merge pull request #7805 from element-hq/stefan/reportRooms
Report rooms
2 parents 7e71a84 + 249478e commit 09f75af

17 files changed

+146
-26
lines changed

Riot/Assets/en.lproj/Vector.strings

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -592,6 +592,8 @@ Tap the + to start adding people.";
592592
"room_action_send_sticker" = "Send sticker";
593593
"room_action_send_file" = "Send file";
594594
"room_action_reply" = "Reply";
595+
"room_action_report" = "Report room";
596+
"room_action_report_prompt_reason" = "Reason for reporting this room";
595597
"room_replacement_information" = "This room has been replaced and is no longer active.";
596598
"room_replacement_link" = "The conversation continues here.";
597599
"room_predecessor_information" = "This room is a continuation of another conversation.";

Riot/Generated/Strings.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5207,6 +5207,14 @@ public class VectorL10n: NSObject {
52075207
public static var roomActionReply: String {
52085208
return VectorL10n.tr("Vector", "room_action_reply")
52095209
}
5210+
/// Report room
5211+
public static var roomActionReport: String {
5212+
return VectorL10n.tr("Vector", "room_action_report")
5213+
}
5214+
/// Reason for reporting this room
5215+
public static var roomActionReportPromptReason: String {
5216+
return VectorL10n.tr("Vector", "room_action_report_prompt_reason")
5217+
}
52105218
/// Send file
52115219
public static var roomActionSendFile: String {
52125220
return VectorL10n.tr("Vector", "room_action_send_file")

Riot/Modules/Room/RoomInfo/RoomInfoCoordinator.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,9 @@ extension RoomInfoCoordinator: RoomInfoListCoordinatorDelegate {
224224
self.delegate?.roomInfoCoordinatorDidLeaveRoom(self)
225225
}
226226

227+
func roomInfoListCoordinatorDidRequestReportRoom(_ coordinator: RoomInfoListCoordinatorType) {
228+
self.delegate?.roomInfoCoordinatorDidRequestReportRoom(self)
229+
}
227230
}
228231

229232
extension RoomInfoCoordinator: RoomParticipantsViewControllerDelegate {

Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorBridgePresenter.swift

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import MatrixSDK
2525
func roomInfoCoordinatorBridgePresenterDelegateDidLeaveRoom(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter)
2626
func roomInfoCoordinatorBridgePresenter(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter, didReplaceRoomWithReplacementId roomId: String)
2727
func roomInfoCoordinatorBridgePresenter(_ coordinator: RoomInfoCoordinatorBridgePresenter, viewEventInTimeline event: MXEvent)
28+
func roomInfoCoordinatorBridgePresenterDidRequestReportRoom(_ coordinatorBridgePresenter: RoomInfoCoordinatorBridgePresenter)
2829
}
2930

3031
/// RoomInfoCoordinatorBridgePresenter enables to start RoomInfoCoordinator from a view controller.
@@ -131,9 +132,14 @@ extension RoomInfoCoordinatorBridgePresenter: RoomInfoCoordinatorDelegate {
131132
func roomInfoCoordinator(_ coordinator: RoomInfoCoordinatorType, didReplaceRoomWithReplacementId roomId: String) {
132133
self.delegate?.roomInfoCoordinatorBridgePresenter(self, didReplaceRoomWithReplacementId: roomId)
133134
}
135+
134136
func roomInfoCoordinator(_ coordinator: RoomInfoCoordinatorType, viewEventInTimeline event: MXEvent) {
135137
self.delegate?.roomInfoCoordinatorBridgePresenter(self, viewEventInTimeline: event)
136138
}
139+
140+
func roomInfoCoordinatorDidRequestReportRoom(_ coordinator: RoomInfoCoordinatorType) {
141+
self.delegate?.roomInfoCoordinatorBridgePresenterDidRequestReportRoom(self)
142+
}
137143
}
138144

139145
// MARK: - UIAdaptivePresentationControllerDelegate

Riot/Modules/Room/RoomInfo/RoomInfoCoordinatorType.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ protocol RoomInfoCoordinatorDelegate: AnyObject {
2525
func roomInfoCoordinatorDidLeaveRoom(_ coordinator: RoomInfoCoordinatorType)
2626
func roomInfoCoordinator(_ coordinator: RoomInfoCoordinatorType, didReplaceRoomWithReplacementId roomId: String)
2727
func roomInfoCoordinator(_ coordinator: RoomInfoCoordinatorType, viewEventInTimeline event: MXEvent)
28+
func roomInfoCoordinatorDidRequestReportRoom(_ coordinator: RoomInfoCoordinatorType)
2829
}
2930

3031
/// `RoomInfoCoordinatorType` is a protocol describing a Coordinator that handle keybackup setup navigation flow.

Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinator.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,7 @@ extension RoomInfoListCoordinator: RoomInfoListViewModelCoordinatorDelegate {
7575
self.delegate?.roomInfoListCoordinatorDidLeaveRoom(self)
7676
}
7777

78+
func roomInfoListViewModelDidRequestReportRoom(_ viewModel: RoomInfoListViewModelType) {
79+
self.delegate?.roomInfoListCoordinatorDidRequestReportRoom(self)
80+
}
7881
}

Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListCoordinatorType.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ protocol RoomInfoListCoordinatorDelegate: AnyObject {
2222
func roomInfoListCoordinator(_ coordinator: RoomInfoListCoordinatorType, wantsToNavigateTo target: RoomInfoListTarget)
2323
func roomInfoListCoordinatorDidCancel(_ coordinator: RoomInfoListCoordinatorType)
2424
func roomInfoListCoordinatorDidLeaveRoom(_ coordinator: RoomInfoListCoordinatorType)
25+
func roomInfoListCoordinatorDidRequestReportRoom(_ coordinator: RoomInfoListCoordinatorType)
2526
}
2627

2728
/// `RoomInfoListCoordinatorType` is a protocol describing a Coordinator that handle key backup setup passphrase navigation flow.

Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewAction.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,4 +48,5 @@ enum RoomInfoListViewAction {
4848
case navigate(target: RoomInfoListTarget)
4949
case leave
5050
case cancel
51+
case report
5152
}

Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewController.swift

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,16 @@ final class RoomInfoListViewController: UIViewController {
222222
rows: [rowLeave],
223223
footer: nil)
224224

225+
let rowReport = Row(type: .destructive, icon: Asset.Images.error.image, text: VectorL10n.roomEventActionReport, accessoryType: .disclosureIndicator) {
226+
self.viewModel.process(viewAction: .report)
227+
}
228+
let sectionReport = Section(header: nil,
229+
rows: [rowReport],
230+
footer: nil)
231+
225232
tmpSections.append(sectionSettings)
226233
tmpSections.append(sectionLeave)
234+
tmpSections.append(sectionReport)
227235

228236
sections = tmpSections
229237
}

Riot/Modules/Room/RoomInfo/RoomInfoList/RoomInfoListViewModel.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,8 @@ final class RoomInfoListViewModel: NSObject, RoomInfoListViewModelType {
7979
self.leave()
8080
case .cancel:
8181
self.coordinatorDelegate?.roomInfoListViewModelDidCancel(self)
82+
case .report:
83+
self.coordinatorDelegate?.roomInfoListViewModelDidRequestReportRoom(self)
8284
}
8385
}
8486

0 commit comments

Comments
 (0)