mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-09-02 22:17:03 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {trim} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
import {searchSubtractFormatDateHelper} from 'Common/Momentor';
|
||||
import { trim } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
import { searchSubtractFormatDateHelper } from 'Common/Momentor';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import {popup, command} from 'Knoin/Knoin';
|
||||
import {AbstractViewNext} from 'Knoin/AbstractViewNext';
|
||||
import { popup, command } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/AdvancedSearch',
|
||||
templateID: 'PopupsAdvancedSearch'
|
||||
})
|
||||
class AdvancedSearchPopupView extends AbstractViewNext
|
||||
{
|
||||
class AdvancedSearchPopupView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
|
|
@ -35,13 +33,13 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
this.selectedDates = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL')},
|
||||
{id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS')},
|
||||
{id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS')},
|
||||
{id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH')},
|
||||
{id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS')},
|
||||
{id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS')},
|
||||
{id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR')}
|
||||
{ id: -1, name: i18n('SEARCH/LABEL_ADV_DATE_ALL') },
|
||||
{ id: 3, name: i18n('SEARCH/LABEL_ADV_DATE_3_DAYS') },
|
||||
{ id: 7, name: i18n('SEARCH/LABEL_ADV_DATE_7_DAYS') },
|
||||
{ id: 30, name: i18n('SEARCH/LABEL_ADV_DATE_MONTH') },
|
||||
{ id: 90, name: i18n('SEARCH/LABEL_ADV_DATE_3_MONTHS') },
|
||||
{ id: 180, name: i18n('SEARCH/LABEL_ADV_DATE_6_MONTHS') },
|
||||
{ id: 365, name: i18n('SEARCH/LABEL_ADV_DATE_YEAR') }
|
||||
];
|
||||
});
|
||||
}
|
||||
|
|
@ -49,8 +47,7 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
@command()
|
||||
searchCommand() {
|
||||
const search = this.buildSearchString();
|
||||
if ('' !== search)
|
||||
{
|
||||
if ('' !== search) {
|
||||
MessageStore.mainMessageListSearch(search);
|
||||
}
|
||||
|
||||
|
|
@ -60,14 +57,13 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
parseSearchStringValue(search) {
|
||||
const parts = (search || '').split(/[\s]+/g);
|
||||
_.each(parts, (part) => {
|
||||
switch (part)
|
||||
{
|
||||
switch (part) {
|
||||
case 'has:attachment':
|
||||
this.hasAttachment(true);
|
||||
break;
|
||||
case 'is:unseen,flagged':
|
||||
this.starred(true);
|
||||
/* falls through */
|
||||
/* falls through */
|
||||
case 'is:unseen':
|
||||
this.unseen(true);
|
||||
break;
|
||||
|
|
@ -77,16 +73,14 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
}
|
||||
|
||||
buildSearchStringValue(value) {
|
||||
if (-1 < value.indexOf(' '))
|
||||
{
|
||||
if (-1 < value.indexOf(' ')) {
|
||||
value = '"' + value + '"';
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
buildSearchString() {
|
||||
const
|
||||
result = [],
|
||||
const result = [],
|
||||
from_ = trim(this.from()),
|
||||
to = trim(this.to()),
|
||||
subject = trim(this.subject()),
|
||||
|
|
@ -94,53 +88,43 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
isPart = [],
|
||||
hasPart = [];
|
||||
|
||||
if (from_ && '' !== from_)
|
||||
{
|
||||
if (from_ && '' !== from_) {
|
||||
result.push('from:' + this.buildSearchStringValue(from_));
|
||||
}
|
||||
|
||||
if (to && '' !== to)
|
||||
{
|
||||
if (to && '' !== to) {
|
||||
result.push('to:' + this.buildSearchStringValue(to));
|
||||
}
|
||||
|
||||
if (subject && '' !== subject)
|
||||
{
|
||||
if (subject && '' !== subject) {
|
||||
result.push('subject:' + this.buildSearchStringValue(subject));
|
||||
}
|
||||
|
||||
if (this.hasAttachment())
|
||||
{
|
||||
if (this.hasAttachment()) {
|
||||
hasPart.push('attachment');
|
||||
}
|
||||
|
||||
if (this.unseen())
|
||||
{
|
||||
if (this.unseen()) {
|
||||
isPart.push('unseen');
|
||||
}
|
||||
|
||||
if (this.starred())
|
||||
{
|
||||
if (this.starred()) {
|
||||
isPart.push('flagged');
|
||||
}
|
||||
|
||||
if (0 < hasPart.length)
|
||||
{
|
||||
if (0 < hasPart.length) {
|
||||
result.push('has:' + hasPart.join(','));
|
||||
}
|
||||
|
||||
if (0 < isPart.length)
|
||||
{
|
||||
if (0 < isPart.length) {
|
||||
result.push('is:' + isPart.join(','));
|
||||
}
|
||||
|
||||
if (-1 < this.selectedDateValue())
|
||||
{
|
||||
if (-1 < this.selectedDateValue()) {
|
||||
result.push('date:' + searchSubtractFormatDateHelper(this.selectedDateValue()) + '/');
|
||||
}
|
||||
|
||||
if (text && '' !== text)
|
||||
{
|
||||
if (text && '' !== text) {
|
||||
result.push('text:' + this.buildSearchStringValue(text));
|
||||
}
|
||||
|
||||
|
|
@ -171,4 +155,4 @@ class AdvancedSearchPopupView extends AbstractViewNext
|
|||
}
|
||||
}
|
||||
|
||||
export {AdvancedSearchPopupView, AdvancedSearchPopupView as default};
|
||||
export { AdvancedSearchPopupView, AdvancedSearchPopupView as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue