Conversation Lifecycle

See also Bug 789078.

Geary is currently somewhat inconsistent and incomplete in how it lets people manage the lifecycle and labelling of conversations. This is in part due due to trying to fit the conversation model to both IMAP and GMail, and part due to feature growth over the years. We should tidy this up to make it both consistent and complete.

Based on some notes I made, conversations seem to exist in two different finite state machines — one that covers labelling of conversations, i.e. conversations that should be kept, and one that covers the overall conversation lifecycle. States sometimes represent mailboxes, but sometimes are an abstract state, and the transitions between these states define the actions that people might want to take. These actions should be made available to people as high-level UI items, and Geary should manage the implications of the actions under the hood.

Use cases:

  1. Alice has a conversation with both sent and received messages in the Inbox that she has finished with. She wants it out of the Inbox so she hits Archive.
  2. Bob receives a work message, so labels it as Work but stays in the Inbox. On completing the important task, he wants it out of the Inbox so he hits Archive, but wants it to remain labelled as Work.
  3. Charlie has an elaborate hierarchy of mailboxes and wants to move a received message in the Inbox to one of these.
  4. Dave receive the same spam message twice and wants to move both to the Junk folder.
  5. Erin replies to a mailing list message early on but loses interest in the conversation later as it goes off topic. Earlier messages (including her sent messages) are archived but she wants latter messages to be moved to the trash.

Labelling FSM

In the IMAP model, labelling corresponds to copying, not moving.


  • Inbox
  • Archive
  • User defined mailboxes


These operate only on messages in the current folder for the conversation, not other messages.

Move messages from Inbox to the Archive folder, without removing from other mailboxes
Move messages from the current mailbox to the selected destination, without removing from other mailboxes
Copy message from the current mailbox to the selected destination
Move messages from current mailbox to Inbox, without removing from other mailboxes

Archive isn't available from other mailboxes, since other mailboxes aren't considered final states (Except for use case #3, and then people won't want to archive the message anyway). It might not make sense to only support Copy from Archive and not Move, for the same reason.

Note: This currently doesn't let users partially or completely unlabel messages without moving them to Inbox. Maybe we need a "Remove all Labels" action that removes all labels leaves them in Archive if there already or moves them back to the Inbox otherwise? Or else maybe Restore should actually do just that?

Lifecycle FSM


  • [Normal] (Any conversation in the FSM above)
  • Draft
  • Trash
  • Junk
  • [Deleted]


These operate on all messages in the conversations, including those in Sent.

Move the conversation to the trash
Move the conversation to the Junk
Restore all messages to their previous states/folders (difficult to implement)
Permanently deletes all messages in the conversation

Note: This definition of Trash doesn't work with use case #5 - all messages will be deleted, including those sent and already archived. However that could be covered with the ability to "Mute" a conversation, i.e. Bug 713237

User Experience

Both conversations and messages should be tagged with their current mailboxes. Messages with the individual mailboxes they belong to, and conversations with the union of all tags, except Sent and Archive. See Bug 713027.

A conversation's current state defines what UI is presented to the user when it is selected. E.g. in the Archive state these actions should be available: Restore, Copy, Move, Trash, Junk.

Archive and Trash are primary action for conversations in the Inbox and so they should probably be emphasised and easily activated via the UI.

The Restore action is the only primary action for most other states, and hence that should be similarly emphasised, although implementing this properly will be tricky, e.g. to ensure that sent mail in the conversation is restored to Sent, and received mail in the conversation is restored to whatever other mailbox(es) it was in.

The mock-up below shows what different toolbars/actionbars might lookup under this scheme for various folders:

These correspond to the following folders:

  1. Inbox
  2. Archive/user-defined folders
  3. Drafts
  4. Trash
  5. Junk

Trash uses an icon rather than a text label since linked buttons with different label types looks pretty inconsistent.

Sent isn't shown, but would be similar to (1) or (2) but without a primary action button or Junk button.


Still to be defined is how these actions apply to individual messages in the conversation. E.g. Should Trash move just the messages in the current mailbox to the Trash (as at the moment), or all messages (e.g. including any in Sent?).

Also need to work out how well this fits with GMail (e.g. Bug 712963)


Comments welcome, either below here or on the mailing list.

Apps/Geary/Design/ConversationLifecycle (last edited 2018-04-13 00:36:43 by MichaelGratton)