]> Untitled Git - lemmy.git/commitdiff
For community_name API parameters, only search locally (fixes #1271)
authorFelix Ableitner <me@nutomic.com>
Tue, 17 Nov 2020 17:05:25 +0000 (18:05 +0100)
committerFelix Ableitner <me@nutomic.com>
Tue, 17 Nov 2020 17:05:25 +0000 (18:05 +0100)
docs/src/contributing_websocket_http_api.md
lemmy_db/src/comment_view.rs
lemmy_db/src/post_view.rs

index 8a6df622d3089f19f6fb7bc7f4b2237777fc2a80..73ed5c9cc665c0a09773e1c1536da97c8d45a700 100644 (file)
@@ -491,6 +491,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
 {
@@ -1549,6 +1552,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
 {
@@ -1916,6 +1921,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
 {
index e1299cb14560e301b56df9662e99945e7bbddec8..4b6dc19248f725df149af25fd7f6d4f15270c855 100644 (file)
@@ -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 {
index 38d9a0211cc3a38b799ef0d42f0a7714dbd2cad0..0ec4a97973a586fe53309557ad358f985173fa92 100644 (file)
@@ -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());
     }