summaryrefslogtreecommitdiffstats
path: root/app/models/journal.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-03-15 17:16:45 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-03-15 17:16:45 +0000
commit83df013f47e6794f574d650716f7545f0725abd9 (patch)
tree882a1769085eecfcdb81cf99e1d5015083a4f443 /app/models/journal.rb
parentfba3d5d327c459486dfaddb296f0e0673df0de66 (diff)
downloadredmine-83df013f47e6794f574d650716f7545f0725abd9.tar.gz
redmine-83df013f47e6794f574d650716f7545f0725abd9.zip
Adds a visible scope to the Journal model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@5142 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/models/journal.rb')
-rw-r--r--app/models/journal.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/app/models/journal.rb b/app/models/journal.rb
index 3e846aeb8..7a36b12f1 100644
--- a/app/models/journal.rb
+++ b/app/models/journal.rb
@@ -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
@@ -38,6 +38,11 @@ class Journal < ActiveRecord::Base
: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.first || User.current)
+ }}
+
def save(*args)
# Do not save an empty journal
(details.empty? && notes.blank?) ? false : super