* Dont show deleted users or communities on profile page.
- Fixes #2448
* Fix missing communities
* Add include_deleted to resolve_actor_identifier.
let search_type = data.type_.unwrap_or(SearchType::All);
let community_id = data.community_id;
let community_actor_id = if let Some(name) = &data.community_name {
let search_type = data.type_.unwrap_or(SearchType::All);
let community_id = data.community_id;
let community_actor_id = if let Some(name) = &data.community_name {
- resolve_actor_identifier::<ApubCommunity, Community>(name, context)
+ resolve_actor_identifier::<ApubCommunity, Community>(name, context, false)
.await
.ok()
.map(|c| c.actor_id)
.await
.ok()
.map(|c| c.actor_id)
let listing_type = listing_type_with_site_default(data.type_, context.pool()).await?;
let community_actor_id = if let Some(name) = &data.community_name {
let listing_type = listing_type_with_site_default(data.type_, context.pool()).await?;
let community_actor_id = if let Some(name) = &data.community_name {
- resolve_actor_identifier::<ApubCommunity, Community>(name, context)
+ resolve_actor_identifier::<ApubCommunity, Community>(name, context, true)
.await
.ok()
.map(|c| c.actor_id)
.await
.ok()
.map(|c| c.actor_id)
Some(id) => id,
None => {
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
Some(id) => id,
None => {
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
- resolve_actor_identifier::<ApubCommunity, Community>(&name, context)
+ resolve_actor_identifier::<ApubCommunity, Community>(&name, context, true)
.await
.map_err(|e| e.with_message("couldnt_find_community"))?
.id
.await
.map_err(|e| e.with_message("couldnt_find_community"))?
.id
let limit = data.limit;
let community_id = data.community_id;
let community_actor_id = if let Some(name) = &data.community_name {
let limit = data.limit;
let community_id = data.community_id;
let community_actor_id = if let Some(name) = &data.community_name {
- resolve_actor_identifier::<ApubCommunity, Community>(name, context)
+ resolve_actor_identifier::<ApubCommunity, Community>(name, context, true)
.await
.ok()
.map(|c| c.actor_id)
.await
.ok()
.map(|c| c.actor_id)
Some(id) => id,
None => {
if let Some(username) = &data.username {
Some(id) => id,
None => {
if let Some(username) = &data.username {
- resolve_actor_identifier::<ApubPerson, Person>(username, context)
+ resolve_actor_identifier::<ApubPerson, Person>(username, context, true)
.await
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
.id
.await
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
.id
pub async fn resolve_actor_identifier<Actor, DbActor>(
identifier: &str,
context: &LemmyContext,
pub async fn resolve_actor_identifier<Actor, DbActor>(
identifier: &str,
context: &LemmyContext,
) -> Result<DbActor, LemmyError>
where
Actor: ApubObject<DataType = LemmyContext, Error = LemmyError>
) -> Result<DbActor, LemmyError>
where
Actor: ApubObject<DataType = LemmyContext, Error = LemmyError>
let identifier = identifier.to_string();
Ok(
blocking(context.pool(), move |conn| {
let identifier = identifier.to_string();
Ok(
blocking(context.pool(), move |conn| {
- DbActor::read_from_name(conn, &identifier, false)
+ DbActor::read_from_name(conn, &identifier, include_deleted)
Community::safe_columns_tuple(),
))
.filter(community_block::person_id.eq(person_id))
Community::safe_columns_tuple(),
))
.filter(community_block::person_id.eq(person_id))
+ .filter(community::deleted.eq(false))
+ .filter(community::removed.eq(false))
.order_by(community_block::published)
.load::<CommunityBlockViewTuple>(conn)?;
.order_by(community_block::published)
.load::<CommunityBlockViewTuple>(conn)?;
Person::safe_columns_tuple(),
))
.filter(community_follower::person_id.eq(person_id))
Person::safe_columns_tuple(),
))
.filter(community_follower::person_id.eq(person_id))
+ .filter(community::deleted.eq(false))
+ .filter(community::removed.eq(false))
.order_by(community::title)
.load::<CommunityFollowerViewTuple>(conn)?;
.order_by(community::title)
.load::<CommunityFollowerViewTuple>(conn)?;
Person::safe_columns_tuple(),
))
.filter(community_moderator::person_id.eq(person_id))
Person::safe_columns_tuple(),
))
.filter(community_moderator::person_id.eq(person_id))
+ .filter(community::deleted.eq(false))
+ .filter(community::removed.eq(false))
.order_by(community_moderator::published)
.load::<CommunityModeratorViewTuple>(conn)?;
.order_by(community_moderator::published)
.load::<CommunityModeratorViewTuple>(conn)?;
person_alias_1.fields(Person::safe_columns_tuple()),
))
.filter(person_block::person_id.eq(person_id))
person_alias_1.fields(Person::safe_columns_tuple()),
))
.filter(person_block::person_id.eq(person_id))
+ .filter(person_alias_1.field(person::deleted).eq(false))
.order_by(person_block::published)
.load::<PersonBlockViewTuple>(conn)?;
.order_by(person_block::published)
.load::<PersonBlockViewTuple>(conn)?;
.inner_join(person_aggregates::table)
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
.filter(person::admin.eq(true))
.inner_join(person_aggregates::table)
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
.filter(person::admin.eq(true))
+ .filter(person::deleted.eq(false))
.order_by(person::published)
.load::<PersonViewSafeTuple>(conn)?;
.order_by(person::published)
.load::<PersonViewSafeTuple>(conn)?;
.or(person::ban_expires.gt(now)),
),
)
.or(person::ban_expires.gt(now)),
),
)
+ .filter(person::deleted.eq(false))
.load::<PersonViewSafeTuple>(conn)?;
Ok(Self::from_tuple_to_vec(banned))
.load::<PersonViewSafeTuple>(conn)?;
Ok(Self::from_tuple_to_vec(banned))