Project

General

Profile

Feature #20458 » fetch_many_authors.patch

Victor Campos, 2015-08-02 14:19

View differences:

lib/redmine/activity/fetcher.rb (cópia de trabalho)
# Returns an array of events for the given date range
# sorted in reverse chronological order
def events(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_events(event_type, @user, from, to, @options)
end
if options[:author].is_a? Array
e = options[:author].map { |a| find_events_with_author(from, to, a) }.inject([], :+)
else
e = find_events_with_author(from, to, options[:author])
end
e.sort! {|a,b| b.event_datetime <=> a.event_datetime}
......
private
def find_events_with_author(from, to, author)
e = []
@scope.each do |event_type|
constantized_providers(event_type).each do |provider|
e += provider.find_events(event_type, @user, from, to, @options.merge(author: author))
end
end
e
end
def constantized_providers(event_type)
Redmine::Activity.providers[event_type].map(&:constantize)
end
(1-1/3)