Add action to report a user form the message detail bottom sheet. #8796
This commit is contained in:
parent
237580c7f4
commit
99ec61e120
|
@ -1953,8 +1953,11 @@
|
||||||
<string name="content_reported_as_spam_content">"This content was reported as spam.\n\nIf you don't want to see any more content from this user, you can ignore them to hide their messages."</string>
|
<string name="content_reported_as_spam_content">"This content was reported as spam.\n\nIf you don't want to see any more content from this user, you can ignore them to hide their messages."</string>
|
||||||
<string name="content_reported_as_inappropriate_title">"Reported as inappropriate"</string>
|
<string name="content_reported_as_inappropriate_title">"Reported as inappropriate"</string>
|
||||||
<string name="content_reported_as_inappropriate_content">"This content was reported as inappropriate.\n\nIf you don't want to see any more content from this user, you can ignore them to hide their messages."</string>
|
<string name="content_reported_as_inappropriate_content">"This content was reported as inappropriate.\n\nIf you don't want to see any more content from this user, you can ignore them to hide their messages."</string>
|
||||||
|
<string name="user_reported_as_inappropriate_title">"Reported user"</string>
|
||||||
|
<string name="user_reported_as_inappropriate_content">"The user has been reported.\n\nIf you don't want to see any more content from this user, you can ignore them to hide their messages."</string>
|
||||||
|
|
||||||
<string name="message_ignore_user">Ignore user</string>
|
<string name="message_ignore_user">Ignore user</string>
|
||||||
|
<string name="message_report_user">Report user</string>
|
||||||
|
|
||||||
<string name="room_list_quick_actions_notifications_all_noisy">"All messages (noisy)"</string>
|
<string name="room_list_quick_actions_notifications_all_noisy">"All messages (noisy)"</string>
|
||||||
<string name="room_list_quick_actions_notifications_all">"All messages"</string>
|
<string name="room_list_quick_actions_notifications_all">"All messages"</string>
|
||||||
|
|
|
@ -61,7 +61,8 @@ sealed class RoomDetailAction : VectorViewModelAction {
|
||||||
val senderId: String?,
|
val senderId: String?,
|
||||||
val reason: String,
|
val reason: String,
|
||||||
val spam: Boolean = false,
|
val spam: Boolean = false,
|
||||||
val inappropriate: Boolean = false
|
val inappropriate: Boolean = false,
|
||||||
|
val user: Boolean = false,
|
||||||
) : RoomDetailAction()
|
) : RoomDetailAction()
|
||||||
|
|
||||||
data class IgnoreUser(val userId: String?) : RoomDetailAction()
|
data class IgnoreUser(val userId: String?) : RoomDetailAction()
|
||||||
|
|
|
@ -1345,6 +1345,16 @@ class TimelineFragment :
|
||||||
}
|
}
|
||||||
.show()
|
.show()
|
||||||
}
|
}
|
||||||
|
data.user -> {
|
||||||
|
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
||||||
|
.setTitle(R.string.user_reported_as_inappropriate_title)
|
||||||
|
.setMessage(R.string.user_reported_as_inappropriate_content)
|
||||||
|
.setPositiveButton(R.string.ok, null)
|
||||||
|
.setNegativeButton(R.string.block_user) { _, _ ->
|
||||||
|
timelineViewModel.handle(RoomDetailAction.IgnoreUser(data.senderId))
|
||||||
|
}
|
||||||
|
.show()
|
||||||
|
}
|
||||||
else -> {
|
else -> {
|
||||||
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
MaterialAlertDialogBuilder(requireActivity(), R.style.ThemeOverlay_Vector_MaterialAlertDialog_NegativeDestructive)
|
||||||
.setTitle(R.string.content_reported_title)
|
.setTitle(R.string.content_reported_title)
|
||||||
|
@ -1857,6 +1867,13 @@ class TimelineFragment :
|
||||||
is EventSharedAction.IgnoreUser -> {
|
is EventSharedAction.IgnoreUser -> {
|
||||||
action.senderId?.let { askConfirmationToIgnoreUser(it) }
|
action.senderId?.let { askConfirmationToIgnoreUser(it) }
|
||||||
}
|
}
|
||||||
|
is EventSharedAction.ReportUser -> {
|
||||||
|
timelineViewModel.handle(
|
||||||
|
RoomDetailAction.ReportContent(
|
||||||
|
action.eventId, action.senderId, "Reporting user ${action.senderId}", user = true
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
is EventSharedAction.OnUrlClicked -> {
|
is EventSharedAction.OnUrlClicked -> {
|
||||||
onUrlClicked(action.url, action.title)
|
onUrlClicked(action.url, action.title)
|
||||||
}
|
}
|
||||||
|
|
|
@ -98,6 +98,9 @@ sealed class EventSharedAction(
|
||||||
data class IgnoreUser(val senderId: String?) :
|
data class IgnoreUser(val senderId: String?) :
|
||||||
EventSharedAction(R.string.message_ignore_user, R.drawable.ic_alert_triangle, true)
|
EventSharedAction(R.string.message_ignore_user, R.drawable.ic_alert_triangle, true)
|
||||||
|
|
||||||
|
data class ReportUser(val eventId: String, val senderId: String?) :
|
||||||
|
EventSharedAction(R.string.message_report_user, R.drawable.ic_flag, true)
|
||||||
|
|
||||||
data class QuickReact(val eventId: String, val clickedOn: String, val add: Boolean) :
|
data class QuickReact(val eventId: String, val clickedOn: String, val add: Boolean) :
|
||||||
EventSharedAction(0, 0)
|
EventSharedAction(0, 0)
|
||||||
|
|
||||||
|
|
|
@ -430,6 +430,12 @@ class MessageActionsViewModel @AssistedInject constructor(
|
||||||
|
|
||||||
add(EventSharedAction.Separator)
|
add(EventSharedAction.Separator)
|
||||||
add(EventSharedAction.IgnoreUser(timelineEvent.root.senderId))
|
add(EventSharedAction.IgnoreUser(timelineEvent.root.senderId))
|
||||||
|
add(
|
||||||
|
EventSharedAction.ReportUser(
|
||||||
|
eventId = eventId,
|
||||||
|
senderId = timelineEvent.root.senderId,
|
||||||
|
)
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue