filter: add repost kind to FilteredTags::into_filter
Signed-off-by: kernelkind <kernelkind@gmail.com>
This commit is contained in:
@@ -16,9 +16,9 @@ pub fn hybrid_contacts_filter(
|
|||||||
with_hashtags: bool,
|
with_hashtags: bool,
|
||||||
) -> Result<HybridFilter, Error> {
|
) -> Result<HybridFilter, Error> {
|
||||||
let local = filter::filter_from_tags(note, add_pk, with_hashtags)?
|
let local = filter::filter_from_tags(note, add_pk, with_hashtags)?
|
||||||
.into_filter([1], filter::default_limit());
|
.into_filter(vec![1], filter::default_limit());
|
||||||
let remote = filter::filter_from_tags(note, add_pk, with_hashtags)?
|
let remote = filter::filter_from_tags(note, add_pk, with_hashtags)?
|
||||||
.into_filter([1, 0], filter::default_remote_limit());
|
.into_filter(vec![1, 0], filter::default_remote_limit());
|
||||||
|
|
||||||
Ok(HybridFilter::split(local, remote))
|
Ok(HybridFilter::split(local, remote))
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -271,18 +271,18 @@ impl FilteredTags {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: make this more general
|
// TODO: make this more general
|
||||||
pub fn into_filter<I>(self, kinds: I, limit: u64) -> Vec<Filter>
|
pub fn into_filter(self, shared_kinds: Vec<u64>, limit: u64) -> Vec<Filter> {
|
||||||
where
|
|
||||||
I: IntoIterator<Item = u64> + Copy,
|
|
||||||
{
|
|
||||||
let mut filters: Vec<Filter> = Vec::with_capacity(2);
|
let mut filters: Vec<Filter> = Vec::with_capacity(2);
|
||||||
|
|
||||||
if let Some(authors) = self.authors {
|
if let Some(authors) = self.authors {
|
||||||
filters.push(authors.kinds(kinds).limit(limit).build())
|
let mut author_kinds = shared_kinds.clone();
|
||||||
|
author_kinds.insert(0, 6);
|
||||||
|
|
||||||
|
filters.push(authors.kinds(author_kinds).limit(limit).build())
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(hashtags) = self.hashtags {
|
if let Some(hashtags) = self.hashtags {
|
||||||
filters.push(hashtags.kinds(kinds).limit(limit).build())
|
filters.push(hashtags.kinds(shared_kinds).limit(limit).build())
|
||||||
}
|
}
|
||||||
|
|
||||||
filters
|
filters
|
||||||
|
|||||||
Reference in New Issue
Block a user