res
}
+#[tracing::instrument(skip_all)]
pub async fn is_mod_or_admin(
pool: &DbPool,
person_id: PersonId,
Ok(())
}
+#[tracing::instrument(skip_all)]
pub async fn get_post(post_id: PostId, pool: &DbPool) -> Result<Post, LemmyError> {
blocking(pool, move |conn| Post::read(conn, post_id))
.await?
.map_err(|e| e.with_message("couldnt_find_post"))
}
+#[tracing::instrument(skip_all)]
pub async fn mark_post_as_read(
person_id: PersonId,
post_id: PostId,
.map_err(|e| e.with_message("couldnt_mark_post_as_read"))
}
+#[tracing::instrument(skip_all)]
pub async fn mark_post_as_unread(
person_id: PersonId,
post_id: PostId,
.map_err(|e| e.with_message("couldnt_mark_post_as_read"))
}
+#[tracing::instrument(skip_all)]
pub async fn get_local_user_view_from_jwt(
jwt: &str,
pool: &DbPool,
let local_user_view =
blocking(pool, move |conn| LocalUserView::read(conn, local_user_id)).await??;
// Check for a site ban
- if local_user_view.person.banned {
+ if local_user_view.person.is_banned() {
return Err(LemmyError::from_message("site_ban"));
}
}
}
+#[tracing::instrument(skip_all)]
pub async fn get_local_user_view_from_jwt_opt(
jwt: Option<&Sensitive<String>>,
pool: &DbPool,
}
}
+#[tracing::instrument(skip_all)]
pub async fn get_local_user_settings_view_from_jwt(
jwt: &Sensitive<String>,
pool: &DbPool,
})
.await??;
// Check for a site ban
- if local_user_view.person.banned {
+ if local_user_view.person.is_banned() {
return Err(LemmyError::from_message("site_ban"));
}
Ok(local_user_view)
}
+#[tracing::instrument(skip_all)]
pub async fn get_local_user_settings_view_from_jwt_opt(
jwt: Option<&Sensitive<String>>,
pool: &DbPool,
}
}
+#[tracing::instrument(skip_all)]
pub async fn check_community_ban(
person_id: PersonId,
community_id: CommunityId,
}
}
+#[tracing::instrument(skip_all)]
pub async fn check_community_deleted_or_removed(
community_id: CommunityId,
pool: &DbPool,
}
}
+#[tracing::instrument(skip_all)]
pub async fn check_person_block(
my_id: PersonId,
potential_blocker_id: PersonId,
}
}
+#[tracing::instrument(skip_all)]
pub async fn check_downvotes_enabled(score: i16, pool: &DbPool) -> Result<(), LemmyError> {
if score == -1 {
let site = blocking(pool, Site::read_simple).await??;
Ok(())
}
+#[tracing::instrument(skip_all)]
pub async fn check_private_instance(
local_user_view: &Option<LocalUserView>,
pool: &DbPool,
Ok(())
}
+#[tracing::instrument(skip_all)]
pub async fn build_federated_instances(
pool: &DbPool,
federation_config: &FederationConfig,