]> Untitled Git - lemmy.git/commitdiff
Add creator id to search. Fixes #765
authorDessalines <tyhou13@gmx.com>
Fri, 9 Apr 2021 20:09:58 +0000 (16:09 -0400)
committerDessalines <tyhou13@gmx.com>
Fri, 23 Apr 2021 06:12:29 +0000 (02:12 -0400)
crates/api/src/site.rs
crates/api_common/src/site.rs

index aae400ca7464188a48ef8778567280ac4b5cc140..a6f09f59ba896242c87b30728c52cb02d5683cfa 100644 (file)
@@ -159,6 +159,8 @@ impl Perform for Search {
     let sort = SortType::from_str(&data.sort)?;
     let community_id = data.community_id;
     let community_name = data.community_name.to_owned();
+    let community_name_2 = data.community_name.to_owned();
+    let creator_id = data.creator_id;
     match type_ {
       SearchType::Posts => {
         posts = blocking(context.pool(), move |conn| {
@@ -168,6 +170,7 @@ impl Perform for Search {
             .show_bot_accounts(show_bot_accounts)
             .community_id(community_id)
             .community_name(community_name)
+            .creator_id(creator_id)
             .my_person_id(person_id)
             .search_term(q)
             .page(page)
@@ -182,6 +185,9 @@ impl Perform for Search {
             .sort(&sort)
             .search_term(q)
             .show_bot_accounts(show_bot_accounts)
+            .community_id(community_id)
+            .community_name(community_name)
+            .creator_id(creator_id)
             .my_person_id(person_id)
             .page(page)
             .limit(limit)
@@ -220,6 +226,7 @@ impl Perform for Search {
             .show_bot_accounts(show_bot_accounts)
             .community_id(community_id)
             .community_name(community_name)
+            .creator_id(creator_id)
             .my_person_id(person_id)
             .search_term(q)
             .page(page)
@@ -236,6 +243,9 @@ impl Perform for Search {
             .sort(&sort)
             .search_term(q)
             .show_bot_accounts(show_bot_accounts)
+            .community_id(community_id)
+            .community_name(community_name_2)
+            .creator_id(creator_id)
             .my_person_id(person_id)
             .page(page)
             .limit(limit)
@@ -279,6 +289,7 @@ impl Perform for Search {
             .my_person_id(person_id)
             .community_id(community_id)
             .community_name(community_name)
+            .creator_id(creator_id)
             .url_search(q)
             .page(page)
             .limit(limit)
index ffee7ba8685df0fc56a192313c499722ae8fab2f..6d3ebf63e9369798911f89e9655c3877143081c9 100644 (file)
@@ -25,6 +25,7 @@ pub struct Search {
   pub type_: String,
   pub community_id: Option<CommunityId>,
   pub community_name: Option<String>,
+  pub creator_id: Option<PersonId>,
   pub sort: String,
   pub page: Option<i64>,
   pub limit: Option<i64>,