From f7fd194ed5fb8f086d04142aee4aee4627c9835e Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Thu, 22 Oct 2020 14:17:51 +0000 Subject: [PATCH] shorten long line of app/models/wiki_content_version.rb git-svn-id: http://svn.redmine.org/redmine/trunk@20160 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/wiki_content_version.rb | 53 ++++++++++++++++++------------ 1 file changed, 32 insertions(+), 21 deletions(-) diff --git a/app/models/wiki_content_version.rb b/app/models/wiki_content_version.rb index df00aa2d4..1731bccf7 100644 --- a/app/models/wiki_content_version.rb +++ b/app/models/wiki_content_version.rb @@ -23,27 +23,38 @@ class WikiContentVersion < ActiveRecord::Base belongs_to :page, :class_name => 'WikiPage' belongs_to :author, :class_name => 'User' - acts_as_event :title => Proc.new {|o| "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})"}, - :description => :comments, - :datetime => :updated_on, - :type => 'wiki-page', - :group => :page, - :url => Proc.new {|o| {:controller => 'wiki', :action => 'show', :project_id => o.page.wiki.project, :id => o.page.title, :version => o.version}} - - acts_as_activity_provider :type => 'wiki_edits', - :timestamp => "#{table_name}.updated_on", - :author_key => "#{table_name}.author_id", - :permission => :view_wiki_edits, - :scope => proc { - select("#{table_name}.updated_on, #{table_name}.comments, " + - "#{table_name}.version, #{WikiPage.table_name}.title, " + - "#{table_name}.page_id, #{table_name}.author_id, " + - "#{table_name}.id"). - joins("LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{table_name}.page_id " + - "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " + - "LEFT JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Wiki.table_name}.project_id") - } - + acts_as_event( + :title => + Proc.new do |o| + "#{l(:label_wiki_edit)}: #{o.page.title} (##{o.version})" + end, + :description => :comments, + :datetime => :updated_on, + :type => 'wiki-page', + :group => :page, + :url => + Proc.new do |o| + {:controller => 'wiki', :action => 'show', + :project_id => o.page.wiki.project, + :id => o.page.title, :version => o.version} + end + ) + acts_as_activity_provider( + :type => 'wiki_edits', + :timestamp => "#{table_name}.updated_on", + :author_key => "#{table_name}.author_id", + :permission => :view_wiki_edits, + :scope => + proc do + select("#{table_name}.updated_on, #{table_name}.comments, " + + "#{table_name}.version, #{WikiPage.table_name}.title, " + + "#{table_name}.page_id, #{table_name}.author_id, " + + "#{table_name}.id"). + joins("LEFT JOIN #{WikiPage.table_name} ON #{WikiPage.table_name}.id = #{table_name}.page_id " + + "LEFT JOIN #{Wiki.table_name} ON #{Wiki.table_name}.id = #{WikiPage.table_name}.wiki_id " + + "LEFT JOIN #{Project.table_name} ON #{Project.table_name}.id = #{Wiki.table_name}.project_id") + end + ) after_destroy :page_update_after_destroy def text=(plain) -- 2.39.5