-#[async_trait::async_trait(?Send)]
-impl PerformCrud for ListCommunities {
- type Response = ListCommunitiesResponse;
+#[tracing::instrument(skip(context))]
+pub async fn list_communities(
+ data: Query<ListCommunities>,
+ context: Data<LemmyContext>,
+) -> Result<Json<ListCommunitiesResponse>, LemmyError> {
+ let local_user_view = local_user_view_from_jwt_opt(data.auth.as_ref(), &context).await;
+ let local_site = LocalSite::read(&mut context.pool()).await?;
+ let is_admin = local_user_view
+ .as_ref()
+ .map(|luv| is_admin(luv).is_ok())
+ .unwrap_or_default();