Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/mail.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorAnna Larch <anna@nextcloud.com>2021-06-15 17:29:25 +0300
committerGitHub <noreply@github.com>2021-06-15 17:29:25 +0300
commit9ee4231b6774d1fac8e8bc60eba1b74c82e0cd90 (patch)
treea49380a17081c85cdc9a9c8f4f610fbe8162ca0c /lib
parent896335404b1c0fc61b0f9b672a1359c12f6c9242 (diff)
parent93519a7212296975ffc322138de682b56aeda37b (diff)
Merge pull request #5184 from nextcloud/enhancement/evolution-feature-parity
Cast Evolution Labels to our implementation
Diffstat (limited to 'lib')
-rw-r--r--lib/Db/Tag.php4
-rw-r--r--lib/Model/IMAPMessage.php18
2 files changed, 19 insertions, 3 deletions
diff --git a/lib/Db/Tag.php b/lib/Db/Tag.php
index 8f254d9eb..fd32160f4 100644
--- a/lib/Db/Tag.php
+++ b/lib/Db/Tag.php
@@ -48,6 +48,10 @@ class Tag extends Entity implements JsonSerializable {
protected $isDefaultTag;
public const LABEL_IMPORTANT = '$label1';
+ public const LABEL_WORK = '$label2';
+ public const LABEL_PERSONAL = '$label3';
+ public const LABEL_TODO = '$label4';
+ public const LABEL_LATER = '$label5';
public function __construct() {
$this->addType('isDefaultTag', 'boolean');
diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php
index 23f872738..9c919e3a1 100644
--- a/lib/Model/IMAPMessage.php
+++ b/lib/Model/IMAPMessage.php
@@ -727,7 +727,7 @@ class IMAPMessage implements IMessage, JsonSerializable {
);
$msg->setFlagNotjunk(in_array(Horde_Imap_Client::FLAG_NOTJUNK, $flags, true) || in_array('nonjunk', $flags, true));// While this is not a standard IMAP Flag, Thunderbird uses it to mark "not junk"
// @todo remove this as soon as possible @link https://github.com/nextcloud/mail/issues/25
- $msg->setFlagImportant(in_array('$important', $flags, true) || in_array(Tag::LABEL_IMPORTANT, $flags, true));
+ $msg->setFlagImportant(in_array('$important', $flags, true) || in_array('$labelimportant', $flags, true) || in_array(Tag::LABEL_IMPORTANT, $flags, true));
$msg->setFlagAttachments(false);
$msg->setFlagMdnsent(in_array(Horde_Imap_Client::FLAG_MDNSENT, $flags, true));
@@ -765,6 +765,7 @@ class IMAPMessage implements IMessage, JsonSerializable {
* display_name like 'xxx'
*
* @link https://github.com/nextcloud/mail/issues/25
+ * @link https://github.com/nextcloud/mail/issues/5150
*
* @param string[] $tags
* @return Tag[]
@@ -772,10 +773,21 @@ class IMAPMessage implements IMessage, JsonSerializable {
private function generateTagEntites(array $tags, string $userId): array {
$t = [];
foreach ($tags as $keyword) {
- // Map the old $important to $label1 until we have caught them all
- if ($keyword === '$important') {
+ if ($keyword === '$important' || $keyword === '$labelimportant') {
$keyword = Tag::LABEL_IMPORTANT;
}
+ if ($keyword === '$labelwork') {
+ $keyword = Tag::LABEL_WORK;
+ }
+ if ($keyword === '$labelpersonal') {
+ $keyword = Tag::LABEL_PERSONAL;
+ }
+ if ($keyword === '$labeltodo') {
+ $keyword = Tag::LABEL_TODO;
+ }
+ if ($keyword === '$labellater') {
+ $keyword = Tag::LABEL_LATER;
+ }
$displayName = str_replace('_', ' ', $keyword);
$displayName = strtoupper($displayName);