mirror of
https://github.com/LemmyNet/lemmy.git
synced 2025-01-10 03:55:54 +00:00
parent
d83f96293d
commit
15473e5137
2 changed files with 4 additions and 3 deletions
|
@ -110,7 +110,7 @@ pub(crate) async fn get_activity(
|
||||||
.into();
|
.into();
|
||||||
let activity = SentActivity::read_from_apub_id(&mut context.pool(), &activity_id)
|
let activity = SentActivity::read_from_apub_id(&mut context.pool(), &activity_id)
|
||||||
.await
|
.await
|
||||||
.with_lemmy_type(FederationError::CouldntFindActivity.into())?;
|
.with_lemmy_type(LemmyErrorType::NotFound)?;
|
||||||
|
|
||||||
let sensitive = activity.sensitive;
|
let sensitive = activity.sensitive;
|
||||||
if sensitive {
|
if sensitive {
|
||||||
|
|
|
@ -164,8 +164,6 @@ pub enum LemmyErrorType {
|
||||||
#[cfg_attr(feature = "full", ts(export))]
|
#[cfg_attr(feature = "full", ts(export))]
|
||||||
#[non_exhaustive]
|
#[non_exhaustive]
|
||||||
pub enum FederationError {
|
pub enum FederationError {
|
||||||
// TODO: merge into a single NotFound error
|
|
||||||
CouldntFindActivity,
|
|
||||||
InvalidCommunity,
|
InvalidCommunity,
|
||||||
CannotCreatePostOrCommentInDeletedOrRemovedCommunity,
|
CannotCreatePostOrCommentInDeletedOrRemovedCommunity,
|
||||||
CannotReceivePage,
|
CannotReceivePage,
|
||||||
|
@ -246,6 +244,9 @@ cfg_if! {
|
||||||
if self.error_type == LemmyErrorType::IncorrectLogin {
|
if self.error_type == LemmyErrorType::IncorrectLogin {
|
||||||
return actix_web::http::StatusCode::UNAUTHORIZED;
|
return actix_web::http::StatusCode::UNAUTHORIZED;
|
||||||
}
|
}
|
||||||
|
if self.error_type == LemmyErrorType::NotFound {
|
||||||
|
return actix_web::http::StatusCode::NOT_FOUND;
|
||||||
|
}
|
||||||
match self.inner.downcast_ref::<diesel::result::Error>() {
|
match self.inner.downcast_ref::<diesel::result::Error>() {
|
||||||
Some(diesel::result::Error::NotFound) => actix_web::http::StatusCode::NOT_FOUND,
|
Some(diesel::result::Error::NotFound) => actix_web::http::StatusCode::NOT_FOUND,
|
||||||
_ => actix_web::http::StatusCode::BAD_REQUEST,
|
_ => actix_web::http::StatusCode::BAD_REQUEST,
|
||||||
|
|
Loading…
Reference in a new issue