diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-10-27 15:18:01 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2020-10-27 15:18:01 +0000 |
commit | ead5d6b29a930d8824535cbece343337ec07eb69 (patch) | |
tree | d1b95ae77baf438d970221ee66ec005b780bf2b2 | |
parent | 9bb9287970282f86f62f37b903ce6f08411484c4 (diff) | |
download | redmine-ead5d6b29a930d8824535cbece343337ec07eb69.tar.gz redmine-ead5d6b29a930d8824535cbece343337ec07eb69.zip |
shorten long line of app/models/message.rb
git-svn-id: http://svn.redmine.org/redmine/trunk@20205 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/message.rb | 46 |
1 files changed, 25 insertions, 21 deletions
diff --git a/app/models/message.rb b/app/models/message.rb index 87481ac61..bf2c13eab 100644 --- a/app/models/message.rb +++ b/app/models/message.rb @@ -29,22 +29,24 @@ class Message < ActiveRecord::Base :preload => {:board => :project}, :project_key => "#{Board.table_name}.project_id" - acts_as_event :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, - :description => :content, - :group => :parent, - :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, - :url => - Proc.new {|o| - {:controller => 'messages', :action => 'show', - :board_id => o.board_id}. - merge( - if o.parent_id.nil? - {:id => o.id} - else - {:id => o.parent_id, :r => o.id, :anchor => "message-#{o.id}"} - end) - } - + acts_as_event( + :title => Proc.new {|o| "#{o.board.name}: #{o.subject}"}, + :description => :content, + :group => :parent, + :type => Proc.new {|o| o.parent_id.nil? ? 'message' : 'reply'}, + :url => + Proc.new do |o| + {:controller => 'messages', :action => 'show', + :board_id => o.board_id}. + merge( + if o.parent_id.nil? + {:id => o.id} + else + {:id => o.parent_id, :r => o.id, :anchor => "message-#{o.id}"} + end + ) + end + ) acts_as_activity_provider :scope => proc { preload({:board => :project}, :author) }, :author_key => :author_id acts_as_watchable @@ -64,11 +66,13 @@ class Message < ActiveRecord::Base } safe_attributes 'subject', 'content' - safe_attributes 'locked', 'sticky', 'board_id', - :if => lambda {|message, user| - user.allowed_to?(:edit_messages, message.project) - } - + safe_attributes( + 'locked', 'sticky', 'board_id', + :if => + lambda do |message, user| + user.allowed_to?(:edit_messages, message.project) + end + ) def visible?(user=User.current) !user.nil? && user.allowed_to?(:view_messages, project) end |