]> source.dussan.org Git - redmine.git/commitdiff
Do not display in issue edit page spent time custom fields not visible by the user...
authorGo MAEDA <maeda@farend.jp>
Mon, 15 Mar 2021 23:32:52 +0000 (23:32 +0000)
committerGo MAEDA <maeda@farend.jp>
Mon, 15 Mar 2021 23:32:52 +0000 (23:32 +0000)
Patch by  Marius BALTEANU.

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

app/views/issues/_edit.html.erb
test/functional/issues_controller_test.rb

index 33f8352f574d8634ceb1fd077a9226eea21b5370..954f606f3cf30f10291cab5476fc0aaabc37d526 100644 (file)
@@ -21,7 +21,7 @@
         </div>
         </div>
         <p><%= time_entry.text_field :comments, :size => 60 %></p>
-        <% @time_entry.custom_field_values.each do |value| %>
+        <% @time_entry.editable_custom_field_values.each do |value| %>
           <p><%= custom_field_tag_with_label :time_entry, value %></p>
         <% end %>
         <% end %>
index 91d11c6c89ecf7e74cb5829e051ff5d0354de314..45217b6968387380838042fd2e821990ebfd1648 100644 (file)
@@ -5658,6 +5658,41 @@ class IssuesControllerTest < Redmine::ControllerTest
     assert_select 'span.icon-warning[title=?]', reason, :text => reason
   end
 
+  def test_get_edit_should_display_visible_spent_time_custom_field
+    @request.session[:user_id] = 2
+
+    get(
+      :edit,
+      :params => {
+        :id => 13,
+      }
+    )
+
+    assert_response :success
+
+    assert_select '#issue-form select.cf_10', 1
+  end
+
+  def test_get_edit_should_not_display_spent_time_custom_field_not_visible
+    cf = TimeEntryCustomField.find(10)
+    cf.visible = false
+    cf.role_ids = [1]
+    cf.save!
+
+    @request.session[:user_id] = 2
+
+    get(
+      :edit,
+      :params => {
+        :id => 13,
+      }
+    )
+
+    assert_response :success
+
+    assert_select '#issue-form select.cf_10', 0
+  end
+
   def test_update_form_for_existing_issue
     @request.session[:user_id] = 2
     patch(