Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show posts/comments from followed communities despite instance block #5437

Merged
merged 2 commits into from
Feb 20, 2025

Conversation

Nutomic
Copy link
Member

@Nutomic Nutomic commented Feb 17, 2025

With this change you can block an instance like lemmy.world to prevent it from flooding the All feed, while still being able to see posts from subscribed communities on that instance.

Another option would be to ignore instance blocks in case listing_type == Subscribed, but that would be more complicated and have basically the same end result.

Comment on lines 652 to 661
/// Hide all content from blocked communities and persons. Content from blocked instances is also
/// hidden, unless the user followed the community explicitly.
#[diesel::dsl::auto_type]
pub(crate) fn filter_blocked() -> _ {
instance_actions::blocked
.is_null()
.or(community_actions::followed.is_not_null())
.and(community_actions::blocked.is_null())
.and(person_actions::blocked.is_null())
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd considered doing this previously, but we need a common place to put a lot of these filters that use multiple tables (or for the actions tables where there's no crates/db_schema/src/impls/... ).

It'd be better to move this to either crates/db_schema/src/utils.rs, lib.rs , or a new common_filters module or something in db_schema.

Copy link
Member Author

@Nutomic Nutomic Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added crates/db_views/src/utils.rs as its only used in this one crate. Were there any other methods you want to move?

Copy link
Member

@dessalines dessalines Feb 20, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not that I can think of at the moment. But also, I'd rather these live in db_schema, not db_views, because they're filters on schema objects / DB tables, never the full views.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Putting it in db_schema means making the method public, so its accessible from everywhere in the Lemmy codebase. That doesnt make sense considering that its only used in db_views.

@dessalines
Copy link
Member

After that's addressed feel free to merge.

@dessalines dessalines merged commit 493734d into main Feb 20, 2025
2 checks passed
@SleeplessOne1917 SleeplessOne1917 deleted the instance-community-block branch February 21, 2025 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants