Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(sdk&ffi): report room api #4713

Merged
merged 4 commits into from
Feb 26, 2025
Merged
Changes from 1 commit
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
25 changes: 25 additions & 0 deletions bindings/matrix-sdk-ffi/src/room.rs
Original file line number Diff line number Diff line change
@@ -14,6 +14,7 @@ use matrix_sdk_ui::timeline::{default_event_filter, RoomExt};
use mime::Mime;
use ruma::{
api::client::room::report_content,
api::client::room::report_room,
assign,
events::{
call::notify,
@@ -389,6 +390,30 @@ impl Room {
Ok(())
}

/// Reports a room as inappropriate to the server.
/// The caller is not required to be joined to the room to report it.
///
/// # Arguments
///
/// * `reason` - The reason the room is being reported.
///
/// # Errors
///
/// Returns an error if the room is not found or on rate limit
pub async fn report_room(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here.

&self,
reason: Option<String>,
) -> Result<(), ClientError> {
let mut request = report_room::v3::Request::new(self.inner.room_id().into());
request.reason = reason;

self.inner
.client()
.send(request)
.await?;
Ok(())
}

/// Ignores a user.
///
/// # Arguments