From ff2b4c610c1e489ef502573bb84196bb124876fa Mon Sep 17 00:00:00 2001
From: sw <939547590@qq.com>
Date: Sat, 7 Mar 2015 11:30:21 +0800
Subject: [PATCH 1/7] =?UTF-8?q?1=E3=80=81=E4=BF=AE=E6=94=B9=E7=94=A8?=
=?UTF-8?q?=E6=88=B7=E5=8A=A8=E6=80=81=E6=AF=8F=E9=A1=B5=E6=98=BE=E7=A4=BA?=
=?UTF-8?q?=E6=9D=A1=E7=9B=AE=E4=B8=8D=E6=AD=A3=E7=A1=AE=202=E3=80=81?=
=?UTF-8?q?=E7=94=A8=E6=88=B7=E5=8A=A8=E6=80=81=E5=A2=9E=E5=8A=A0=E6=96=B0?=
=?UTF-8?q?=E9=97=BB=E3=80=81=E7=95=99=E8=A8=80=E7=AD=89=E6=9D=83=E9=99=90?=
=?UTF-8?q?=E5=88=A4=E6=96=AD=E7=9A=84=E8=A1=A5=E5=85=A8=EF=BC=8C=E4=BB=A5?=
=?UTF-8?q?=E5=8F=8A=E9=83=A8=E5=88=86=E6=9D=83=E9=99=90=E5=88=A4=E6=96=AD?=
=?UTF-8?q?=E4=B8=8D=E6=AD=A3=E7=A1=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/users_controller.rb | 22 +++++++++++++++-------
1 file changed, 15 insertions(+), 7 deletions(-)
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index b3e808b19..00af13cb5 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -442,16 +442,24 @@ class UsersController < ApplicationController
watcher.push(User.current)
activity = Activity.where(where_condition).where('user_id in (?)', watcher).order('id desc')
else
- activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
+ activity = Activity.where(where_condition).where('user_id = ?', @user.id).order('id desc')
+ activity = activity.reject { |e|
+ !User.current.admin? &&
+ (((e.act_type == "Issue") && !e.act.project.visible?(User.current)) ||
+ (e.act_type == "Bid" && e.act.courses.first.is_public == 0 && !User.current.member_of_course?(e.act.courses.first)) ||
+ (e.act_type == "Journal" && e.act.respond_to?("Project") && !e.act.project.visible?(User.current)) ||
+ (e.act_type == "News" && ((!e.act.project.nil? && !e.act.project.visible?(User.current)) || (!e.act.course.nil? && e.act.course.is_public == 0 && !User.current.member_of_course?(e.act.course)))) ||
+ (e.act_type == "Message" && !e.act.board.nil? && ((!e.act.board.project.nil? && !e.act.board.project.visible?(User.current)) || (!e.act.board.course.nil? && e.act.board.course.is_public == 0 && !User.current.member_of_course?(e.act.board.course)))))
+ }
end
@activity_count = activity.count
@activity_pages = Paginator.new @activity_count, pre_count, params['page']
- @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page )
- @activity = @activity.reject { |e|
- ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
- ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
- ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
- }
+ @activity = activity.slice(@activity_pages.offset,@activity_pages.per_page)
+ # @activity = @activity.reject { |e|
+ # ((e.act_type=="Issue") && ( !e.act.visible?(User.current))) ||
+ # ((e.act_type == "Journal") && (!e.act.project.visible?(User.current))) ||
+ # ((e.act_type == "Bid") && ((!User.current.member_of_course?(e.act.courses.first) || !User.current.admin?)))
+ # }
@state = 0
end
From 151fc561acacb98c6a69a2a1bf8da7920a87000f Mon Sep 17 00:00:00 2001
From: alan <547533434@qq.com>
Date: Sat, 7 Mar 2015 11:30:25 +0800
Subject: [PATCH 2/7] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=82=AE=E4=BB=B6?=
=?UTF-8?q?=E6=A0=B7=E5=BC=8F=EF=BC=8C=E5=A2=9E=E5=8A=A0=E7=9B=B8=E5=BA=94?=
=?UTF-8?q?=E7=9A=84=E6=8F=90=E7=A4=BA=20Signed-off-by:=20alan=20<54753343?=
=?UTF-8?q?4@qq.com>?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/mailer.rb | 5 +++--
app/views/mailer/send_invite_in_project.html.erb | 4 ++++
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git a/app/models/mailer.rb b/app/models/mailer.rb
index 14c01b93d..b404ea531 100644
--- a/app/models/mailer.rb
+++ b/app/models/mailer.rb
@@ -31,10 +31,11 @@ class Mailer < ActionMailer::Base
# 发送邀请未注册用户加入项目邮件
# 功能: 在加入项目的同时自动注册用户
def send_invite_in_project(email, project, invitor)
+ @email = email
@subject = "#{invitor.name} #{l(:label_invite_project)} #{project.name} "
- password = newpass(6)
+ @password = newpass(6)
@project_url = url_for(:controller => 'projects', :action => 'show', :id => project.id,
- :password => password, :login => email)
+ :password => @password, :login => email)
mail :to => email, :subject => @subject
end
diff --git a/app/views/mailer/send_invite_in_project.html.erb b/app/views/mailer/send_invite_in_project.html.erb
index 980adc12d..6dbfcbda6 100644
--- a/app/views/mailer/send_invite_in_project.html.erb
+++ b/app/views/mailer/send_invite_in_project.html.erb
@@ -6,6 +6,10 @@
<%= @subject %> <%= link_to @project_url, @project_url%> 点击链接后,将自动为您注册账号 您的账号为:<%= @email %> 密码为: <%= @password %>