comparison app/models/.svn/text-base/journal.rb.svn-base @ 441:cbce1fd3b1b7 redmine-1.2

Update to Redmine 1.2-stable branch (Redmine SVN rev 6000)
author Chris Cannam
date Mon, 06 Jun 2011 14:24:13 +0100
parents 40f7cfd4df19
children
comparison
equal deleted inserted replaced
245:051f544170fe 441:cbce1fd3b1b7
1 # redMine - project management software 1 # Redmine - project management software
2 # Copyright (C) 2006 Jean-Philippe Lang 2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 # 3 #
4 # This program is free software; you can redistribute it and/or 4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License 5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2 6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version. 7 # of the License, or (at your option) any later version.
30 :author => :user, 30 :author => :user,
31 :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' }, 31 :type => Proc.new {|o| (s = o.new_status) ? (s.is_closed? ? 'issue-closed' : 'issue-edit') : 'issue-note' },
32 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}} 32 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
33 33
34 acts_as_activity_provider :type => 'issues', 34 acts_as_activity_provider :type => 'issues',
35 :permission => :view_issues,
36 :author_key => :user_id, 35 :author_key => :user_id,
37 :find_options => {:include => [{:issue => :project}, :details, :user], 36 :find_options => {:include => [{:issue => :project}, :details, :user],
38 :conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" + 37 :conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
39 " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"} 38 " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
39
40 named_scope :visible, lambda {|*args| {
41 :include => {:issue => :project},
42 :conditions => Issue.visible_condition(args.shift || User.current, *args)
43 }}
40 44
41 def save(*args) 45 def save(*args)
42 # Do not save an empty journal 46 # Do not save an empty journal
43 (details.empty? && notes.blank?) ? false : super 47 (details.empty? && notes.blank?) ? false : super
44 end 48 end
71 s = 'journal' 75 s = 'journal'
72 s << ' has-notes' unless notes.blank? 76 s << ' has-notes' unless notes.blank?
73 s << ' has-details' unless details.blank? 77 s << ' has-details' unless details.blank?
74 s 78 s
75 end 79 end
80
81 def notify?
82 @notify != false
83 end
84
85 def notify=(arg)
86 @notify = arg
87 end
76 end 88 end