1
0
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:
Benoit Marty
2025-02-07 16:29:35 +01:00
parent 753101ff7a
commit b204d271e3
7 changed files with 101 additions and 12 deletions

View File

@ -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)