diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-30 11:18:22 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2008-11-30 11:18:22 +0000 |
commit | fce4615f10ad81b9070e65a45f9d37b1c571ccd7 (patch) | |
tree | b922752605cd207cf51e72866f435af8427ea468 /app/models | |
parent | b5fcea9e7414647533ee333485ed8c93b9cff82f (diff) | |
download | redmine-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 'app/models')
-rw-r--r-- | app/models/attachment.rb | 2 | ||||
-rw-r--r-- | app/models/changeset.rb | 1 | ||||
-rw-r--r-- | app/models/issue.rb | 3 | ||||
-rw-r--r-- | app/models/journal.rb | 1 | ||||
-rw-r--r-- | app/models/message.rb | 3 | ||||
-rw-r--r-- | app/models/news.rb | 3 | ||||
-rw-r--r-- | app/models/wiki_content.rb | 1 |
7 files changed, 11 insertions, 3 deletions
diff --git a/app/models/attachment.rb b/app/models/attachment.rb index 95ba8491f..f838076c6 100644 --- a/app/models/attachment.rb +++ b/app/models/attachment.rb @@ -30,12 +30,14 @@ class Attachment < ActiveRecord::Base acts_as_activity_provider :type => 'files', :permission => :view_files, + :author_key => :author_id, :find_options => {:select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Version.table_name} ON #{Attachment.table_name}.container_type='Version' AND #{Version.table_name}.id = #{Attachment.table_name}.container_id " + "LEFT JOIN #{Project.table_name} ON #{Version.table_name}.project_id = #{Project.table_name}.id"} acts_as_activity_provider :type => 'documents', :permission => :view_documents, + :author_key => :author_id, :find_options => {:select => "#{Attachment.table_name}.*", :joins => "LEFT JOIN #{Document.table_name} ON #{Attachment.table_name}.container_type='Document' AND #{Document.table_name}.id = #{Attachment.table_name}.container_id " + "LEFT JOIN #{Project.table_name} ON #{Document.table_name}.project_id = #{Project.table_name}.id"} diff --git a/app/models/changeset.rb b/app/models/changeset.rb index dd38ce757..759d240df 100644 --- a/app/models/changeset.rb +++ b/app/models/changeset.rb @@ -34,6 +34,7 @@ class Changeset < ActiveRecord::Base :date_column => 'committed_on' acts_as_activity_provider :timestamp => "#{table_name}.committed_on", + :author_key => :user_id, :find_options => {:include => {:repository => :project}} validates_presence_of :repository_id, :revision, :committed_on, :commit_date diff --git a/app/models/issue.rb b/app/models/issue.rb index 4701e41f1..7488850af 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -42,7 +42,8 @@ class Issue < ActiveRecord::Base acts_as_event :title => Proc.new {|o| "#{o.tracker.name} ##{o.id}: #{o.subject}"}, :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.id}} - acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]} + acts_as_activity_provider :find_options => {:include => [:project, :author, :tracker]}, + :author_key => :author_id validates_presence_of :subject, :description, :priority, :project, :tracker, :author, :status validates_length_of :subject, :maximum => 255 diff --git a/app/models/journal.rb b/app/models/journal.rb index 71a51290b..72e7eb91c 100644 --- a/app/models/journal.rb +++ b/app/models/journal.rb @@ -33,6 +33,7 @@ class Journal < ActiveRecord::Base acts_as_activity_provider :type => 'issues', :permission => :view_issues, + :author_key => :user_id, :find_options => {:include => [{:issue => :project}, :details, :user], :conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" + " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"} diff --git a/app/models/message.rb b/app/models/message.rb index 9a313e822..acb300f46 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -32,7 +32,8 @@ class Message < ActiveRecord::Base :url => Proc.new {|o| {:controller => 'messages', :action => 'show', :board_id => o.board_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :anchor => "message-#{o.id}"})} - acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]} + acts_as_activity_provider :find_options => {:include => [{:board => :project}, :author]}, + :author_key => :author_id acts_as_watchable attr_protected :locked, :sticky diff --git a/app/models/news.rb b/app/models/news.rb index 969b37a0d..5949a731b 100644 --- a/app/models/news.rb +++ b/app/models/news.rb @@ -26,7 +26,8 @@ class News < ActiveRecord::Base acts_as_searchable :columns => ['title', "#{table_name}.description"], :include => :project acts_as_event :url => Proc.new {|o| {:controller => 'news', :action => 'show', :id => o.id}} - acts_as_activity_provider :find_options => {:include => [:project, :author]} + acts_as_activity_provider :find_options => {:include => [:project, :author]}, + :author_key => :author_id # returns latest news for projects visible by user def self.latest(user = User.current, count = 5) diff --git a/app/models/wiki_content.rb b/app/models/wiki_content.rb index 4a4c5c270..e958e7b24 100644 --- a/app/models/wiki_content.rb +++ b/app/models/wiki_content.rb @@ -37,6 +37,7 @@ class WikiContent < ActiveRecord::Base acts_as_activity_provider :type => 'wiki_edits', :timestamp => "#{WikiContent.versioned_table_name}.updated_on", + :author_key => "#{WikiContent.versioned_table_name}.author_id", :permission => :view_wiki_edits, :find_options => {:select => "#{WikiContent.versioned_table_name}.updated_on, #{WikiContent.versioned_table_name}.comments, " + "#{WikiContent.versioned_table_name}.#{WikiContent.version_column}, #{WikiPage.table_name}.title, " + |