You've already forked element-android
mirror of
https://github.com/vector-im/element-android.git
synced 2025-07-31 07:04:23 +03:00
Add action to report room: use the report Room API.
This commit is contained in:
@ -184,17 +184,7 @@ class RoomProfileViewModel @AssistedInject constructor(
|
||||
_viewEvents.post(RoomProfileViewEvents.Loading())
|
||||
session.coroutineScope.launch {
|
||||
try {
|
||||
// When reporting a user, use the user state event if available (it should always be available)
|
||||
val createStateEventId = room.stateService()
|
||||
.getStateEvent(EventType.STATE_ROOM_CREATE, QueryStringValue.IsEmpty)
|
||||
?.eventId
|
||||
?: throw IllegalStateException("Failure: m.room.create event not found.")
|
||||
room.reportingService()
|
||||
.reportContent(
|
||||
eventId = createStateEventId,
|
||||
score = -100,
|
||||
reason = reason,
|
||||
)
|
||||
room.reportingService().reportRoom(reason = reason)
|
||||
_viewEvents.post(
|
||||
RoomProfileViewEvents.Success(
|
||||
stringProvider.getString(CommonStrings.room_profile_section_more_report_success_content)
|
||||
|
Reference in New Issue
Block a user