Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8865.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add a confirmation dialog of reporting the user.
1 change: 0 additions & 1 deletion changelog.d/8904.bugfix

This file was deleted.

5 changes: 5 additions & 0 deletions library/ui-strings/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,11 @@
<string name="room_participants_action_unignore_prompt_msg">Unignoring this user will show all messages from them again.</string>
<string name="room_participants_action_unignore">Unignore</string>

<string name="room_participants_action_report_title">Report user</string>
<string name="room_participants_action_report_prompt_msg">Reporting this user will report this user to the server administrators and room moderators.</string>
<string name="room_participants_action_report">Report</string>
<string name="room_participants_action_report_reason">Reporting user %1$s</string>

<string name="room_participants_action_cancel_invite_title">Cancel invite</string>
<string name="room_participants_action_cancel_invite_prompt_msg">Are you sure you want to cancel the invite for this user?</string>
<string name="room_participants_remove_title">Remove user</string>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down