From 9b6836fc70534a46ea6eabdbe516b4cad8f21f05 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 2 Aug 2019 19:08:30 +0800 Subject: [PATCH 1/5] delete --- public/react/src/modules/forums/PostPaginationHOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/forums/PostPaginationHOC.js b/public/react/src/modules/forums/PostPaginationHOC.js index 3922eae41..1f67c8d7d 100644 --- a/public/react/src/modules/forums/PostPaginationHOC.js +++ b/public/react/src/modules/forums/PostPaginationHOC.js @@ -267,7 +267,7 @@ return function wrap(WrappedComponent) { this.setTop(memo); } onMemoDelete(memo) { - const deleteUrl = `/api/v1/memos/${memo.id}`; + const deleteUrl = `/memos/${memo.id}.json`; // 获取memo list axios.delete(deleteUrl, { // withCredentials: true, From 981be28c668e626aa051729431d1ac328c9b5f1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 2 Aug 2019 19:11:31 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/coursesPublic/Addcourses.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index 8225907b8..a9d30f2b6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -75,6 +75,7 @@ class Addcourses extends Component{ if(e.target.checked===true){ this.setState({ assistant_professor:1, + professor:null, Checkboxteachingchecked:e.target.checked, Checkboxteachertype:true }) @@ -95,6 +96,7 @@ class Addcourses extends Component{ if(e.target.checked===true){ this.setState({ professor:1, + assistant_professor:null, Checkboxteacherchecked:e.target.checked, Checkboxteachingtype:true }) From d484af9a0d7dfa838404d34f8e74efcb6a7dd466 Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 2 Aug 2019 19:15:28 +0800 Subject: [PATCH 3/5] fix --- app/decorators/tiding_decorator.rb | 1 + app/models/apply_add_school.rb | 3 ++- db/migrate/20190802105008_tranfer_tiding_data.rb | 5 +++++ 3 files changed, 8 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20190802105008_tranfer_tiding_data.rb diff --git a/app/decorators/tiding_decorator.rb b/app/decorators/tiding_decorator.rb index c7d914089..30a325cd3 100644 --- a/app/decorators/tiding_decorator.rb +++ b/app/decorators/tiding_decorator.rb @@ -30,6 +30,7 @@ module TidingDecorator end def strip_html(text, len = 0, suffix = "...") + text = text.to_s str = "" if !text.nil? && text.length > 0 str = text.gsub(/<\/?.*?>/, '').strip diff --git a/app/models/apply_add_school.rb b/app/models/apply_add_school.rb index bae65d24f..c303283ca 100644 --- a/app/models/apply_add_school.rb +++ b/app/models/apply_add_school.rb @@ -9,6 +9,7 @@ class ApplyAddSchool < ApplicationRecord private def send_notify - tidings.create!(user_id: 1, status: 0, trigger_user_id: user_id, belong_container: school, tiding_type: 'Apply') + Tiding.create!(user_id: 1, status: 0, container_id: id, container_type: 'ApplyAddSchools', + trigger_user_id: user_id, belong_container: school, tiding_type: 'Apply') end end \ No newline at end of file diff --git a/db/migrate/20190802105008_tranfer_tiding_data.rb b/db/migrate/20190802105008_tranfer_tiding_data.rb new file mode 100644 index 000000000..ef7682530 --- /dev/null +++ b/db/migrate/20190802105008_tranfer_tiding_data.rb @@ -0,0 +1,5 @@ +class TranferTidingData < ActiveRecord::Migration[5.2] + def change + Tiding.where(container_type: 'ApplyAddSchool').update_all(container_type: 'ApplyAddSchools') + end +end From db61139032f5c0e2dcd0619517276c3e92d9613d Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 2 Aug 2019 19:18:36 +0800 Subject: [PATCH 4/5] page --- public/react/src/modules/forums/PostPaginationHOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/forums/PostPaginationHOC.js b/public/react/src/modules/forums/PostPaginationHOC.js index 1f67c8d7d..cdba0a35a 100644 --- a/public/react/src/modules/forums/PostPaginationHOC.js +++ b/public/react/src/modules/forums/PostPaginationHOC.js @@ -136,7 +136,7 @@ return function wrap(WrappedComponent) { const params = { // replies_count最热 created_at 最新 // s_order: 'replies_count', - page: currentPage - 1, + page: currentPage, // forum: // forum_id // user_id From d842784e29a34d032ed1b16f7623c7e669300adf Mon Sep 17 00:00:00 2001 From: p31729568 Date: Fri, 2 Aug 2019 19:37:38 +0800 Subject: [PATCH 5/5] fix --- app/models/journals_for_message.rb | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/app/models/journals_for_message.rb b/app/models/journals_for_message.rb index 1da26fd22..d5697d87f 100644 --- a/app/models/journals_for_message.rb +++ b/app/models/journals_for_message.rb @@ -25,6 +25,8 @@ class JournalsForMessage < ApplicationRecord # "is_comprehensive_evaluation", # 1 教师评论、2 匿评、3 留言 # "hidden", 隐藏 + after_create :send_tiding + # course_identity 课堂用户身份 def contents_show course_identity @@ -47,4 +49,29 @@ class JournalsForMessage < ApplicationRecord JournalsForMessage.includes(:user).where(m_parent_id: self.id).page(page).per(limit).reorder("created_on asc") end + + def send_tiding + # 回复和@同一个人时:只发@的消息(因@的消息先创建) + case self.jour_type + # 用户留言当做私信处理 不发消息 + when "Principal" +=begin + user_id = self.m_parent_id.present? ? JournalsForMessage.find(self.m_parent_id).user_id : self.jour_id + if user_id != self.user_id && !self.tidings.where(:user_id => user_id, :trigger_user_id => self.user_id, :tiding_type => "Mentioned").first.present? + self.tidings << Tiding.new(:trigger_user_id => self.user_id, :user_id => user_id, :parent_container_id => self.jour_id, :parent_container_type => self.jour_type, :belong_container_id => self.jour_id, :belong_container_type => "User", :viewed => 0, :tiding_type => self.m_parent_id.present? ? "Comment" : "Journal") + end +=end + when "HomeworkCommon", "GraduationTopic" + user_id = self.m_parent_id.present? ? JournalsForMessage.find(self.m_parent_id).user_id : (self.jour_type == "HomeworkCommon" ? self.jour.user_id : self.jour.tea_id) + if user_id != self.user_id && !self.tidings.where(:user_id => user_id, :trigger_user_id => self.user_id, :tiding_type => "Mentioned").first.present? + self.tidings << Tiding.new(:trigger_user_id => self.user_id, :user_id => user_id, :parent_container_id => self.jour_id, :parent_container_type => self.jour_type, :belong_container_id => self.jour.course_id, :belong_container_type => "Course", :viewed => 0, :tiding_type => "Comment") + end + when "StudentWorksScore" + course_id = self.jour.try(:student_work).try(:homework_common).try(:course_id) + user_id = self.m_parent_id.present? ? JournalsForMessage.find(self.m_parent_id).user_id : self.jour.user_id + if user_id != self.user_id && !self.tidings.where(:user_id => user_id, :trigger_user_id => self.user_id, :tiding_type => "Mentioned").first.present? + self.tidings << Tiding.new(:trigger_user_id => self.user_id, :user_id => user_id, :parent_container_id => self.jour_id, :parent_container_type => self.jour_type, :belong_container_id => course_id, :belong_container_type => "Course", :viewed => 0, :tiding_type => "Comment") + end + end + end end