From: Toshi MARUYAMA Date: Thu, 22 Oct 2020 14:17:43 +0000 (+0000) Subject: shorten long line of app/models/journal.rb X-Git-Tag: 4.2.0~658 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=f4aa4b0f87ec4c26f25e7828bde98f9a4d3ba194;p=redmine.git shorten long line of app/models/journal.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20159 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- 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