竞赛通知的回复,多级回复时,消息发送对象错误

This commit is contained in:
cxt 2017-01-18 15:02:23 +08:00
parent 25ac9e8e4d
commit 17b6babd5b
1 changed files with 8 additions and 7 deletions

View File

@ -56,13 +56,14 @@ class Comment < ActiveRecord::Base
# end
end
elsif self.commented.contest
if self.author_id != self.commented.author_id
self.contest_messages << ContestMessage.new(:user_id => self.commented.author_id, :contest_id => self.commented.contest.id, :viewed => false)
# count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.commented.author_id} and shield_type='Course' and shield_id=#{self.commented.course.id}").count
# if count == 0
# content = strip_html self.comments.html_safe, 200
# ws.comment_template self.commented.author_id, "course_notice", self.id, "#{l(:label_notice_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
# end
if self.parent.nil?
if self.author_id != self.commented.author_id
self.contest_messages << ContestMessage.new(:user_id => self.commented.author_id, :contest_id => self.commented.contest.id, :viewed => false)
end
else
if self.author_id != self.parent.author_id
self.contest_messages << ContestMessage.new(:user_id => self.parent.author_id, :contest_id => self.commented.contest.id, :viewed => false)
end
end
else # 项目相关
# if self.author_id != self.commented.author_id