mirror of https://github.com/LemmyNet/lemmy.git
Dont show deleted users or communities on profile page. (#2450)
* Dont show deleted users or communities on profile page. - Fixes #2448 * Fix missing communities * Add include_deleted to resolve_actor_identifier.check_deleted_for_unread_count
parent
ae95f5928e
commit
ee41654394
|
@ -51,7 +51,7 @@ impl Perform for Search {
|
||||||
let search_type = data.type_.unwrap_or(SearchType::All);
|
let search_type = data.type_.unwrap_or(SearchType::All);
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
let community_actor_id = if let Some(name) = &data.community_name {
|
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
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.map(|c| c.actor_id)
|
.map(|c| c.actor_id)
|
||||||
|
|
|
@ -38,7 +38,7 @@ impl PerformCrud for GetComments {
|
||||||
let listing_type = listing_type_with_site_default(data.type_, context.pool()).await?;
|
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 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
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.map(|c| c.actor_id)
|
.map(|c| c.actor_id)
|
||||||
|
|
|
@ -43,7 +43,7 @@ impl PerformCrud for GetCommunity {
|
||||||
Some(id) => id,
|
Some(id) => id,
|
||||||
None => {
|
None => {
|
||||||
let name = data.name.to_owned().unwrap_or_else(|| "main".to_string());
|
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
|
.await
|
||||||
.map_err(|e| e.with_message("couldnt_find_community"))?
|
.map_err(|e| e.with_message("couldnt_find_community"))?
|
||||||
.id
|
.id
|
||||||
|
|
|
@ -41,7 +41,7 @@ impl PerformCrud for GetPosts {
|
||||||
let limit = data.limit;
|
let limit = data.limit;
|
||||||
let community_id = data.community_id;
|
let community_id = data.community_id;
|
||||||
let community_actor_id = if let Some(name) = &data.community_name {
|
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
|
.await
|
||||||
.ok()
|
.ok()
|
||||||
.map(|c| c.actor_id)
|
.map(|c| c.actor_id)
|
||||||
|
|
|
@ -37,7 +37,7 @@ impl PerformCrud for GetPersonDetails {
|
||||||
Some(id) => id,
|
Some(id) => id,
|
||||||
None => {
|
None => {
|
||||||
if let Some(username) = &data.username {
|
if let Some(username) = &data.username {
|
||||||
resolve_actor_identifier::<ApubPerson, Person>(username, context)
|
resolve_actor_identifier::<ApubPerson, Person>(username, context, true)
|
||||||
.await
|
.await
|
||||||
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
|
.map_err(|e| e.with_message("couldnt_find_that_username_or_email"))?
|
||||||
.id
|
.id
|
||||||
|
|
|
@ -18,6 +18,7 @@ pub mod webfinger;
|
||||||
pub async fn resolve_actor_identifier<Actor, DbActor>(
|
pub async fn resolve_actor_identifier<Actor, DbActor>(
|
||||||
identifier: &str,
|
identifier: &str,
|
||||||
context: &LemmyContext,
|
context: &LemmyContext,
|
||||||
|
include_deleted: bool,
|
||||||
) -> Result<DbActor, LemmyError>
|
) -> Result<DbActor, LemmyError>
|
||||||
where
|
where
|
||||||
Actor: ApubObject<DataType = LemmyContext, Error = LemmyError>
|
Actor: ApubObject<DataType = LemmyContext, Error = LemmyError>
|
||||||
|
@ -58,7 +59,7 @@ where
|
||||||
let identifier = identifier.to_string();
|
let identifier = identifier.to_string();
|
||||||
Ok(
|
Ok(
|
||||||
blocking(context.pool(), move |conn| {
|
blocking(context.pool(), move |conn| {
|
||||||
DbActor::read_from_name(conn, &identifier, false)
|
DbActor::read_from_name(conn, &identifier, include_deleted)
|
||||||
})
|
})
|
||||||
.await??,
|
.await??,
|
||||||
)
|
)
|
||||||
|
|
|
@ -22,6 +22,8 @@ impl CommunityBlockView {
|
||||||
Community::safe_columns_tuple(),
|
Community::safe_columns_tuple(),
|
||||||
))
|
))
|
||||||
.filter(community_block::person_id.eq(person_id))
|
.filter(community_block::person_id.eq(person_id))
|
||||||
|
.filter(community::deleted.eq(false))
|
||||||
|
.filter(community::removed.eq(false))
|
||||||
.order_by(community_block::published)
|
.order_by(community_block::published)
|
||||||
.load::<CommunityBlockViewTuple>(conn)?;
|
.load::<CommunityBlockViewTuple>(conn)?;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ impl CommunityFollowerView {
|
||||||
Person::safe_columns_tuple(),
|
Person::safe_columns_tuple(),
|
||||||
))
|
))
|
||||||
.filter(community_follower::person_id.eq(person_id))
|
.filter(community_follower::person_id.eq(person_id))
|
||||||
|
.filter(community::deleted.eq(false))
|
||||||
|
.filter(community::removed.eq(false))
|
||||||
.order_by(community::title)
|
.order_by(community::title)
|
||||||
.load::<CommunityFollowerViewTuple>(conn)?;
|
.load::<CommunityFollowerViewTuple>(conn)?;
|
||||||
|
|
||||||
|
|
|
@ -40,6 +40,8 @@ impl CommunityModeratorView {
|
||||||
Person::safe_columns_tuple(),
|
Person::safe_columns_tuple(),
|
||||||
))
|
))
|
||||||
.filter(community_moderator::person_id.eq(person_id))
|
.filter(community_moderator::person_id.eq(person_id))
|
||||||
|
.filter(community::deleted.eq(false))
|
||||||
|
.filter(community::removed.eq(false))
|
||||||
.order_by(community_moderator::published)
|
.order_by(community_moderator::published)
|
||||||
.load::<CommunityModeratorViewTuple>(conn)?;
|
.load::<CommunityModeratorViewTuple>(conn)?;
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,7 @@ impl PersonBlockView {
|
||||||
person_alias_1.fields(Person::safe_columns_tuple()),
|
person_alias_1.fields(Person::safe_columns_tuple()),
|
||||||
))
|
))
|
||||||
.filter(person_block::person_id.eq(person_id))
|
.filter(person_block::person_id.eq(person_id))
|
||||||
|
.filter(person_alias_1.field(person::deleted).eq(false))
|
||||||
.order_by(person_block::published)
|
.order_by(person_block::published)
|
||||||
.load::<PersonBlockViewTuple>(conn)?;
|
.load::<PersonBlockViewTuple>(conn)?;
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,7 @@ impl PersonViewSafe {
|
||||||
.inner_join(person_aggregates::table)
|
.inner_join(person_aggregates::table)
|
||||||
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
|
.select((Person::safe_columns_tuple(), person_aggregates::all_columns))
|
||||||
.filter(person::admin.eq(true))
|
.filter(person::admin.eq(true))
|
||||||
|
.filter(person::deleted.eq(false))
|
||||||
.order_by(person::published)
|
.order_by(person::published)
|
||||||
.load::<PersonViewSafeTuple>(conn)?;
|
.load::<PersonViewSafeTuple>(conn)?;
|
||||||
|
|
||||||
|
@ -45,6 +46,7 @@ impl PersonViewSafe {
|
||||||
.or(person::ban_expires.gt(now)),
|
.or(person::ban_expires.gt(now)),
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
|
.filter(person::deleted.eq(false))
|
||||||
.load::<PersonViewSafeTuple>(conn)?;
|
.load::<PersonViewSafeTuple>(conn)?;
|
||||||
|
|
||||||
Ok(Self::from_tuple_to_vec(banned))
|
Ok(Self::from_tuple_to_vec(banned))
|
||||||
|
|
Loading…
Reference in New Issue