From 76db95aa0339b85ad7fd168e9d89c45ed3996162 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 15:52:13 +0800 Subject: [PATCH 1/3] =?UTF-8?q?1.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E4=B8=AD=EF=BC=8C=E9=80=80=E5=87=BA=E5=90=8E=E5=88=B7=E6=96=B0?= =?UTF-8?q?=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=EF=BC=9B=202.=E7=BB=84?= =?UTF-8?q?=E7=BB=87=E9=A1=B5=E9=9D=A2=E4=B8=AD=EF=BC=8C=E7=82=B9=E5=87=BB?= =?UTF-8?q?=E2=80=9C=E4=B8=AA=E4=BA=BA=E4=B8=BB=E9=A1=B5=E2=80=9D=EF=BC=8C?= =?UTF-8?q?=E6=89=93=E5=BC=80=E6=96=B0=E7=9A=84=E9=A1=B5=E9=9D=A2=EF=BC=9B?= =?UTF-8?q?=203.=E7=BB=84=E7=BB=87=E9=A1=B5=E9=9D=A2=E9=A1=B5=E9=A6=96?= =?UTF-8?q?=E9=83=A8=E5=88=86=EF=BC=8C=E7=94=A8=E6=88=B7=E5=90=8D=E4=B8=8D?= =?UTF-8?q?=E9=93=BE=E6=8E=A5=E7=94=A8=E6=88=B7=E9=A1=B5=E9=9D=A2=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/organizations_controller.rb | 7 +++++++ app/views/layouts/base_org.html.erb | 7 ++++--- config/routes.rb | 1 + 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/app/controllers/organizations_controller.rb b/app/controllers/organizations_controller.rb index 85f57917b..d182640ed 100644 --- a/app/controllers/organizations_controller.rb +++ b/app/controllers/organizations_controller.rb @@ -239,6 +239,13 @@ class OrganizationsController < ApplicationController end end + def logout + logout_user + respond_to do |format| + format.html {redirect_to organization_path(params[:id])} + end + end + def search_projects @organization = Organization.find(params[:id]) condition = '%%' diff --git a/app/views/layouts/base_org.html.erb b/app/views/layouts/base_org.html.erb index 5af5c9ad0..4c33dcca5 100644 --- a/app/views/layouts/base_org.html.erb +++ b/app/views/layouts/base_org.html.erb @@ -46,12 +46,13 @@ - + <% else %> diff --git a/config/routes.rb b/config/routes.rb index 4e64ca505..15e41955d 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -46,6 +46,7 @@ RedmineApp::Application.routes.draw do get 'search_projects' post 'join_project_menu' post 'join_projects' + post 'logout' end collection do get 'check_uniq' From a8b7d1b81f427b91c90ea0ac7d6843ace32712ea Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 17:11:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?=E5=9B=9E=E5=A4=8D=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E9=87=8C=E7=9A=84message,=E4=B8=8D=E5=A2=9E=E5=8A=A0=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE=E5=8A=A8=E6=80=81=E5=8F=8A=E7=BB=84=E7=BB=87=E5=8A=A8?= =?UTF-8?q?=E6=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/forge_activity.rb | 26 +++++++++++++++----------- app/models/message.rb | 2 +- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/app/models/forge_activity.rb b/app/models/forge_activity.rb index 115575289..c98c5475b 100644 --- a/app/models/forge_activity.rb +++ b/app/models/forge_activity.rb @@ -46,20 +46,24 @@ class ForgeActivity < ActiveRecord::Base end def add_org_activity - if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? - org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first - if org_activity + org_activity = OrgActivity.where("org_act_type = '#{self.forge_act_type.to_s}' and org_act_id = #{self.forge_act_id}").first + if org_activity + org_activity.created_at = self.created_at + org_activity.save + else + if self.forge_act_type == 'Message' && !self.forge_act.parent_id.nil? + org_activity = OrgActivity.where("org_act_type = 'Message' and org_act_id = #{self.forge_act.parent.id}").first org_activity.created_at = self.created_at org_activity.save + else + OrgActivity.create(:user_id => self.user_id, + :org_act_id => self.forge_act_id, + :org_act_type => self.forge_act_type, + :container_id => self.project_id, + :container_type => 'Project', + :created_at => self.created_at, + :updated_at => self.updated_at) end - else - OrgActivity.create(:user_id => self.user_id, - :org_act_id => self.forge_act_id, - :org_act_type => self.forge_act_type, - :container_id => self.project_id, - :container_type => 'Project', - :created_at => self.created_at, - :updated_at => self.updated_at) end end diff --git a/app/models/message.rb b/app/models/message.rb index 92ec0235e..d8f62171a 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -186,7 +186,7 @@ class Message < ActiveRecord::Base # Description def act_as_forge_activity # 如果project为空,那么就是课程相关的消息 - if !self.board.project.nil? + if !self.board.project.nil? && self.parent_id.nil? self.forge_acts << ForgeActivity.new(:user_id => self.author_id, :project_id => self.board.project.id) end From 9d6b4783df41c2088176fda622b4e92a5887b1c1 Mon Sep 17 00:00:00 2001 From: ouyangxuhua Date: Mon, 7 Dec 2015 17:18:46 +0800 Subject: [PATCH 3/3] =?UTF-8?q?=E5=88=A0=E9=99=A4=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=E6=A0=8F=E7=9B=AE=E7=9A=84=E7=BB=84=E7=BB=87?= =?UTF-8?q?=E9=A6=96=E9=A1=B5=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/organizations/_subfield_list.html.erb | 5 ----- 1 file changed, 5 deletions(-) diff --git a/app/views/organizations/_subfield_list.html.erb b/app/views/organizations/_subfield_list.html.erb index a0f6dc60f..6ba60245a 100644 --- a/app/views/organizations/_subfield_list.html.erb +++ b/app/views/organizations/_subfield_list.html.erb @@ -4,11 +4,6 @@
  • 状态
  • -
      -
    • 组织首页
    • -
    • 默认
    • -
      -
    • 动态
    • 默认