Add creator id to search. Fixes #765

additional_search_filters
Dessalines 2021-04-09 16:09:58 -04:00
parent db1abff857
commit a42ac3e58a
2 changed files with 12 additions and 0 deletions

View File

@ -159,6 +159,8 @@ impl Perform for Search {
let sort = SortType::from_str(&data.sort)?; let sort = SortType::from_str(&data.sort)?;
let community_id = data.community_id; let community_id = data.community_id;
let community_name = data.community_name.to_owned(); 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_ { match type_ {
SearchType::Posts => { SearchType::Posts => {
posts = blocking(context.pool(), move |conn| { posts = blocking(context.pool(), move |conn| {
@ -168,6 +170,7 @@ impl Perform for Search {
.show_bot_accounts(show_bot_accounts) .show_bot_accounts(show_bot_accounts)
.community_id(community_id) .community_id(community_id)
.community_name(community_name) .community_name(community_name)
.creator_id(creator_id)
.my_person_id(person_id) .my_person_id(person_id)
.search_term(q) .search_term(q)
.page(page) .page(page)
@ -182,6 +185,9 @@ impl Perform for Search {
.sort(&sort) .sort(&sort)
.search_term(q) .search_term(q)
.show_bot_accounts(show_bot_accounts) .show_bot_accounts(show_bot_accounts)
.community_id(community_id)
.community_name(community_name)
.creator_id(creator_id)
.my_person_id(person_id) .my_person_id(person_id)
.page(page) .page(page)
.limit(limit) .limit(limit)
@ -220,6 +226,7 @@ impl Perform for Search {
.show_bot_accounts(show_bot_accounts) .show_bot_accounts(show_bot_accounts)
.community_id(community_id) .community_id(community_id)
.community_name(community_name) .community_name(community_name)
.creator_id(creator_id)
.my_person_id(person_id) .my_person_id(person_id)
.search_term(q) .search_term(q)
.page(page) .page(page)
@ -236,6 +243,9 @@ impl Perform for Search {
.sort(&sort) .sort(&sort)
.search_term(q) .search_term(q)
.show_bot_accounts(show_bot_accounts) .show_bot_accounts(show_bot_accounts)
.community_id(community_id)
.community_name(community_name_2)
.creator_id(creator_id)
.my_person_id(person_id) .my_person_id(person_id)
.page(page) .page(page)
.limit(limit) .limit(limit)
@ -279,6 +289,7 @@ impl Perform for Search {
.my_person_id(person_id) .my_person_id(person_id)
.community_id(community_id) .community_id(community_id)
.community_name(community_name) .community_name(community_name)
.creator_id(creator_id)
.url_search(q) .url_search(q)
.page(page) .page(page)
.limit(limit) .limit(limit)

View File

@ -25,6 +25,7 @@ pub struct Search {
pub type_: String, pub type_: String,
pub community_id: Option<CommunityId>, pub community_id: Option<CommunityId>,
pub community_name: Option<String>, pub community_name: Option<String>,
pub creator_id: Option<PersonId>,
pub sort: String, pub sort: String,
pub page: Option<i64>, pub page: Option<i64>,
pub limit: Option<i64>, pub limit: Option<i64>,