Reputation: 2293
I'm using a gem called mailboxer to allow users to send messages among eachother.
For the reply to message method, is there a way I can get the user to skip putting in a new subject every time they reply in a conversation??
In my conversations controller, this is what I had:
def reply
current_user.reply_to_conversation(conversation, *message_params(:body, :subject))
redirect_to conversation
end
I tried using:
def reply
current_user.reply_to_conversation(conversation, *message_params(:body, mailboxer.message_mailer.subject_reply))
redirect_to conversation
end
Which has not worked. Ideally there should only be one subject per conversation, I'm not sure why this gem would allow a different subject in every response within a conversation. How do I remove the subject from reply's so that the message keeps the same subject the entire time? Should I modify the reply method?
Upvotes: 0
Views: 296
Reputation: 1578
It looks to me like if there is no subject passed to reply_to_conversation
, the subject is set to "RE: {conversation.subject}"
, where conversation
is the first argument passed to reply_to_conversation
.
So one solution is to just not pass a subject argument to this method, e.g.:
current_user.reply_to_conversation(conversation, body)
If you really want it to just copy the subject (with no "RE:"), you would do:
current_user.reply_to_conversation(conversation, body, conversation.subject)
The source for this method should help:
https://github.com/ging/mailboxer/blob/master/lib/mailboxer/models/messageable.rb
Upvotes: 1