restrict_view_private_messages_in_RSS_and_PDF_formats.patch

Andrew Kirillov, 2012-08-30 06:51

Download (2.1 KB)

View differences:

app/controllers/issues_controller.rb (revision 9e4783319f98513aca1736ca5dd758e9f8ea0800)
99 99
  end
100 100

  
101 101
  def show
102
    @journals = @issue.journals.find(:all, :include => [:user, :details], :order => "#{Journal.table_name}.created_on ASC")
102
    @journals = @issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC") if User.current.allowed_to?(:view_private_messages, @issue.project)
103
    @journals = @issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC").where("`journals`.`private` IS NULL") unless User.current.allowed_to?(:view_private_messages, @issue.project)
103 104
    @journals.each_with_index {|j,i| j.indice = i+1}
104 105
    @journals.reverse! if User.current.wants_comments_in_reverse_order?
105 106

  
lib/redmine/export/pdf.rb (revision 9e4783319f98513aca1736ca5dd758e9f8ea0800)
646 646
        pdf.RDMCell(190,5, l(:label_history), "B")
647 647
        pdf.Ln
648 648
        indice = 0
649
        for journal in issue.journals.find(
650
                          :all, :include => [:user, :details],
651
                          :order => "#{Journal.table_name}.created_on ASC")
649

  
650
        journals = issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC") if User.current.allowed_to?(:view_private_messages, @issue.project)
651
        journals = issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC").where("`journals`.`private` IS NULL") unless User.current.allowed_to?(:view_private_messages, @issue.project)
652
        journals.each do |journal|
652 653
          indice = indice + 1
653 654
          pdf.SetFontStyle('B',8)
654 655
          pdf.RDMCell(190,5,