Project

General

Profile

Feature #1554 » revised_view_private_messages_in_RSS_and_PDF_formats.patch

Apply after first patch - Andrew Kirillov, 2012-12-03 09:07

View differences:

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

  
101 101
  def show
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)
102
    @journals = @issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC")
104 103
    @journals.each_with_index {|j,i| j.indice = i+1; r = IncomingEmail.where(:journal_id => j.id); j.email ||= r[0]['id'] if r.present?}
105 104
    @journals.reverse! if User.current.wants_comments_in_reverse_order?
106 105

  
app/views/journals/index.builder (revision )
6 6
  xml.id      url_for(:controller => 'welcome', :only_path => false)
7 7
  xml.updated((@journals.first ? @journals.first.event_datetime : Time.now).xmlschema)
8 8
  xml.author  { xml.name "#{Setting.app_title}" }
9
  view_private = User.current.allowed_to?(:view_private_messages, @project)
10
  @skipped = 0
9 11
  @journals.each do |change|
10 12
    issue = change.issue
13
    if change.private
14
      unless view_private
15
        @skipped += 1
16
        next
17
      end
18
    end
11 19
    xml.entry do
12 20
      xml.title   "#{issue.project.name} - #{issue.tracker.name} ##{issue.id}: #{issue.subject}"
13 21
      xml.link    "rel" => "alternate", "href" => url_for(:controller => 'issues' , :action => 'show', :id => issue, :only_path => false)
14
      xml.id      url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change, :only_path => false)
22
      xml.id      url_for(:controller => 'issues' , :action => 'show', :id => issue, :journal_id => change.indice - @skipped, :only_path => false)
15 23
      xml.updated change.created_on.xmlschema
16 24
      xml.author do
17 25
        xml.name change.user.name
lib/redmine/export/pdf.rb (revision )
646 646
        pdf.RDMCell(190,5, l(:label_history), "B")
647 647
        pdf.Ln
648 648
        indice = 0
649
        view_private = User.current.allowed_to?(:view_private_messages, @project)
649 650

  
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)
651
        journals = issue.journals.includes([:user, :details]).order("`journals`.`created_on` ASC")
652 652
        journals.each do |journal|
653 653
          indice = indice + 1
654
          if journal.private
655
            unless view_private
656
              indice = indice - 1
657
              next
658
            end
659
          end
654 660
          pdf.SetFontStyle('B',8)
655 661
          pdf.RDMCell(190,5,
656 662
             "#" + indice.to_s +
(8-8/8)