diff --git a/app/helpers/welcome_helper.rb b/app/helpers/welcome_helper.rb index 003c6f288..35fd6ee08 100644 --- a/app/helpers/welcome_helper.rb +++ b/app/helpers/welcome_helper.rb @@ -333,7 +333,7 @@ module WelcomeHelper end #取得所有活动 - def find_all_activities limit=6 + def find_all_activities limit=6 # users = [] # activities = Activity.find_by_sql("select distinct user_id from activities order by id DESC limit #{limit}" ) # activities.each { |activity| diff --git a/lib/redmine/activity/fetcher.rb b/lib/redmine/activity/fetcher.rb index 6ea8c3258..a05a9ee17 100644 --- a/lib/redmine/activity/fetcher.rb +++ b/lib/redmine/activity/fetcher.rb @@ -88,10 +88,21 @@ module Redmine def events_welcome(from = nil, to = nil, options={}) e = [] @options[:limit] = options[:limit] - @scope.each do |event_type| constantized_providers(event_type).each do |provider| - e += provider.find_events1(event_type, @user, from, to, @options) + cur_objs = provider.find_events1(event_type, @user, from, to, @options) + cur_objs.each do |cur_obj| + if cur_obj.class == Issue + if cur_obj.project != nil && cur_obj.project.project_status != nil + e += [cur_obj] + end + else + e += [cur_obj] + end + end + end + if e.count > options[:limit] + break end end