diff --git a/Gemfile b/Gemfile index 3f07ad408..299af4509 100644 --- a/Gemfile +++ b/Gemfile @@ -22,7 +22,7 @@ gem 'spreadsheet' gem 'ruby-ole' #gem 'email_verifier', path: 'lib/email_verifier' gem 'rufus-scheduler' -gem 'dalli', path: 'lib/dalli-2.7.2' +#gem 'dalli', path: 'lib/dalli-2.7.2' group :development do gem 'grape-swagger' gem 'grape-swagger-ui', git: 'https://github.com/guange2015/grape-swagger-ui.git' diff --git a/app/controllers/projects_controller.rb b/app/controllers/projects_controller.rb index 41b9201ba..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 , @@ -332,18 +332,23 @@ class ProjectsController < ApplicationController @wiki ||= @project.wiki end - + def send_mail_to_member + unless params[:mail].nil? + email = params[:mail] + Mailer.send_invite_in_project(email, @project, User.current).deliver + end + end #发送邮件邀请新用户 def invite_members_by_mail - + respond_to do |format| + format.html + format.js + end end # 邀请Trustie注册用户 - def invite_members_had_loged + def invite_members @member ||= @project.members.new - respond_to do |format| - format.js - end end def edit diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index b3e808b19..5e2f76705 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') end + 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))))) + } @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/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index f47ced545..971bf603d 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -31,7 +31,7 @@ module WatchersHelper watched = objects.any? {|object| object.watched_by?(user)} @watch_flag = (objects.first.instance_of?(User) or objects.first.instance_of?(Project) or objects.first.instance_of?(Contest) or (objects.first.instance_of?(Bid))) - css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) : + css = @watch_flag ? ([watcher_css(objects), watched ? 'icon ' : 'icon '].join(' ') << options[0].to_s) : ([watcher_css(objects), watched ? 'icon icon-fav ' : 'icon icon-fav-off '].join(' ') << options[0].to_s) text = @watch_flag ? @@ -283,6 +283,6 @@ module WatchersHelper def exit_project_link(project) link_to(l(:label_exit_project),exit_cur_project_path(project.id), - :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:20px;text-aligh:center;" ) + :remote => true, :confirm => l(:lable_sure_exit_project), :style => "color: #fff; display:block; padding: 0px 5px;margin-right:10px;height:22px;background:none repeat scroll 0% 0% #64BDD9;TES" ) end 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/boards/_project_show.html.erb b/app/views/boards/_project_show.html.erb index 97ed903d9..9a3b79051 100644 --- a/app/views/boards/_project_show.html.erb +++ b/app/views/boards/_project_show.html.erb @@ -9,9 +9,8 @@