Add message threads #394

This new view sorts the messages by threads based on the reply_to.
Now we store only the message which started a new thread in the reply_to
field to avoid recursive queries.
This commit is contained in:
Patrick Gansterer 2016-02-18 11:00:03 +01:00 committed by wvengen
parent d56828fa4d
commit 8ac1471a89
12 changed files with 180 additions and 0 deletions

View file

@ -13,6 +13,9 @@ class MessagesController < ApplicationController
if @message.reply_to
original_message = Message.find(@message.reply_to)
if original_message.reply_to
@message.reply_to = original_message.reply_to
end
if original_message.is_readable_for?(current_user)
@message.add_recipients [original_message.sender]
@message.group_id = original_message.group_id