mirror of
https://forgejo.ellis.link/continuwuation/continuwuity.git
synced 2025-07-05 03:16:02 +02:00
feat: Forbid suspended users from sending reports
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 8s
Release Docker Image / define-variables (push) Failing after 6s
Checks / Rust / Format (push) Failing after 5s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Clippy (push) Failing after 36s
Checks / Rust / Cargo Test (push) Failing after 34s
Some checks failed
Checks / Prefligit / prefligit (push) Failing after 8s
Release Docker Image / define-variables (push) Failing after 6s
Checks / Rust / Format (push) Failing after 5s
Release Docker Image / build-image (linux/amd64, release, linux-amd64, base) (push) Has been skipped
Release Docker Image / build-image (linux/arm64, release, linux-arm64, base) (push) Has been skipped
Release Docker Image / merge (push) Has been skipped
Checks / Rust / Clippy (push) Failing after 36s
Checks / Rust / Cargo Test (push) Failing after 34s
This commit is contained in:
parent
59912709aa
commit
f49c73c031
1 changed files with 9 additions and 0 deletions
|
@ -49,6 +49,9 @@ pub(crate) async fn report_room_route(
|
|||
) -> Result<report_room::v3::Response> {
|
||||
// user authentication
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
if services.users.is_suspended(sender_user).await? {
|
||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||
}
|
||||
|
||||
if body.reason.as_ref().is_some_and(|s| s.len() > 750) {
|
||||
return Err(Error::BadRequest(
|
||||
|
@ -101,6 +104,9 @@ pub(crate) async fn report_event_route(
|
|||
) -> Result<report_content::v3::Response> {
|
||||
// user authentication
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
if services.users.is_suspended(sender_user).await? {
|
||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||
}
|
||||
|
||||
delay_response().await;
|
||||
|
||||
|
@ -148,6 +154,9 @@ pub(crate) async fn report_user_route(
|
|||
) -> Result<report_user::v3::Response> {
|
||||
// user authentication
|
||||
let sender_user = body.sender_user.as_ref().expect("user is authenticated");
|
||||
if services.users.is_suspended(sender_user).await? {
|
||||
return Err!(Request(UserSuspended("You cannot perform this action while suspended.")));
|
||||
}
|
||||
|
||||
if body.reason.as_ref().is_some_and(|s| s.len() > 750) {
|
||||
return Err(Error::BadRequest(
|
||||
|
|
Loading…
Add table
Reference in a new issue