mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Merge pull request #1112 from Rudloff/feature/unsubscribe
Add unsubscribe button
This commit is contained in:
commit
c148e19ea3
9 changed files with 53 additions and 1 deletions
|
|
@ -53,6 +53,7 @@ class MessageModel extends AbstractModel
|
||||||
this.bcc = [];
|
this.bcc = [];
|
||||||
this.replyTo = [];
|
this.replyTo = [];
|
||||||
this.deliveredTo = [];
|
this.deliveredTo = [];
|
||||||
|
this.unsubsribeLinks = [];
|
||||||
|
|
||||||
this.newForAnimation = ko.observable(false);
|
this.newForAnimation = ko.observable(false);
|
||||||
|
|
||||||
|
|
@ -141,6 +142,7 @@ class MessageModel extends AbstractModel
|
||||||
this.bcc = [];
|
this.bcc = [];
|
||||||
this.replyTo = [];
|
this.replyTo = [];
|
||||||
this.deliveredTo = [];
|
this.deliveredTo = [];
|
||||||
|
this.unsubsribeLinks = [];
|
||||||
|
|
||||||
this.newForAnimation(false);
|
this.newForAnimation(false);
|
||||||
|
|
||||||
|
|
@ -246,6 +248,7 @@ class MessageModel extends AbstractModel
|
||||||
this.bcc = emailArrayFromJson(json.Bcc);
|
this.bcc = emailArrayFromJson(json.Bcc);
|
||||||
this.replyTo = emailArrayFromJson(json.ReplyTo);
|
this.replyTo = emailArrayFromJson(json.ReplyTo);
|
||||||
this.deliveredTo = emailArrayFromJson(json.DeliveredTo);
|
this.deliveredTo = emailArrayFromJson(json.DeliveredTo);
|
||||||
|
this.unsubsribeLinks = json.UnsubsribeLinks;
|
||||||
|
|
||||||
this.subject(json.Subject);
|
this.subject(json.Subject);
|
||||||
if (isArray(json.SubjectParts))
|
if (isArray(json.SubjectParts))
|
||||||
|
|
@ -716,6 +719,7 @@ class MessageModel extends AbstractModel
|
||||||
this.bcc = message.bcc;
|
this.bcc = message.bcc;
|
||||||
this.replyTo = message.replyTo;
|
this.replyTo = message.replyTo;
|
||||||
this.deliveredTo = message.deliveredTo;
|
this.deliveredTo = message.deliveredTo;
|
||||||
|
this.unsubsribeLinks = message.unsubsribeLinks;
|
||||||
|
|
||||||
this.unseen(message.unseen());
|
this.unseen(message.unseen());
|
||||||
this.flagged(message.flagged());
|
this.flagged(message.flagged());
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,7 @@ function MessageViewMailBoxUserView()
|
||||||
this.viewSize = ko.observable('');
|
this.viewSize = ko.observable('');
|
||||||
this.viewLineAsCss = ko.observable('');
|
this.viewLineAsCss = ko.observable('');
|
||||||
this.viewViewLink = ko.observable('');
|
this.viewViewLink = ko.observable('');
|
||||||
|
this.viewUnsubscribeLink = ko.observable('');
|
||||||
this.viewDownloadLink = ko.observable('');
|
this.viewDownloadLink = ko.observable('');
|
||||||
this.viewUserPic = ko.observable(Consts.DATA_IMAGE_USER_DOT_PIC);
|
this.viewUserPic = ko.observable(Consts.DATA_IMAGE_USER_DOT_PIC);
|
||||||
this.viewUserPicVisible = ko.observable(false);
|
this.viewUserPicVisible = ko.observable(false);
|
||||||
|
|
@ -374,6 +375,7 @@ function MessageViewMailBoxUserView()
|
||||||
this.viewSize(oMessage.friendlySize());
|
this.viewSize(oMessage.friendlySize());
|
||||||
this.viewLineAsCss(oMessage.lineAsCss());
|
this.viewLineAsCss(oMessage.lineAsCss());
|
||||||
this.viewViewLink(oMessage.viewLink());
|
this.viewViewLink(oMessage.viewLink());
|
||||||
|
this.viewUnsubscribeLink(oMessage.unsubsribeLinks[0]);
|
||||||
this.viewDownloadLink(oMessage.downloadLink());
|
this.viewDownloadLink(oMessage.downloadLink());
|
||||||
this.viewIsImportant(oMessage.isImportant());
|
this.viewIsImportant(oMessage.isImportant());
|
||||||
this.viewIsFlagged(oMessage.flagged());
|
this.viewIsFlagged(oMessage.flagged());
|
||||||
|
|
|
||||||
|
|
@ -172,7 +172,8 @@ class MailClient
|
||||||
\MailSo\Mime\Enumerations\Header::REPLY_TO,
|
\MailSo\Mime\Enumerations\Header::REPLY_TO,
|
||||||
\MailSo\Mime\Enumerations\Header::DATE,
|
\MailSo\Mime\Enumerations\Header::DATE,
|
||||||
\MailSo\Mime\Enumerations\Header::SUBJECT,
|
\MailSo\Mime\Enumerations\Header::SUBJECT,
|
||||||
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE
|
\MailSo\Mime\Enumerations\Header::CONTENT_TYPE,
|
||||||
|
\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE,
|
||||||
), true);
|
), true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -213,6 +214,7 @@ class MailClient
|
||||||
\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO,
|
\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO,
|
||||||
\MailSo\Mime\Enumerations\Header::AUTHENTICATION_RESULTS,
|
\MailSo\Mime\Enumerations\Header::AUTHENTICATION_RESULTS,
|
||||||
\MailSo\Mime\Enumerations\Header::X_DKIM_AUTHENTICATION_RESULTS,
|
\MailSo\Mime\Enumerations\Header::X_DKIM_AUTHENTICATION_RESULTS,
|
||||||
|
\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE,
|
||||||
), true);
|
), true);
|
||||||
//
|
//
|
||||||
// return \MailSo\Imap\Enumerations\FetchType::ENVELOPE;
|
// return \MailSo\Imap\Enumerations\FetchType::ENVELOPE;
|
||||||
|
|
|
||||||
|
|
@ -157,6 +157,11 @@ class Message
|
||||||
*/
|
*/
|
||||||
private $sReadReceipt;
|
private $sReadReceipt;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
private $aUnsubsribeLinks;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
|
|
@ -223,6 +228,7 @@ class Message
|
||||||
|
|
||||||
$this->sInReplyTo = '';
|
$this->sInReplyTo = '';
|
||||||
$this->sReferences = '';
|
$this->sReferences = '';
|
||||||
|
$this->aUnsubsribeLinks = array();
|
||||||
|
|
||||||
$this->iSensitivity = \MailSo\Mime\Enumerations\Sensitivity::NOTHING;
|
$this->iSensitivity = \MailSo\Mime\Enumerations\Sensitivity::NOTHING;
|
||||||
$this->iPriority = \MailSo\Mime\Enumerations\MessagePriority::NORMAL;
|
$this->iPriority = \MailSo\Mime\Enumerations\MessagePriority::NORMAL;
|
||||||
|
|
@ -498,6 +504,14 @@ class Message
|
||||||
return $this->sReadReceipt;
|
return $this->sReadReceipt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function UnsubsribeLinks()
|
||||||
|
{
|
||||||
|
return $this->aUnsubsribeLinks;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
|
|
@ -686,6 +700,23 @@ class Message
|
||||||
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO));
|
$this->sReadReceipt = \trim($oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_CONFIRM_READING_TO));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//Unsubscribe links
|
||||||
|
$this->aUnsubsribeLinks = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::LIST_UNSUBSCRIBE);
|
||||||
|
if (empty($this->aUnsubsribeLinks))
|
||||||
|
{
|
||||||
|
$this->aUnsubsribeLinks = array();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->aUnsubsribeLinks = explode(',', $this->aUnsubsribeLinks);
|
||||||
|
$this->aUnsubsribeLinks = array_map(
|
||||||
|
function ($link) {
|
||||||
|
return trim($link, ' <>');
|
||||||
|
},
|
||||||
|
$this->aUnsubsribeLinks
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
|
$sDraftInfo = $oHeaders->ValueByName(\MailSo\Mime\Enumerations\Header::X_DRAFT_INFO);
|
||||||
if (0 < \strlen($sDraftInfo))
|
if (0 < \strlen($sDraftInfo))
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -66,4 +66,6 @@ class Header
|
||||||
const X_MSMAIL_PRIORITY = 'X-MSMail-Priority';
|
const X_MSMAIL_PRIORITY = 'X-MSMail-Priority';
|
||||||
const IMPORTANCE = 'Importance';
|
const IMPORTANCE = 'Importance';
|
||||||
const X_PRIORITY = 'X-Priority';
|
const X_PRIORITY = 'X-Priority';
|
||||||
|
|
||||||
|
const LIST_UNSUBSCRIBE = 'List-Unsubscribe';
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -9888,6 +9888,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
'Priority' => $mResponse->Priority(),
|
'Priority' => $mResponse->Priority(),
|
||||||
'Threads' => $mResponse->Threads(),
|
'Threads' => $mResponse->Threads(),
|
||||||
'Sensitivity' => $mResponse->Sensitivity(),
|
'Sensitivity' => $mResponse->Sensitivity(),
|
||||||
|
'UnsubsribeLinks' => $mResponse->UnsubsribeLinks(),
|
||||||
'ExternalProxy' => false,
|
'ExternalProxy' => false,
|
||||||
'ReadReceipt' => ''
|
'ReadReceipt' => ''
|
||||||
));
|
));
|
||||||
|
|
@ -9966,6 +9967,7 @@ NewThemeLink IncludeCss LoadingDescriptionEsc TemplatesLink LangLink IncludeBack
|
||||||
|
|
||||||
$mResult['DraftInfo'] = $mResponse->DraftInfo();
|
$mResult['DraftInfo'] = $mResponse->DraftInfo();
|
||||||
$mResult['InReplyTo'] = $mResponse->InReplyTo();
|
$mResult['InReplyTo'] = $mResponse->InReplyTo();
|
||||||
|
$mResult['UnsubsribeLinks'] = $mResponse->UnsubsribeLinks();
|
||||||
$mResult['References'] = $mResponse->References();
|
$mResult['References'] = $mResponse->References();
|
||||||
|
|
||||||
$fAdditionalExternalFilter = null;
|
$fAdditionalExternalFilter = null;
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ en:
|
||||||
BUTTON_BACK: "Back"
|
BUTTON_BACK: "Back"
|
||||||
BUTTON_CLOSE: "Close"
|
BUTTON_CLOSE: "Close"
|
||||||
BUTTON_DELETE: "Delete"
|
BUTTON_DELETE: "Delete"
|
||||||
|
BUTTON_UNSUBSCRIBE: "Unsubscribe from this list"
|
||||||
BUTTON_ARCHIVE: "Archive"
|
BUTTON_ARCHIVE: "Archive"
|
||||||
BUTTON_SPAM: "Spam"
|
BUTTON_SPAM: "Spam"
|
||||||
BUTTON_NOT_SPAM: "Not Spam"
|
BUTTON_NOT_SPAM: "Not Spam"
|
||||||
|
|
|
||||||
|
|
@ -102,6 +102,7 @@ fr_FR:
|
||||||
BUTTON_BACK: "Retour"
|
BUTTON_BACK: "Retour"
|
||||||
BUTTON_CLOSE: "Fermer"
|
BUTTON_CLOSE: "Fermer"
|
||||||
BUTTON_DELETE: "Supprimer"
|
BUTTON_DELETE: "Supprimer"
|
||||||
|
BUTTON_UNSUBSCRIBE: "Se désabonner de cette liste"
|
||||||
BUTTON_ARCHIVE: "Archive"
|
BUTTON_ARCHIVE: "Archive"
|
||||||
BUTTON_SPAM: "Indésirable"
|
BUTTON_SPAM: "Indésirable"
|
||||||
BUTTON_NOT_SPAM: "Acceptable"
|
BUTTON_NOT_SPAM: "Acceptable"
|
||||||
|
|
|
||||||
|
|
@ -147,6 +147,13 @@
|
||||||
<span class="i18n" data-i18n="MESSAGE/BUTTON_DELETE"></span>
|
<span class="i18n" data-i18n="MESSAGE/BUTTON_DELETE"></span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
<li class="e-item" role="presentation" data-bind="visible: message() && message().unsubsribeLinks[0]">
|
||||||
|
<a target="_blank" class="e-link menuitem" href="#" tabindex="-1" data-bind="link: viewUnsubscribeLink()">
|
||||||
|
<i class="icon-remove"></i>
|
||||||
|
|
||||||
|
<span class="i18n" data-i18n="MESSAGE/BUTTON_UNSUBSCRIBE"></span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
</div>
|
</div>
|
||||||
<div data-bind="visible: allowMessageActions">
|
<div data-bind="visible: allowMessageActions">
|
||||||
<li class="divider" role="presentation"
|
<li class="divider" role="presentation"
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue