summaryrefslogtreecommitdiffstats
path: root/app/models/journal.rb
diff options
context:
space:
mode:
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-10-22 14:17:43 +0000
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>2020-10-22 14:17:43 +0000
commitf4aa4b0f87ec4c26f25e7828bde98f9a4d3ba194 (patch)
treecceaf5e483e2f4608c3d41d663fc38d808ac0841 /app/models/journal.rb
parentbf3f2e19d38f6f3d46c9164b46fc21f9e2de6906 (diff)
downloadredmine-f4aa4b0f87ec4c26f25e7828bde98f9a4d3ba194.tar.gz
redmine-f4aa4b0f87ec4c26f25e7828bde98f9a4d3ba194.zip
shorten long line of app/models/journal.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20159 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/journal.rb')
-rw-r--r--app/models/journal.rb45
1 files changed, 29 insertions, 16 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 2843e8faf..21ce4d21e 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -29,22 +29,35 @@ class Journal < ActiveRecord::Base
has_many :details, :class_name => "JournalDetail", :dependent => :delete_all, :inverse_of => :journal
attr_accessor :indice
- acts_as_event :title => Proc.new {|o| status = ((s = o.new_status) ? " (#{s})" : nil); "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}"},
- :description => :notes,
- :author => :user,
- :group => :issue,
- :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note'},
- :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
-
- acts_as_activity_provider :type => 'issues',
- :author_key => :user_id,
- :scope => proc {
- preload({:issue => :project}, :user).
- joins("LEFT OUTER JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id").
- where("#{Journal.table_name}.journalized_type = 'Issue' AND" +
- " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')").distinct
- }
-
+ acts_as_event(
+ :title =>
+ Proc.new do |o|
+ status = ((s = o.new_status) ? " (#{s})" : nil)
+ "#{o.issue.tracker} ##{o.issue.id}#{status}: #{o.issue.subject}"
+ end,
+ :description => :notes,
+ :author => :user,
+ :group => :issue,
+ :type =>
+ Proc.new do |o|
+ (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note'
+ end,
+ :url =>
+ Proc.new do |o|
+ {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}
+ end
+ )
+ acts_as_activity_provider(
+ :type => 'issues',
+ :author_key => :user_id,
+ :scope =>
+ proc do
+ preload({:issue => :project}, :user).
+ joins("LEFT OUTER JOIN #{JournalDetail.table_name} ON #{JournalDetail.table_name}.journal_id = #{Journal.table_name}.id").
+ where("#{Journal.table_name}.journalized_type = 'Issue' AND" +
+ " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')").distinct
+ end
+ )
before_create :split_private_notes
after_create_commit :send_notification