summaryrefslogtreecommitdiffstats
path: root/lib/redmine/activity
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-30 11:18:22 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-11-30 11:18:22 +0000
commitfce4615f10ad81b9070e65a45f9d37b1c571ccd7 (patch)
treeb922752605cd207cf51e72866f435af8427ea468 /lib/redmine/activity
parentb5fcea9e7414647533ee333485ed8c93b9cff82f (diff)
downloadredmine-fce4615f10ad81b9070e65a45f9d37b1c571ccd7.tar.gz
redmine-fce4615f10ad81b9070e65a45f9d37b1c571ccd7.zip
Display latest user's activity on account/show view.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2066 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'lib/redmine/activity')
-rw-r--r--lib/redmine/activity/fetcher.rb10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/redmine/activity/fetcher.rb b/lib/redmine/activity/fetcher.rb
index adaead564..b12caa441 100644
--- a/lib/redmine/activity/fetcher.rb
+++ b/lib/redmine/activity/fetcher.rb
@@ -25,7 +25,7 @@ module Redmine
@@constantized_providers = Hash.new {|h,k| h[k] = Redmine::Activity.providers[k].collect {|t| t.constantize } }
def initialize(user, options={})
- options.assert_valid_keys(:project, :with_subprojects)
+ options.assert_valid_keys(:project, :with_subprojects, :author)
@user = user
@project = options[:project]
@options = options
@@ -58,14 +58,20 @@ module Redmine
end
# Returns an array of events for the given date range
- def events(from, to)
+ 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
end
+
+ if options[:limit]
+ e.sort! {|a,b| b.event_date <=> a.event_date}
+ e = e.slice(0, options[:limit])
+ end
e
end