From: Felix Ableitner Date: Tue, 17 Nov 2020 17:05:25 +0000 (+0100) Subject: For community_name API parameters, only search locally (fixes #1271) X-Git-Url: http://these/git/%7B%60%24%7BwebArchiveUrl%7D/%22%7B%7D/readmes/%7B%7D/%22%7Burl%7D/%7Bthis.imageSrc%7D?a=commitdiff_plain;h=250dcc26bea77748ebf36000feab41deeb8be334;p=lemmy.git For community_name API parameters, only search locally (fixes #1271) --- diff --git a/docs/src/contributing_websocket_http_api.md b/docs/src/contributing_websocket_http_api.md index a3b678eb..bb9b063a 100644 --- a/docs/src/contributing_websocket_http_api.md +++ b/docs/src/contributing_websocket_http_api.md @@ -492,6 +492,9 @@ These expire after 10 minutes. `GET /user/get_captcha` #### Get User Details + +`username` can only be used for local users. To get details for a federated user, pass `user_id` instead. + ##### Request ```rust { @@ -1602,6 +1605,8 @@ The main / frontpage community is `community_id: 0`. Post listing types are `All, Subscribed, Community` +`community_name` can only be used for local communities. To get posts for a federated community, pass `community_id` instead. + ##### Request ```rust { @@ -2049,6 +2054,8 @@ Only a mod or admin can remove the comment. Comment listing types are `All, Subscribed, Community` +`community_name` can only be used for local communities. To get posts for a federated community, pass `community_id` instead. + ##### Request ```rust { diff --git a/lemmy_db/src/comment_view.rs b/lemmy_db/src/comment_view.rs index e1299cb1..4b6dc192 100644 --- a/lemmy_db/src/comment_view.rs +++ b/lemmy_db/src/comment_view.rs @@ -239,7 +239,9 @@ impl<'a> CommentQueryBuilder<'a> { } if let Some(for_community_name) = self.for_community_name { - query = query.filter(community_name.eq(for_community_name)); + query = query + .filter(community_name.eq(for_community_name)) + .filter(local.eq(true)); } if let Some(for_post_id) = self.for_post_id { diff --git a/lemmy_db/src/post_view.rs b/lemmy_db/src/post_view.rs index 38d9a021..0ec4a979 100644 --- a/lemmy_db/src/post_view.rs +++ b/lemmy_db/src/post_view.rs @@ -280,6 +280,7 @@ impl<'a> PostQueryBuilder<'a> { if let Some(for_community_name) = self.for_community_name { query = query .filter(community_name.eq(for_community_name)) + .filter(local.eq(true)) .then_order_by(stickied.desc()); }