Method: Mailboxer::Models::Messageable#reply_to_conversation

Defined in:
lib/mailboxer/models/messageable.rb

#reply_to_conversation(conversation, reply_body, subject = nil, should_untrash = true, sanitize_text = true, attachment = nil) ⇒ Object

Replies to all the recipients of the last message in the conversation and untrash any trashed message by messageable if should_untrash is set to true (this is so by default)



110
111
112
113
114
115
116
117
118
# File 'lib/mailboxer/models/messageable.rb', line 110

def reply_to_conversation(conversation, reply_body, subject=nil, should_untrash=true, sanitize_text=true, attachment=nil)
  #move conversation to inbox if it is currently in the trash and should_untrash parameter is true.
  if should_untrash && mailbox.is_trashed?(conversation)
    mailbox.receipts_for(conversation).untrash
    mailbox.receipts_for(conversation).mark_as_not_deleted
  end

  reply(conversation, conversation.last_message.recipients, reply_body, subject, sanitize_text, attachment)
end