diff --git a/changelog.d/8865.bugfix b/changelog.d/8865.bugfix new file mode 100644 index 00000000000..7c32637de95 --- /dev/null +++ b/changelog.d/8865.bugfix @@ -0,0 +1 @@ +Add a confirmation dialog of reporting the user. diff --git a/changelog.d/8904.bugfix b/changelog.d/8904.bugfix deleted file mode 100644 index a584da69020..00000000000 --- a/changelog.d/8904.bugfix +++ /dev/null @@ -1 +0,0 @@ -Intercept mobile.element.io links with Element app diff --git a/library/ui-strings/src/main/res/values/strings.xml b/library/ui-strings/src/main/res/values/strings.xml index 30e6ef673ed..27e55278550 100644 --- a/library/ui-strings/src/main/res/values/strings.xml +++ b/library/ui-strings/src/main/res/values/strings.xml @@ -707,6 +707,11 @@ Unignoring this user will show all messages from them again. Unignore + Report user + Reporting this user will report this user to the server administrators and room moderators. + Report + Reporting user %1$s + Cancel invite Are you sure you want to cancel the invite for this user? Remove user diff --git a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt index 5806b000e5c..cf857064c02 100644 --- a/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt +++ b/vector/src/main/java/im/vector/app/features/home/room/detail/TimelineFragment.kt @@ -1877,11 +1877,7 @@ class TimelineFragment : action.senderId?.let { askConfirmationToIgnoreUser(it) } } is EventSharedAction.ReportUser -> { - timelineViewModel.handle( - RoomDetailAction.ReportContent( - action.eventId, action.senderId, "Reporting user ${action.senderId}", user = true - ) - ) + askConfirmationToReportUser(action.eventId, action.senderId) } is EventSharedAction.OnUrlClicked -> { onUrlClicked(action.url, action.title) @@ -1931,6 +1927,19 @@ class TimelineFragment : .show() } + private fun askConfirmationToReportUser(eventId: String, senderId: String?) { + MaterialAlertDialogBuilder(requireContext(), im.vector.lib.ui.styles.R.style.ThemeOverlay_Vector_MaterialAlertDialog_Destructive) + .setTitle(CommonStrings.room_participants_action_report_title) + .setMessage(CommonStrings.room_participants_action_report_prompt_msg) + .setNegativeButton(CommonStrings.action_cancel, null) + .setPositiveButton(CommonStrings.room_participants_action_report) { _, _ -> + timelineViewModel.handle(RoomDetailAction.ReportContent( + eventId, senderId, getString(CommonStrings.room_participants_action_report_reason, senderId ), user = true + )) + } + .show() + } + private fun showSnackWithMessage(message: String) { view?.showOptimizedSnackbar(message) } diff --git a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt index 69f499a307d..05ede4692cd 100644 --- a/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt +++ b/vector/src/main/java/im/vector/app/features/roommemberprofile/RoomMemberProfileFragment.kt @@ -302,7 +302,17 @@ class RoomMemberProfileFragment : } override fun onReportClicked() { - viewModel.handle(RoomMemberProfileAction.ReportUser) + ConfirmationDialogBuilder + .show( + activity = requireActivity(), + askForReason = false, + confirmationRes = CommonStrings.room_participants_action_report_prompt_msg, + positiveRes = CommonStrings.room_participants_action_report, + reasonHintRes = 0, + titleRes = CommonStrings.room_participants_action_report_title + ) { + viewModel.handle(RoomMemberProfileAction.ReportUser) + } } override fun onTapVerify() {