diff app/models/.svn/text-base/journal.rb.svn-base @ 511:107d36338b70 live

Merge from branch "cannam"
author Chris Cannam
date Thu, 14 Jul 2011 10:43:07 +0100
parents cbce1fd3b1b7
children
line wrap: on
line diff
--- a/app/models/.svn/text-base/journal.rb.svn-base	Thu Jun 09 16:51:06 2011 +0100
+++ b/app/models/.svn/text-base/journal.rb.svn-base	Thu Jul 14 10:43:07 2011 +0100
@@ -1,5 +1,5 @@
-# redMine - project management software
-# Copyright (C) 2006  Jean-Philippe Lang
+# Redmine - project management software
+# Copyright (C) 2006-2011  Jean-Philippe Lang
 #
 # This program is free software; you can redistribute it and/or
 # modify it under the terms of the GNU General Public License
@@ -32,12 +32,16 @@
                 :url => Proc.new {|o| {:controller => 'issues', :action => 'show', :id => o.issue.id, :anchor => "change-#{o.id}"}}
 
   acts_as_activity_provider :type => 'issues',
-                            :permission => :view_issues,
                             :author_key => :user_id,
                             :find_options => {:include => [{:issue => :project}, :details, :user],
                                               :conditions => "#{Journal.table_name}.journalized_type = 'Issue' AND" +
                                                              " (#{JournalDetail.table_name}.prop_key = 'status_id' OR #{Journal.table_name}.notes <> '')"}
   
+  named_scope :visible, lambda {|*args| {
+    :include => {:issue => :project},
+    :conditions => Issue.visible_condition(args.shift || User.current, *args)
+  }}
+  
   def save(*args)
     # Do not save an empty journal
     (details.empty? && notes.blank?) ? false : super
@@ -73,4 +77,12 @@
     s << ' has-details' unless details.blank?
     s
   end
+  
+  def notify?
+    @notify != false
+  end
+  
+  def notify=(arg)
+    @notify = arg
+  end
 end