修复留言嵌套回复问题

This commit is contained in:
huang 2015-08-20 18:54:01 +08:00
parent 840caf18f3
commit 893c1c753f
1 changed files with 18 additions and 8 deletions

View File

@ -208,18 +208,28 @@ class JournalsForMessage < ActiveRecord::Base
receivers << self.jour
end
else # 留言回复
# 添加留言回复人
reply_to = User.find(self.reply_id)
if self.user_id != self.parent.user_id && self.user_id != self.parent.jour_id # 如果回帖人不是用户自己
receivers << self.parent.user
if self.user_id != self.parent.user_id
receivers << reply_to
if self.reply_id != self.parent.user_id
receivers << reply_to
end
else # 用户自己回复别人的,别人收到消息通知
if self.user_id != self.reply_id # 过滤掉自己回复自己的
receivers << reply_to
receivers << self.parent.user
end
else
receivers << reply_to
end
# 添加留言回复人
#reply_to = User.find(self.reply_id)
#if self.user_id != self.parent.user_id && self.user_id != self.parent.jour_id # 如果回帖人不是用户自己
# receivers << self.parent.user
# if self.reply_id != self.parent.user_id
# receivers << reply_to
# end
#else # 用户自己回复别人的,别人收到消息通知
# if self.user_id != self.reply_id # 过滤掉自己回复自己的
# receivers << reply_to
# end
#end
end
if self.jour_type == 'Principal'