mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-01 04:22:15 +08:00
Better keyword/tags/labels handling for #419
This commit is contained in:
parent
df2de7ad66
commit
2defb7ec35
4 changed files with 16 additions and 21 deletions
|
@ -24,23 +24,22 @@ ignoredKeywords = [
|
|||
// Mailo
|
||||
'sent',
|
||||
// KMail
|
||||
'$attachment',
|
||||
'$encrypted',
|
||||
'$error',
|
||||
'$ignored',
|
||||
'$invitation',
|
||||
'$queued',
|
||||
'$replied',
|
||||
'$sent',
|
||||
'$signed',
|
||||
'$todo',
|
||||
'$watched',
|
||||
// GMail
|
||||
'$replied',
|
||||
'$attachment',
|
||||
'$notphishing',
|
||||
'junk',
|
||||
'nonjunk',
|
||||
// KMail & GMail
|
||||
'$attachment',
|
||||
'$replied',
|
||||
// Others
|
||||
'$readreceipt'
|
||||
],
|
||||
|
|
|
@ -36,7 +36,7 @@ import { MessageFlagsCache } from 'Common/Cache';
|
|||
import { AppUserStore } from 'Stores/User/App';
|
||||
import { SettingsUserStore } from 'Stores/User/Settings';
|
||||
import { AccountUserStore } from 'Stores/User/Account';
|
||||
import { FolderUserStore } from 'Stores/User/Folder';
|
||||
import { FolderUserStore, isAllowedKeyword } from 'Stores/User/Folder';
|
||||
import { MessageUserStore } from 'Stores/User/Message';
|
||||
import { MessagelistUserStore } from 'Stores/User/Messagelist';
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
@ -529,8 +529,8 @@ export class MailMessageView extends AbstractViewRight {
|
|||
newTag() {
|
||||
let message = currentMessage();
|
||||
if (message) {
|
||||
let keyword = prompt(i18n('MESSAGE/NEW_TAG'), '')?.replace(/\s+/g, '');
|
||||
if (keyword.length) {
|
||||
let keyword = prompt(i18n('MESSAGE/NEW_TAG'), '')?.replace(/[\s\\]+/g, '');
|
||||
if (keyword.length && isAllowedKeyword(keyword)) {
|
||||
message.toggleTag(keyword);
|
||||
FolderUserStore.currentFolder().permanentFlags.push(keyword);
|
||||
}
|
||||
|
|
|
@ -647,6 +647,15 @@ class Message implements \JsonSerializable
|
|||
$this->aFlagsLowerCase
|
||||
), true);
|
||||
*/
|
||||
// https://datatracker.ietf.org/doc/html/rfc5788#section-3.4.1
|
||||
// Thunderbird $label1 is same as $Important?
|
||||
// Thunderbird $label4 is same as $todo?
|
||||
$aFlags = \array_unique(\str_replace(
|
||||
['$readreceipt', '$replied', /* 'junk', 'nonjunk', '$queued', '$sent', 'sent'*/],
|
||||
['$mdnsent', '\\answered',/* '$junk', '$notjunk', '$submitpending', '$submitted', '$submitted'*/],
|
||||
$this->aFlagsLowerCase
|
||||
));
|
||||
|
||||
return array(
|
||||
'@Object' => 'Object/Message',
|
||||
'Folder' => $this->sFolder,
|
||||
|
@ -676,7 +685,7 @@ class Message implements \JsonSerializable
|
|||
|
||||
'Attachments' => $this->oAttachments ? $this->oAttachments->SpecData() : null,
|
||||
|
||||
'Flags' => $this->aFlagsLowerCase,
|
||||
'Flags' => $aFlags,
|
||||
|
||||
// https://datatracker.ietf.org/doc/html/rfc8621#section-4.1.1
|
||||
'id' => $this->sEmailId,
|
||||
|
|
|
@ -194,19 +194,6 @@ trait Response
|
|||
'FileName' => (\strlen($sSubject) ? \MailSo\Base\Utils::ClearXss($sSubject) : 'message-'.$mResult['Uid']) . '.eml'
|
||||
));
|
||||
|
||||
// https://datatracker.ietf.org/doc/html/rfc5788#section-3.4.1
|
||||
$key = \array_search('$readreceipt', $mResult['Flags']);
|
||||
if (false !== $key) {
|
||||
$mResult['Flags'][$key] = '$mdnsent';
|
||||
}
|
||||
// KMail
|
||||
$key = \array_search('$replied', $mResult['Flags']);
|
||||
if (false !== $key) {
|
||||
$mResult['Flags'][$key] = '\\answered';
|
||||
}
|
||||
|
||||
$mResult['Flags'] = \array_unique($mResult['Flags']);
|
||||
|
||||
if ('Message' === $sParent)
|
||||
{
|
||||
$mResult['DraftInfo'] = $mResponse->DraftInfo();
|
||||
|
|
Loading…
Reference in a new issue