]> source.dussan.org Git - redmine.git/commitdiff
Time entries csv export should check issue visibility (#33075).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Apr 2020 07:39:29 +0000 (07:39 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 5 Apr 2020 07:39:29 +0000 (07:39 +0000)
Patch by Mizuki ISHIKAWA.

git-svn-id: http://svn.redmine.org/redmine/trunk@19646 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/helpers/queries_helper.rb
test/functional/timelog_controller_test.rb

index d1229619945d57dd4a95341e5b400e8de75bfd1e..2e5b86b6eb5b79bd4a42245061c30b253e1b9816 100644 (file)
@@ -273,7 +273,7 @@ module QueriesHelper
           value.to_s(object)
         when 'Issue'
           if object.is_a?(TimeEntry)
-            "#{value.tracker} ##{value.id}: #{value.subject}"
+            value.visible? ? "#{value.tracker} ##{value.id}: #{value.subject}" : "##{value.id}"
           else
             value.id
           end
index b57dfb8c3a62ca16d10fc0ed958e8f80c924807e..a9da5fa423fd0747fc4b90e244cba577a6c6facb 100644 (file)
@@ -1418,6 +1418,19 @@ class TimelogControllerTest < Redmine::ControllerTest
     assert_include "#{issue.tracker} #1: #{issue.subject}", line
   end
 
+  def test_index_csv_should_fill_issue_column_with_issue_id_if_issue_that_is_not_visible
+    @request.session[:user_id] = 3
+    issue = Issue.generate!(:author_id => 1, :is_private => true)
+    entry = TimeEntry.generate!(:issue => issue, :comments => "Issue column content test")
+
+    get :index, :params => {:format => 'csv'}
+    assert_not issue.visible?
+    line = response.body.split("\n").detect {|l| l.include?(entry.comments)}
+    assert_not_nil line
+    assert_not_include "#{issue.tracker} ##{issue.id}: #{issue.subject}", line
+    assert_include "##{issue.id}", line
+  end
+
   def test_index_grouped_by_created_on
     skip unless TimeEntryQuery.new.groupable_columns.detect {|c| c.name == :created_on}