diff --git a/crates/core/src/message/search.rs b/crates/core/src/message/search.rs index 910fc15..f7cdbcd 100644 --- a/crates/core/src/message/search.rs +++ b/crates/core/src/message/search.rs @@ -43,6 +43,10 @@ pub struct EmailSearchFilter { pub to: Option, pub cc: Option, pub bcc: Option, + /// Matches if the address appears in `to`, `cc`, or `bcc` (OR semantics). + pub any_recipient: Option, + /// Matches if the address appears in `from`, `to`, `cc`, or `bcc` (OR semantics). + pub any_participant: Option, pub since: Option, pub before: Option, /// Lower bound (inclusive) on the IMAP server INTERNALDATE timestamp. diff --git a/crates/core/src/store/tantivy/envelope.rs b/crates/core/src/store/tantivy/envelope.rs index a7ccac7..b47d8f6 100644 --- a/crates/core/src/store/tantivy/envelope.rs +++ b/crates/core/src/store/tantivy/envelope.rs @@ -461,6 +461,34 @@ impl IndexManager { } } + // any_recipient: OR across to, cc, bcc + if let Some(ref v) = filter.any_recipient { + let mut recipient_queries: Vec<(Occur, Box)> = Vec::new(); + for field in [f.f_to_text, f.f_cc_text, f.f_bcc_text] { + let query_parser = QueryParser::for_index(&self.index, vec![field]); + if let Ok(q) = query_parser.parse_query(v) { + recipient_queries.push((Occur::Should, q)); + } + } + if !recipient_queries.is_empty() { + subqueries.push((Occur::Must, Box::new(BooleanQuery::new(recipient_queries)))); + } + } + + // any_participant: OR across from, to, cc, bcc + if let Some(ref v) = filter.any_participant { + let mut participant_queries: Vec<(Occur, Box)> = Vec::new(); + for field in [f.f_from_text, f.f_to_text, f.f_cc_text, f.f_bcc_text] { + let query_parser = QueryParser::for_index(&self.index, vec![field]); + if let Ok(q) = query_parser.parse_query(v) { + participant_queries.push((Occur::Should, q)); + } + } + if !participant_queries.is_empty() { + subqueries.push((Occur::Must, Box::new(BooleanQuery::new(participant_queries)))); + } + } + if let Some(has) = filter.has_attachment { let lower: Bound; let upper: Bound; diff --git a/web/src/features/search/contact-popover.tsx b/web/src/features/search/contact-popover.tsx index 2a9fe21..68b0d40 100644 --- a/web/src/features/search/contact-popover.tsx +++ b/web/src/features/search/contact-popover.tsx @@ -30,13 +30,13 @@ import { CommandGroup, CommandInput, CommandItem, - CommandList, } from "@/components/ui/command" +import { ScrollArea } from "@/components/ui/scroll-area" export function MailFilterPopover() { const { t } = useTranslation() const { filter, setFilter } = useSearchContext() - const fields = ['from', 'to', 'cc', 'bcc'] as const + const fields = ['from', 'to', 'cc', 'bcc', 'any_recipient', 'any_participant'] as const const activeCount = fields.filter(k => !!filter[k]).length @@ -196,7 +196,7 @@ function ContactSelectorField({ value={searchTerm} onValueChange={setSearchTerm} /> - + {isLoading && (
{t('search_contacts.loading')}
)} @@ -227,7 +227,7 @@ function ContactSelectorField({ )} -
+ diff --git a/web/src/locales/ar.json b/web/src/locales/ar.json index 4fb65b7..b16637f 100644 --- a/web/src/locales/ar.json +++ b/web/src/locales/ar.json @@ -1001,6 +1001,8 @@ "advanced": "متقدم", "advancedFilters": "فلاتر متقدمة", "any": "الكل", + "any_participant": "أي طرف في المراسلة", + "any_recipient": "أي مستلم", "attachmentName": "اسم المرفق", "attachmentsSize": "المرفقات والحجم", "bcc": "نسخة مخفية", diff --git a/web/src/locales/da.json b/web/src/locales/da.json index df99490..baaaf3d 100644 --- a/web/src/locales/da.json +++ b/web/src/locales/da.json @@ -1001,6 +1001,8 @@ "advanced": "Avanceret", "advancedFilters": "Avancerede filtre", "any": "Alle", + "any_participant": "Enhver korrespondent", + "any_recipient": "Enhver modtager", "attachmentName": "Vedhæftningsfilnavn", "attachmentsSize": "Vedhæftninger & Størrelse", "bcc": "Blindkopi (BCC)", diff --git a/web/src/locales/de.json b/web/src/locales/de.json index 179558c..65faf23 100644 --- a/web/src/locales/de.json +++ b/web/src/locales/de.json @@ -1001,6 +1001,8 @@ "advanced": "Erweitert", "advancedFilters": "Erweiterte Filter", "any": "Beliebig", + "any_participant": "Beliebiger Beteiligter", + "any_recipient": "Beliebiger Empfänger", "attachmentName": "Anhangsname", "attachmentsSize": "Anhänge & Größe", "bcc": "BCC", diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 35eadb6..ee5b506 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -1002,6 +1002,8 @@ "advanced": "Advanced", "advancedFilters": "Advanced Filters", "any": "Any", + "any_participant": "Any correspondent", + "any_recipient": "Any recipient", "attachmentName": "Attachment Name", "attachmentsSize": "Attachments & Size", "bcc": "BCC", diff --git a/web/src/locales/es.json b/web/src/locales/es.json index 0c4c3e9..cf8a5eb 100644 --- a/web/src/locales/es.json +++ b/web/src/locales/es.json @@ -1001,6 +1001,8 @@ "advanced": "Avanzado", "advancedFilters": "Filtros avanzados", "any": "Cualquiera", + "any_participant": "Cualquier participante", + "any_recipient": "Cualquier destinatario", "attachmentName": "Nombre del adjunto", "attachmentsSize": "Adjuntos y tamaño", "bcc": "CCO", diff --git a/web/src/locales/fi.json b/web/src/locales/fi.json index 9c78869..4bc1c2d 100644 --- a/web/src/locales/fi.json +++ b/web/src/locales/fi.json @@ -1001,6 +1001,8 @@ "advanced": "Tarkennettu", "advancedFilters": "Tarkennetut suodattimet", "any": "Kaikki", + "any_participant": "Kuka tahansa osallistuja", + "any_recipient": "Kuka tahansa vastaanottaja", "attachmentName": "Liitteen nimi", "attachmentsSize": "Liitteet ja koko", "bcc": "Piilokopio", diff --git a/web/src/locales/fr.json b/web/src/locales/fr.json index 71f8e4d..2f72a60 100644 --- a/web/src/locales/fr.json +++ b/web/src/locales/fr.json @@ -1001,6 +1001,8 @@ "advanced": "Avancé", "advancedFilters": "Filtres Avancés", "any": "Toutes", + "any_participant": "N'importe quel correspondant", + "any_recipient": "N'importe quel destinataire", "attachmentName": "Nom de la Pièce Jointe", "attachmentsSize": "Pièces Jointes et Taille", "bcc": "Cci", diff --git a/web/src/locales/it.json b/web/src/locales/it.json index 60496a9..b50737a 100644 --- a/web/src/locales/it.json +++ b/web/src/locales/it.json @@ -1001,6 +1001,8 @@ "advanced": "Avanzato", "advancedFilters": "Filtri Avanzati", "any": "Qualsiasi", + "any_participant": "Qualsiasi partecipante", + "any_recipient": "Qualsiasi destinatario", "attachmentName": "Nome Allegato", "attachmentsSize": "Allegati e Dimensione", "bcc": "BCC", diff --git a/web/src/locales/jp.json b/web/src/locales/jp.json index 59fe40b..d566370 100644 --- a/web/src/locales/jp.json +++ b/web/src/locales/jp.json @@ -1001,6 +1001,8 @@ "advanced": "高度な設定", "advancedFilters": "高度なフィルター", "any": "指定なし", + "any_participant": "すべての関係者", + "any_recipient": "すべての受信者", "attachmentName": "添付ファイル名", "attachmentsSize": "添付ファイルとサイズ", "bcc": "BCC(ブラインド写し)", diff --git a/web/src/locales/ko.json b/web/src/locales/ko.json index 6da8d17..53fa66a 100644 --- a/web/src/locales/ko.json +++ b/web/src/locales/ko.json @@ -1001,6 +1001,8 @@ "advanced": "고급", "advancedFilters": "고급 필터", "any": "전체", + "any_participant": "모든 관련자", + "any_recipient": "모든 수신자", "attachmentName": "첨부 파일 이름", "attachmentsSize": "첨부 파일 및 크기", "bcc": "숨은 참조", diff --git a/web/src/locales/nl.json b/web/src/locales/nl.json index 85d4066..db2d8b8 100644 --- a/web/src/locales/nl.json +++ b/web/src/locales/nl.json @@ -1001,6 +1001,8 @@ "advanced": "Geavanceerd", "advancedFilters": "Geavanceerde Filters", "any": "Alle", + "any_participant": "Elke correspondent", + "any_recipient": "Elke ontvanger", "attachmentName": "Naam Bijlage", "attachmentsSize": "Bijlagen & Grootte", "bcc": "BCC", diff --git a/web/src/locales/no.json b/web/src/locales/no.json index 0c21ca2..99de43d 100644 --- a/web/src/locales/no.json +++ b/web/src/locales/no.json @@ -1001,6 +1001,8 @@ "advanced": "Avansert", "advancedFilters": "Avanserte filtre", "any": "Alle", + "any_participant": "Enhver korrespondent", + "any_recipient": "Enhver mottaker", "attachmentName": "Vedleggsnavn", "attachmentsSize": "Vedlegg og størrelse", "bcc": "Blindkopi (BCC)", diff --git a/web/src/locales/pl.json b/web/src/locales/pl.json index 4445656..6fb5420 100644 --- a/web/src/locales/pl.json +++ b/web/src/locales/pl.json @@ -1001,6 +1001,8 @@ "advanced": "Zaawansowane", "advancedFilters": "Zaawansowane filtry", "any": "Dowolny", + "any_participant": "Dowolny uczestnik", + "any_recipient": "Dowolny odbiorca", "attachmentName": "Nazwa załącznika", "attachmentsSize": "Załączniki & Rozmiar", "bcc": "UDW", diff --git a/web/src/locales/pt.json b/web/src/locales/pt.json index 51ce366..3744593 100644 --- a/web/src/locales/pt.json +++ b/web/src/locales/pt.json @@ -1001,6 +1001,8 @@ "advanced": "Avançado", "advancedFilters": "Filtros Avançados", "any": "Qualquer", + "any_participant": "Qualquer correspondente", + "any_recipient": "Qualquer destinatario", "attachmentName": "Nome do Anexo", "attachmentsSize": "Anexos e Tamanho", "bcc": "BCC", diff --git a/web/src/locales/ru.json b/web/src/locales/ru.json index f18284a..8715209 100644 --- a/web/src/locales/ru.json +++ b/web/src/locales/ru.json @@ -1001,6 +1001,8 @@ "advanced": "Дополнительно", "advancedFilters": "Расширенные фильтры", "any": "Любой", + "any_participant": "Любой участник переписки", + "any_recipient": "Любой получатель", "attachmentName": "Имя вложения", "attachmentsSize": "Вложения и Размер", "bcc": "Скрытая копия", diff --git a/web/src/locales/sv.json b/web/src/locales/sv.json index a021acf..3ffb856 100644 --- a/web/src/locales/sv.json +++ b/web/src/locales/sv.json @@ -1001,6 +1001,8 @@ "advanced": "Avancerat", "advancedFilters": "Avancerade filter", "any": "Alla", + "any_participant": "Valfri korrespondent", + "any_recipient": "Valfri mottagare", "attachmentName": "Filnamn på bilaga", "attachmentsSize": "Bilagor & storlek", "bcc": "Hemlig kopia (BCC)", diff --git a/web/src/locales/zh-tw.json b/web/src/locales/zh-tw.json index a348b89..0e672db 100644 --- a/web/src/locales/zh-tw.json +++ b/web/src/locales/zh-tw.json @@ -1001,6 +1001,8 @@ "advanced": "進階", "advancedFilters": "進階篩選", "any": "不限", + "any_participant": "任意關聯人", + "any_recipient": "任意收件人", "attachmentName": "附件名稱", "attachmentsSize": "附件與大小", "bcc": "密件副本 (BCC)", diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index 4d23a90..784db20 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -1001,6 +1001,8 @@ "advanced": "高级", "advancedFilters": "高级筛选", "any": "不限", + "any_participant": "任意关联人", + "any_recipient": "任意收件人", "attachmentName": "附件名称", "attachmentsSize": "附件和大小", "bcc": "密送",