diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 1428b4997..6ab757336 100644 --- a/app/controllers/projects_controller.rb +++ b/app/controllers/projects_controller.rb @@ -249,7 +249,7 @@ class ProjectsController < ApplicationController # Author lizanle # Description 项目动态展示方法,删除了不必要的代码 def show -=begin + # 试图跳转到请求的按钮 if params[:login] login = params[:login] @@ -265,7 +265,7 @@ class ProjectsController < ApplicationController if params[:jump] && redirect_to_project_menu_item(@project, params[:jump]) return end - +=begin cond = @project.project_condition(Setting.display_subprojects_issues?) has = { "show_issues" => true , 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 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 %>

+