diff options
-rw-r--r-- | worker/notmuch/message.go | 27 |
1 files changed, 10 insertions, 17 deletions
diff --git a/worker/notmuch/message.go b/worker/notmuch/message.go index b6d7f54c..f78adeff 100644 --- a/worker/notmuch/message.go +++ b/worker/notmuch/message.go @@ -99,27 +99,20 @@ func (m *Message) SetFlag(flag models.Flags, enable bool) error { break } } + if flag == models.SeenFlag { - oldState = !oldState + // Invert the operation since notmuch uses unread tags instead + // of seen tags + enable = !enable } - // Skip if flag already in correct state. - if oldState == enable { + switch { + case oldState == enable: return nil - } - - if !enable { - if flag == models.SeenFlag { - return m.AddTag("unread") - } else { - return m.RemoveTag(tag) - } - } else { - if flag == models.SeenFlag { - return m.RemoveTag("unread") - } else { - return m.AddTag(tag) - } + case enable: + return m.AddTag(tag) + default: + return m.RemoveTag(tag) } } |