X-Git-Url: https://git.cworth.org/git?p=notmuch;a=blobdiff_plain;f=lib%2Fmessage.cc;h=1c87f8c0c2eb16ecb6b0f372f22e01072ff4fcae;hp=53f35dd167fbd1075a452b7cc7e2ed45bae4c4c3;hb=HEAD;hpb=fb55ff28a2fdaa9c218af5ca10b1cae674869edd diff --git a/lib/message.cc b/lib/message.cc index 53f35dd1..46638f80 100644 --- a/lib/message.cc +++ b/lib/message.cc @@ -1397,14 +1397,15 @@ _notmuch_message_delete (notmuch_message_t *message) Xapian::PostingIterator thread_doc, thread_doc_end; Xapian::PostingIterator mail_doc, mail_doc_end; - message->notmuch->writable_xapian_db->delete_document (message->doc_id); - /* look for a non-ghost message in the same thread */ /* if this was a ghost to begin with, we are done */ private_status = _notmuch_message_has_term (message, "type", "ghost", &is_ghost); if (private_status) return COERCE_STATUS (private_status, "Error trying to determine whether message was a ghost"); + + message->notmuch->writable_xapian_db->delete_document (message->doc_id); + if (is_ghost) return NOTMUCH_STATUS_SUCCESS;