-
-
Notifications
You must be signed in to change notification settings - Fork 902
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
Conversation
/// 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()) | ||
} |
There was a problem hiding this comment.
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
.
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
After that's addressed feel free to merge. |
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.