From 6aa20c9edf5f544b30d2c40422a3132fe794ee3f Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 May 2016 11:12:37 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E7=9A=84=E5=86=85=E5=AE=B9=E6=B2=A1=E6=9C=89=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E7=94=A8Tab=E9=94=AE=E7=A9=BA=E6=A0=BC=E5=BC=95=E8=B5=B7?= =?UTF-8?q?=E7=9A=84=E7=89=B9=E6=AE=8A=E7=AC=A6=E5=8F=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/application_helper.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 7d970c762..cda3ce53c 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -3238,6 +3238,7 @@ def strip_html(text,len=0,endss="...") ss = "" if text.length>0 ss=text.gsub(/<\/?.*?>/, '').strip + ss = ss.gsub(/ /, ' ') if len > 0 && ss.length > len ss = ss[0, len] + endss From 82568b59514fadce49bb50b6bc74751fa1a29e86 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 May 2016 11:39:30 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E7=BC=BA=E9=99=B7=E7=8A=B6=E6=80=81?= =?UTF-8?q?=E6=9B=B4=E6=94=B9=E6=88=96=E5=86=85=E5=AE=B9=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E6=97=B6=E4=B8=8D=E5=8F=91=E6=A8=A1=E6=9D=BF=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journal.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/models/journal.rb b/app/models/journal.rb index 02086fa62..eeaa17dd6 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -239,8 +239,10 @@ class Journal < ActiveRecord::Base #缺陷回复微信模板消息 def issue_wechat_message - ws = WechatService.new - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + if !self.notes.nil? && self.notes.gsub(' ','') != '' + ws = WechatService.new + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.issue.author_id, "issues", self.journalized_id, "#{l(:label_issue_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end From 2895dd5342c5cf8e9a4218d49d059f749246c776 Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 May 2016 14:28:14 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=B6=88=E6=81=AF=E9=80=9A=E7=9F=A5?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=98=BE=E7=A4=BA=E4=BD=9C=E4=B8=9A=E5=90=8D?= =?UTF-8?q?=E7=A7=B0=E7=9A=84tip?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/users/_user_message_course.html.erb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/views/users/_user_message_course.html.erb b/app/views/users/_user_message_course.html.erb index d46c45593..d4fbeb234 100644 --- a/app/views/users/_user_message_course.html.erb +++ b/app/views/users/_user_message_course.html.erb @@ -395,9 +395,9 @@
  • <%= link_to ma.course_message.user, user_path(ma.course_message.user), :class => "newsBlue homepageNewsPublisher", :target => '_blank' %> "> <% if ma.course_message.m_parent_id.nil? %> - 回复了您的作业: + 回复了您的作业: <% else %> - 回复了您: + 在作业中回复了您: <% end %>
  • From c165d0b37ef392f01a9c421e87f0dc7635e53fdf Mon Sep 17 00:00:00 2001 From: cxt Date: Fri, 20 May 2016 14:52:47 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E4=BA=8C=E7=BA=A7?= =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E7=9A=84=E6=A8=A1=E6=9D=BF=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/journals_for_message.rb | 21 ++++++++++++++------- config/locales/zh.yml | 1 + 2 files changed, 15 insertions(+), 7 deletions(-) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 68b747ab9..d0113744c 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -259,19 +259,26 @@ class JournalsForMessage < ActiveRecord::Base if self.m_parent_id.nil? if self.user_id != self.jour.user_id self.course_messages << CourseMessage.new(:user_id => self.jour.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end else if self.user_id != self.parent.user_id self.course_messages << CourseMessage.new(:user_id => self.parent.user_id,:course_id => self.jour.course.id, :viewed => false) + count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.parent.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count + if count == 0 + ws = WechatService.new + #content = truncate(strip_tags(self.notes.to_s), length: 200) + content = strip_html self.notes.html_safe, 200 + ws.comment_template self.parent.user_id, "homework", self.jour_id, "#{l(:label_new_second_comment_template)}", self.user.try(:realname), format_time(self.created_on), content + end end end - count = ShieldWechatMessage.where("container_type='User' and container_id=#{self.jour.user_id} and shield_type='Course' and shield_id=#{self.jour.course_id}").count - if count == 0 - ws = WechatService.new - #content = truncate(strip_tags(self.notes.to_s), length: 200) - content = strip_html self.notes.html_safe, 200 - ws.comment_template self.jour.user_id, "homework", self.jour_id, "#{l(:label_homework_comment_template)}", self.user.try(:realname), format_time(self.created_on), content - end end end diff --git a/config/locales/zh.yml b/config/locales/zh.yml index 18f027dce..a347359bb 100644 --- a/config/locales/zh.yml +++ b/config/locales/zh.yml @@ -2137,6 +2137,7 @@ zh: label_notice_comment_template: 您的课程通知有新回复了 label_news_comment_template: 您的项目新闻有新回复了 label_homework_comment_template: 您的作业有新回复了 + label_new_second_comment_template: 您有新回复了 label_new_journals_template: 您有新留言了 label_journals_comment_template: 您的留言有新回复了 label_blog_comment_template: 您的博客有新回复了