|
|
|
@ -266,14 +266,16 @@ class Message < ActiveRecord::Base
|
|
|
|
|
self.course.members.each do |m|
|
|
|
|
|
if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息
|
|
|
|
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
|
|
|
|
ws.topic_publish_template m.user_id, "#{l(:label_course_topic_template)}", self.subject, self.author.try(:realname), format_time(self.created_on)
|
|
|
|
|
content = strip_html self.subject, 200
|
|
|
|
|
ws.topic_publish_template m.user_id, "#{l(:label_course_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else # 回帖
|
|
|
|
|
self.course.members.each do |m|
|
|
|
|
|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
|
|
|
|
self.course_messages << CourseMessage.new(:user_id => m.user_id, :course_id => self.board.course_id, :viewed => false)
|
|
|
|
|
ws.comment_template m.user_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), self.content.html_safe
|
|
|
|
|
content = strip_html self.content.html_safe, 200
|
|
|
|
|
ws.comment_template m.user_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
@ -282,14 +284,16 @@ class Message < ActiveRecord::Base
|
|
|
|
|
self.project.members.each do |m|
|
|
|
|
|
if m.user_id != self.author_id
|
|
|
|
|
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
|
|
|
|
ws.topic_publish_template m.user_id, "#{l(:label_project_topic_template)}", self.subject, self.author.try(:realname), format_time(self.created_on)
|
|
|
|
|
content = strip_html self.subject, 200
|
|
|
|
|
ws.topic_publish_template m.user_id, "#{l(:label_project_topic_template)}", content, self.author.try(:realname), format_time(self.created_on)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
else # 回帖
|
|
|
|
|
self.project.members.each do |m|
|
|
|
|
|
if m.user_id == Message.find(self.parent_id).author_id && m.user_id != self.author_id # 只针对主贴回复,回复自己的帖子不发消息
|
|
|
|
|
self.forge_messages << ForgeMessage.new(:user_id => m.user_id, :project_id => self.board.project_id, :viewed => false)
|
|
|
|
|
ws.comment_template m.user_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), self.content.html_safe
|
|
|
|
|
content = strip_html self.content.html_safe, 200
|
|
|
|
|
ws.comment_template m.user_id, "#{l(:label_topic_comment_template)}", self.author.try(:realname), format_time(self.created_on), content
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|