From de86584850508df74a34a4af3f3aae6622cfa3b6 Mon Sep 17 00:00:00 2001 From: huang Date: Fri, 16 Dec 2016 20:58:53 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=20?= =?UTF-8?q?=E6=88=91=E7=9A=84issue=20=E5=88=86=E9=A1=B5=E4=B8=8D=E8=83=BD?= =?UTF-8?q?=E7=82=B9=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_my_issue_list.html.erb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/users/_my_issue_list.html.erb b/app/views/users/_my_issue_list.html.erb index 29e4c9264..d9729b5b9 100644 --- a/app/views/users/_my_issue_list.html.erb +++ b/app/views/users/_my_issue_list.html.erb @@ -50,7 +50,7 @@
  • <% if !activity.assigned_to_id.nil? && activity.assigned_to_id != 0 %> - <% if activity.try(:assigned_to).try(:realname).empty? %> + <% if activity.try(:assigned_to).try(:realname).blank? %> <%= link_to activity.assigned_to, user_path(activity.assigned_to_id)%> <% else %> <%= link_to activity.try(:assigned_to).try(:realname), user_path(activity.assigned_to_id)%> From cb33bec7db772ed858983b77d418c28149aab042 Mon Sep 17 00:00:00 2001 From: huang Date: Mon, 19 Dec 2016 10:24:36 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E8=AE=A8=E8=AE=BA=E5=8C=BA=E5=8F=91?= =?UTF-8?q?=E5=B8=96delay=20=E6=A8=A1=E5=BC=8F=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/message.rb | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/app/models/message.rb b/app/models/message.rb index 309291183..3b0f89ef5 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -328,17 +328,27 @@ class Message < ActiveRecord::Base def delay_message_send if self.course if self.parent_id.nil? # 发帖 - self.delay.contain_messages_message + dm = [] + self.course.members.includes(:user).each do |m| + if self.author.allowed_to?(:as_teacher, self.course) && m.user_id != self.author_id # 老师 自己的帖子不给自己发送消息 + dm << {course_message_type:'Message',course_message_id:self.id, :user_id => m.user_id, + :course_id => self.board.course_id, :viewed => false} + if dm.size >= 30 + self.delay.contain_messages_message(dm) + dm.clear + end + unless dm.empty? + self.delay.contain_messages_message(dm) + end + end + end + end end end - def contain_messages_message - self.course.members.includes(:user).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) - end - end + def contain_messages_message vs + CourseMessage.create(vs) end #更新用户分数 -by zjc