A => +3 -0
@@ 0,0 1,3 @@
BEGIN;
ALTER TABLE community DROP COLUMN hide_posts_from_aggregates;
COMMIT;
A => +3 -0
@@ 0,0 1,3 @@
BEGIN;
ALTER TABLE community ADD COLUMN hide_posts_from_aggregates BOOLEAN NOT NULL DEFAULT (FALSE);
COMMIT;
M openapi/openapi.json => openapi/openapi.json +7 -0
@@ 1115,6 1115,13 @@
"required": false,
"schema": {"type": "string"},
"description": "Filter by whether the post is approved in a local community"
+ },
+ {
+ "name": "use_aggregate_filters",
+ "in": "query",
+ "required": false,
+ "schema": {"type": "string"},
+ "description": "If true, will omit posts from communities marked as hide_posts_from_aggregates"
}
],
"responses": {
M src/routes/api/posts.rs => src/routes/api/posts.rs +5 -0
@@ 134,6 134,8 @@ async fn route_unstable_posts_list(
struct PostsListQuery<'a> {
in_any_local_community: Option<bool>,
search: Option<Cow<'a, str>>,
+ #[serde(default)]
+ use_aggregate_filters: bool,
#[serde(default)]
include_your: bool,
@@ 173,6 175,9 @@ async fn route_unstable_posts_list(
);
sql.push_str( " FROM community, post LEFT OUTER JOIN person ON (person.id = post.author) WHERE post.community = community.id AND deleted=FALSE");
+ if query.use_aggregate_filters {
+ sql.push_str(" AND community.hide_posts_from_aggregates=FALSE");
+ }
if let Some(search) = &query.search {
values.push(search);
search_value_idx = Some(values.len());