diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-05-08 12:09:11 +0300 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2020-05-12 14:55:01 +0300 |
commit | ecea39df8ca8aca78a29339e16be356df540013e (patch) | |
tree | a274b979a0ce1bdca785854852fcd231fa5d89d9 | |
parent | 85577232d3cbbced45461892cfec925017b7006c (diff) |
Simplify seen/unseen flag to the IMAP standard
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
-rw-r--r-- | lib/Db/Message.php | 2 | ||||
-rw-r--r-- | lib/Model/IMAPMessage.php | 2 | ||||
-rw-r--r-- | src/components/Envelope.vue | 6 | ||||
-rw-r--r-- | src/components/Message.vue | 4 | ||||
-rw-r--r-- | src/store/actions.js | 8 |
5 files changed, 11 insertions, 11 deletions
diff --git a/lib/Db/Message.php b/lib/Db/Message.php index 354c8d080..2edc06c28 100644 --- a/lib/Db/Message.php +++ b/lib/Db/Message.php @@ -208,7 +208,7 @@ class Message extends Entity implements JsonSerializable { 'subject' => $this->getSubject(), 'dateInt' => $this->getSentAt(), 'flags' => [ - 'unseen' => !$this->getFlagSeen(), + 'seen' => $this->getFlagSeen(), 'flagged' => $this->getFlagFlagged(), 'answered' => $this->getFlagAnswered(), 'deleted' => $this->getFlagDeleted(), diff --git a/lib/Model/IMAPMessage.php b/lib/Model/IMAPMessage.php index 37f264f05..df9f4f69f 100644 --- a/lib/Model/IMAPMessage.php +++ b/lib/Model/IMAPMessage.php @@ -134,7 +134,7 @@ class IMAPMessage implements IMessage, JsonSerializable { public function getFlags(): array { $flags = $this->fetch->getFlags(); return [ - 'unseen' => !in_array(Horde_Imap_Client::FLAG_SEEN, $flags), + 'seen' => in_array(Horde_Imap_Client::FLAG_SEEN, $flags), 'flagged' => in_array(Horde_Imap_Client::FLAG_FLAGGED, $flags), 'answered' => in_array(Horde_Imap_Client::FLAG_ANSWERED, $flags), 'deleted' => in_array(Horde_Imap_Client::FLAG_DELETED, $flags), diff --git a/src/components/Envelope.vue b/src/components/Envelope.vue index deaa87101..8a819ae67 100644 --- a/src/components/Envelope.vue +++ b/src/components/Envelope.vue @@ -1,5 +1,5 @@ <template> - <router-link class="app-content-list-item" :class="{unseen: data.flags.unseen, draft}" :to="link"> + <router-link class="app-content-list-item" :class="{seen: data.flags.seen, draft}" :to="link"> <div v-if="folder.isUnified" class="mail-message-account-color" @@ -49,7 +49,7 @@ data.flags.important ? t('mail', 'Mark unimportant') : t('mail', 'Mark important') }}</ActionButton> <ActionButton icon="icon-mail" @click.prevent="onToggleSeen">{{ - data.flags.unseen ? t('mail', 'Mark read') : t('mail', 'Mark unread') + data.flags.seen ? t('mail', 'Mark unread') : t('mail', 'Mark read') }}</ActionButton> <ActionButton icon="icon-junk" @click.prevent="onToggleJunk">{{ data.flags.junk ? t('mail', 'Mark not spam') : t('mail', 'Mark as spam') @@ -216,7 +216,7 @@ export default { } } -.app-content-list-item.unseen { +.app-content-list-item:not(.seen) { font-weight: bold; } .app-content-list-item-star.junk { diff --git a/src/components/Message.vue b/src/components/Message.vue index 578e3769a..8687f2012 100644 --- a/src/components/Message.vue +++ b/src/components/Message.vue @@ -40,7 +40,7 @@ {{ t('mail', 'Forward') }} </ActionButton> <ActionButton icon="icon-mail" @click="onToggleSeen"> - {{ envelope.flags.unseen ? t('mail', 'Mark read') : t('mail', 'Mark unread') }} + {{ envelope.flags.seen ? t('mail', 'Mark unread') : t('mail', 'Mark read') }} </ActionButton> <ActionButton icon="icon-junk" @click="onToggleJunk"> @@ -215,7 +215,7 @@ export default { this.loading = false - if (envelope.flags.unseen) { + if (!envelope.flags.seen) { return this.$store.dispatch('toggleEnvelopeSeen', envelope) } } catch (error) { diff --git a/src/store/actions.js b/src/store/actions.js index a5eea9817..acb19292a 100644 --- a/src/store/actions.js +++ b/src/store/actions.js @@ -567,20 +567,20 @@ export default { }, toggleEnvelopeSeen({commit, getters}, envelope) { // Change immediately and switch back on error - const oldState = envelope.flags.unseen + const oldState = envelope.flags.seen commit('flagEnvelope', { envelope, - flag: 'unseen', + flag: 'seen', value: !oldState, }) - setEnvelopeFlag(envelope.accountId, envelope.folderId, envelope.id, 'seen', oldState).catch((e) => { + setEnvelopeFlag(envelope.accountId, envelope.folderId, envelope.id, 'seen', !oldState).catch((e) => { console.error('could not toggle message seen state', e) // Revert change commit('flagEnvelope', { envelope, - flag: 'unseen', + flag: 'seen', value: oldState, }) }) |