@@ -95,7 +95,7 class TimeEntry < ActiveRecord::Base | |||||
95 | if attrs |
|
95 | if attrs | |
96 | attrs = super(attrs) |
|
96 | attrs = super(attrs) | |
97 | if issue_id_changed? && issue |
|
97 | if issue_id_changed? && issue | |
98 | if user.allowed_to?(:log_time, issue.project) |
|
98 | if issue.visible?(user) && user.allowed_to?(:log_time, issue.project) | |
99 | if attrs[:project_id].blank? && issue.project_id != project_id |
|
99 | if attrs[:project_id].blank? && issue.project_id != project_id | |
100 | self.project_id = issue.project_id |
|
100 | self.project_id = issue.project_id | |
101 | end |
|
101 | end |
@@ -13,7 +13,9 | |||||
13 | <% end %> |
|
13 | <% end %> | |
14 | <p> |
|
14 | <p> | |
15 | <%= f.text_field :issue_id, :size => 6 %> |
|
15 | <%= f.text_field :issue_id, :size => 6 %> | |
16 | <span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" if @time_entry.issue %></span> |
|
16 | <% if @time_entry.issue.try(:visible?) %> | |
|
17 | <span id="time_entry_issue"><%= "#{@time_entry.issue.tracker.name} ##{@time_entry.issue.id}: #{@time_entry.issue.subject}" %></span> | |||
|
18 | <% end %> | |||
17 | </p> |
|
19 | </p> | |
18 | <p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> |
|
20 | <p><%= f.text_field :spent_on, :size => 10, :required => true %><%= calendar_for('time_entry_spent_on') %></p> | |
19 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> |
|
21 | <p><%= f.text_field :hours, :size => 6, :required => true %></p> |
@@ -219,6 +219,23 class TimelogControllerTest < ActionController::TestCase | |||||
219 | end |
|
219 | end | |
220 | end |
|
220 | end | |
221 |
|
221 | |||
|
222 | def test_create_on_issue_that_is_not_visible_should_not_disclose_subject | |||
|
223 | issue = Issue.generate!(:subject => "issue_that_is_not_visible", :is_private => true) | |||
|
224 | assert !issue.visible?(User.find(3)) | |||
|
225 | ||||
|
226 | @request.session[:user_id] = 3 | |||
|
227 | assert_no_difference 'TimeEntry.count' do | |||
|
228 | post :create, :time_entry => { | |||
|
229 | :project_id => '', :issue_id => issue.id.to_s, | |||
|
230 | :activity_id => '11', :spent_on => '2008-03-14', :hours => '7.3' | |||
|
231 | } | |||
|
232 | end | |||
|
233 | assert_select_error /Issue is invalid/ | |||
|
234 | assert_select "input[name=?][value=?]", "time_entry[issue_id]", issue.id.to_s | |||
|
235 | assert_select "#time_entry_issue", 0 | |||
|
236 | assert !response.body.include?('issue_that_is_not_visible') | |||
|
237 | end | |||
|
238 | ||||
222 | def test_create_and_continue_at_project_level |
|
239 | def test_create_and_continue_at_project_level | |
223 | @request.session[:user_id] = 2 |
|
240 | @request.session[:user_id] = 2 | |
224 | assert_difference 'TimeEntry.count' do |
|
241 | assert_difference 'TimeEntry.count' do |
General Comments 0
You need to be logged in to leave comments.
Login now