mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Slight code reduction for #419
This commit is contained in:
parent
7450afeecf
commit
386fd936b4
5 changed files with 26 additions and 27 deletions
|
|
@ -29,6 +29,8 @@ import { FileInfo } from 'Common/File';
|
||||||
import { FolderPopupView } from 'View/Popup/Folder';
|
import { FolderPopupView } from 'View/Popup/Folder';
|
||||||
import { showScreenPopup } from 'Knoin/Knoin';
|
import { showScreenPopup } from 'Knoin/Knoin';
|
||||||
|
|
||||||
|
import { isAllowedKeyword } from 'Stores/User/Folder';
|
||||||
|
|
||||||
const
|
const
|
||||||
// isPosNumeric = value => null != value && /^[0-9]*$/.test(value.toString()),
|
// isPosNumeric = value => null != value && /^[0-9]*$/.test(value.toString()),
|
||||||
|
|
||||||
|
|
@ -411,6 +413,8 @@ export class FolderModel extends AbstractModel {
|
||||||
canBeSubscribed: () => this.selectable()
|
canBeSubscribed: () => this.selectable()
|
||||||
&& !(this.isSystemFolder() | !SettingsUserStore.hideUnsubscribed()),
|
&& !(this.isSystemFolder() | !SettingsUserStore.hideUnsubscribed()),
|
||||||
|
|
||||||
|
optionalTags: () => this.permanentFlags.filter(isAllowedKeyword),
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Folder is visible when:
|
* Folder is visible when:
|
||||||
* - hasVisibleSubfolders()
|
* - hasVisibleSubfolders()
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ import { forEachObjectEntry, b64EncodeJSONSafe } from 'Common/Utils';
|
||||||
import { serverRequestRaw, proxy } from 'Common/Links';
|
import { serverRequestRaw, proxy } from 'Common/Links';
|
||||||
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
import { addObservablesTo, addComputablesTo } from 'External/ko';
|
||||||
|
|
||||||
import { FolderUserStore, isAllowedKeyword } from 'Stores/User/Folder';
|
import { FolderUserStore } from 'Stores/User/Folder';
|
||||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||||
|
|
||||||
import { FileInfo, RFC822 } from 'Common/File';
|
import { FileInfo, RFC822 } from 'Common/File';
|
||||||
|
|
@ -157,8 +157,7 @@ export class MessageModel extends AbstractModel {
|
||||||
|
|
||||||
tagOptions: () => {
|
tagOptions: () => {
|
||||||
const tagOptions = [];
|
const tagOptions = [];
|
||||||
FolderUserStore.currentFolder().permanentFlags.forEach(value => {
|
FolderUserStore.currentFolder().optionalTags().forEach(value => {
|
||||||
if (isAllowedKeyword(value)) {
|
|
||||||
let lower = value.toLowerCase();
|
let lower = value.toLowerCase();
|
||||||
tagOptions.push({
|
tagOptions.push({
|
||||||
css: 'msgflag-' + lower,
|
css: 'msgflag-' + lower,
|
||||||
|
|
@ -167,7 +166,6 @@ export class MessageModel extends AbstractModel {
|
||||||
label: i18n('MESSAGE_TAGS/'+lower, 0, value),
|
label: i18n('MESSAGE_TAGS/'+lower, 0, value),
|
||||||
toggle: (/*obj*/) => toggleTag(this, value)
|
toggle: (/*obj*/) => toggleTag(this, value)
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return tagOptions
|
return tagOptions
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -32,6 +32,8 @@ import { SettingsGet } from 'Common/Globals';
|
||||||
import { SUB_QUERY_PREFIX } from 'Common/Links';
|
import { SUB_QUERY_PREFIX } from 'Common/Links';
|
||||||
import { AppUserStore } from 'Stores/User/App';
|
import { AppUserStore } from 'Stores/User/App';
|
||||||
|
|
||||||
|
import { baseCollator } from 'Common/Translator';
|
||||||
|
|
||||||
const
|
const
|
||||||
isChecked = item => item.checked(),
|
isChecked = item => item.checked(),
|
||||||
replaceHash = hash => {
|
replaceHash = hash => {
|
||||||
|
|
@ -254,17 +256,14 @@ MessagelistUserStore.reload = (bDropPagePosition = false, bDropCurrentFolderCach
|
||||||
|
|
||||||
let flags = folderInfo.permanentFlags || [];
|
let flags = folderInfo.permanentFlags || [];
|
||||||
if (flags.includes('\\*')) {
|
if (flags.includes('\\*')) {
|
||||||
|
/** Add Thunderbird labels */
|
||||||
let i = 6;
|
let i = 6;
|
||||||
while (--i) {
|
while (--i) {
|
||||||
flags.includes('$label'+i) || flags.push('$label'+i);
|
flags.includes('$label'+i) || flags.push('$label'+i);
|
||||||
}
|
}
|
||||||
|
/** TODO: add others by default? */
|
||||||
}
|
}
|
||||||
flags.sort((a, b) => {
|
folder.permanentFlags(flags.sort(baseCollator().compare));
|
||||||
a = a.toUpperCase();
|
|
||||||
b = b.toUpperCase();
|
|
||||||
return (a < b) ? -1 : ((a > b) ? 1 : 0);
|
|
||||||
});
|
|
||||||
folder.permanentFlags(flags);
|
|
||||||
|
|
||||||
MessagelistUserStore.notifyNewMessages(folder.fullName, collection.newMessages);
|
MessagelistUserStore.notifyNewMessages(folder.fullName, collection.newMessages);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,14 +32,12 @@ export class AdvancedSearchPopupView extends AbstractViewPopup {
|
||||||
// Almost the same as MessageModel.tagOptions
|
// Almost the same as MessageModel.tagOptions
|
||||||
keywords: () => {
|
keywords: () => {
|
||||||
const keywords = [{value:'',label:''}];
|
const keywords = [{value:'',label:''}];
|
||||||
FolderUserStore.currentFolder().permanentFlags.forEach(value => {
|
FolderUserStore.currentFolder().optionalTags().forEach(value => {
|
||||||
if (isAllowedKeyword(value)) {
|
|
||||||
let lower = value.toLowerCase();
|
let lower = value.toLowerCase();
|
||||||
keywords.push({
|
keywords.push({
|
||||||
value: value,
|
value: value,
|
||||||
label: i18n('MESSAGE_TAGS/'+lower, 0, lower)
|
label: i18n('MESSAGE_TAGS/'+lower, 0, lower)
|
||||||
});
|
});
|
||||||
}
|
|
||||||
});
|
});
|
||||||
return keywords
|
return keywords
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -154,7 +154,7 @@
|
||||||
"SPAM_SCORE": "Spamscore",
|
"SPAM_SCORE": "Spamscore",
|
||||||
"HAS_VIRUS_WARNING": "WAARSCHUWING: virus gedetecteerd",
|
"HAS_VIRUS_WARNING": "WAARSCHUWING: virus gedetecteerd",
|
||||||
"TAGS": "Labels",
|
"TAGS": "Labels",
|
||||||
"NEW_TAG": "Nieuwe label",
|
"NEW_TAG": "Nieuw label",
|
||||||
"ENABLE_TRACKING_LINKS": "Schakel trackinglinks in",
|
"ENABLE_TRACKING_LINKS": "Schakel trackinglinks in",
|
||||||
"TRACKING_ENABLED": "Links worden nu bijgehouden wanneer erop wordt geklikt!"
|
"TRACKING_ENABLED": "Links worden nu bijgehouden wanneer erop wordt geklikt!"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue